update from main archive 960815
[glibc.git] / misc / sys / select.h
blob42c3e3e363982ed9854ba62dbcba62805ace749c
1 /* `fd_set' type and related macros, and `select'/`pselect' declarations.
2 Copyright (C) 1996 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 /* POSIX 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h> */
22 #ifndef _SYS_SELECT_H
24 #define _SYS_SELECT_H 1
25 #include <features.h>
27 /* Get definition of needed basic types. */
28 #include <gnu/types.h>
30 /* Get definition of timer specification structures. */
31 #define __need_timespec
32 #include <time.h>
34 __BEGIN_DECLS
36 /* This declaration puts `struct timeval' in global scope even if
37 <sys/time.h> has not been included to define it. That way the
38 `select' prototype below will not conflict with a later definition
39 of `struct timeval'. */
40 struct timeval;
42 typedef __fd_mask fd_mask;
44 /* Representation of a set of file descriptors. */
45 typedef __fd_set fd_set;
47 /* Maximum number of file descriptors in `fd_set'. */
48 #define FD_SETSIZE __FD_SETSIZE
50 #ifdef __USE_MISC
51 /* Number of bits per word of `fd_set' (some code assumes this is 32). */
52 #define NFDBITS __NFDBITS
53 #endif
56 /* Access macros for `fd_set'. */
57 #define FD_SET(fd, fdsetp) __FD_SET ((fd), (fdsetp))
58 #define FD_CLR(fd, fdsetp) __FD_CLR ((fd), (fdsetp))
59 #define FD_ISSET(fd, fdsetp) __FD_ISSET ((fd), (fdsetp))
60 #define FD_ZERO(fdsetp) __FD_ZERO (fdsetp)
63 /* Check the first NFDS descriptors each in READFDS (if not NULL) for read
64 readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
65 (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out
66 after waiting the interval specified therein. Returns the number of ready
67 descriptors, or -1 for errors. */
68 extern int __select __P ((int __nfds, __fd_set *__readfds,
69 __fd_set *__writefds, __fd_set *__exceptfds,
70 struct timeval *__timeout));
71 extern int select __P ((int __nfds, __fd_set *__readfds,
72 __fd_set *__writefds, __fd_set *__exceptfds,
73 struct timeval *__timeout));
75 /* Same as above only that the TIMEOUT value is given with higher
76 resolution. This version should be used. */
77 extern int __pselect __P ((int __nfds, __fd_set *__readfds,
78 __fd_set *__writefds, __fd_set *__exceptfds,
79 struct timespec *__timeout));
80 extern int pselect __P ((int __nfds, __fd_set *__readfds,
81 __fd_set *__writefds, __fd_set *__exceptfds,
82 struct timespec *__timeout));
84 __END_DECLS
86 #endif /* sys/select.h */