source: sbliveos2/trunk/include/linux/poll.h@ 142

Last change on this file since 142 was 142, checked in by ktk, 25 years ago

Import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1/* $Id: poll.h 142 2000-04-23 14:55:46Z ktk $ */
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
11#ifdef __KERNEL__
12
13struct poll_table_entry {
14 struct file * filp;
15 wait_queue_t wait;
16 wait_queue_head_t * wait_address;
17};
18
19typedef struct poll_table_struct {
20 struct poll_table_struct * next;
21 unsigned int nr;
22 struct poll_table_entry * entry;
23} poll_table;
24
25#define __MAX_POLL_TABLE_ENTRIES ((PAGE_SIZE - sizeof (poll_table)) / sizeof (struct poll_table_entry))
26
27void init_waitqueue_head(wait_queue_head_t *q);
28
29extern void __pollwait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p);
30
31extern void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p);
32
33/*
34 * For the kernel fd_set we use a fixed set-size for allocation purposes.
35 * This set-size doesn't necessarily bear any relation to the size the user
36 * uses, but should preferably obviously be larger than any possible user
37 * size (NR_OPEN bits).
38 *
39 * We need 6 bitmaps (in/out/ex for both incoming and outgoing), and we
40 * allocate one page for all the bitmaps. Thus we have 8*PAGE_SIZE bits,
41 * to be divided by 6. And we'd better make sure we round to a full
42 * long-word (in fact, we'll round to 64 bytes).
43 */
44
45
46#define KFDS_64BLOCK ((PAGE_SIZE/(6*64))*64)
47#define KFDS_NR (KFDS_64BLOCK*8 > NR_OPEN ? NR_OPEN : KFDS_64BLOCK*8)
48typedef unsigned long kernel_fd_set[KFDS_NR/__NFDBITS];
49
50/*
51 * Scaleable version of the fd_set.
52 */
53
54typedef struct {
55 unsigned long *in, *out, *ex;
56 unsigned long *res_in, *res_out, *res_ex;
57} fd_set_bits;
58
59/*
60 * How many longwords for "nr" bits?
61 */
62#define FDS_BITPERLONG (8*sizeof(long))
63#define FDS_LONGS(nr) (((nr)+FDS_BITPERLONG-1)/FDS_BITPERLONG)
64#define FDS_BYTES(nr) (FDS_LONGS(nr)*sizeof(long))
65
66/*
67 * We do a VERIFY_WRITE here even though we are only reading this time:
68 * we'll write to it eventually..
69 *
70 * Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.
71 */
72static int get_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset);
73
74static void set_fd_set(unsigned long nr, void *ufdset, unsigned long *fdset);
75
76static void zero_fd_set(unsigned long nr, unsigned long *fdset);
77
78extern int do_select(int n, fd_set_bits *fds, long *timeout);
79
80#endif /* KERNEL */
81
82#endif /* _LINUX_POLL_H */
Note: See TracBrowser for help on using the repository browser.