source: GPL/trunk/include/linux/poll.h@ 679

Last change on this file since 679 was 679, checked in by David Azarewicz, 4 years ago

Merge changes from Paul's uniaud32next branch.

File size: 3.0 KB
Line 
1/* $Id: poll.h,v 1.1.1.1 2003/07/02 13:57:00 eleph Exp $ */
2
3#ifndef _LINUX_POLL_H
4#define _LINUX_POLL_H
5
6#include <asm/poll.h>
7#include <linux/mm.h>
8#include <asm/uaccess.h>
9#include <linux/wait.h>
10#include <linux/fs.h>
11#include <linux/string.h>
12
13#ifdef __KERNEL__
14
15struct poll_table_entry {
16 struct file * filp;
17 wait_queue_t wait;
18 wait_queue_head_t * wait_address;
19};
20
21typedef struct poll_table_struct {
22 struct poll_table_struct * next;
23 unsigned int nr;
24 struct poll_table_entry * entry;
25} poll_table;
26
27#define __MAX_POLL_TABLE_ENTRIES ((PAGE_SIZE - sizeof (poll_table)) / sizeof (struct poll_table_entry))
28
29void init_waitqueue_head(wait_queue_head_t *q);
30
31extern void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p);
32
33extern void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p);
34
35/*
36 * For the kernel fd_set we use a fixed set-size for allocation purposes.
37 * This set-size doesn't necessarily bear any relation to the size the user
38 * uses, but should preferably obviously be larger than any possible user
39 * size (NR_OPEN bits).
40 *
41 * We need 6 bitmaps (in/out/ex for both incoming and outgoing), and we
42 * allocate one page for all the bitmaps. Thus we have 8*PAGE_SIZE bits,
43 * to be divided by 6. And we'd better make sure we round to a full
44 * long-word (in fact, we'll round to 64 bytes).
45 */
46
47
48#define KFDS_64BLOCK ((PAGE_SIZE/(6*64))*64)
49#define KFDS_NR (KFDS_64BLOCK*8 > NR_OPEN ? NR_OPEN : KFDS_64BLOCK*8)
50typedef unsigned long kernel_fd_set[KFDS_NR/__NFDBITS];
51
52/*
53 * Scaleable version of the fd_set.
54 */
55
56typedef struct {
57 unsigned long *in, *out, *ex;
58 unsigned long *res_in, *res_out, *res_ex;
59} fd_set_bits;
60
61/*
62 * How many longwords for "nr" bits?
63 */
64#define FDS_BITPERLONG (8*sizeof(long))
65#define FDS_LONGS(nr) (((nr)+FDS_BITPERLONG-1)/FDS_BITPERLONG)
66#define FDS_BYTES(nr) (FDS_LONGS(nr)*sizeof(long))
67
68/*
69 * We do a VERIFY_WRITE here even though we are only reading this time:
70 * we'll write to it eventually..
71 *
72 * Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.
73 */
74static int get_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset);
75
76static void set_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset);
77
78static void zero_fd_set(unsigned long nr, unsigned long *fdset);
79
80extern int do_select(int n, fd_set_bits *fds, long *timeout);
81
82#endif /* KERNEL */
83
84/* Epoll event masks */
85#define EPOLLIN (__force __poll_t)0x00000001
86#define EPOLLPRI (__force __poll_t)0x00000002
87#define EPOLLOUT (__force __poll_t)0x00000004
88#define EPOLLERR (__force __poll_t)0x00000008
89#define EPOLLHUP (__force __poll_t)0x00000010
90#define EPOLLNVAL (__force __poll_t)0x00000020
91#define EPOLLRDNORM (__force __poll_t)0x00000040
92#define EPOLLRDBAND (__force __poll_t)0x00000080
93#define EPOLLWRNORM (__force __poll_t)0x00000100
94#define EPOLLWRBAND (__force __poll_t)0x00000200
95#define EPOLLMSG (__force __poll_t)0x00000400
96#define EPOLLRDHUP (__force __poll_t)0x00002000
97
98#endif /* _LINUX_POLL_H */
Note: See TracBrowser for help on using the repository browser.