]> git.ipfire.org Git - thirdparty/glibc.git/blame - misc/sys/select.h
update from main archive 960105
[thirdparty/glibc.git] / misc / sys / select.h
CommitLineData
503054c0 1/* `fd_set' type and related macros, and `select'/`pselect' declarations.
df4ef2ab 2 Copyright (C) 1996, 1997 Free Software Foundation, Inc.
2c6fe0bd 3 This file is part of the GNU C Library.
503054c0 4
2c6fe0bd
UD
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.
503054c0 9
2c6fe0bd
UD
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.
503054c0 14
2c6fe0bd
UD
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 not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
503054c0
RM
19
20/* POSIX 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h> */
21
842907c6 22#ifndef _SYS_SELECT_H
503054c0 23
842907c6 24#define _SYS_SELECT_H 1
503054c0
RM
25#include <features.h>
26
27/* Get definition of needed basic types. */
28#include <gnu/types.h>
29
df4ef2ab
UD
30/* Get __FD_* definitions. */
31#include <selectbits.h>
32
503054c0 33/* Get definition of timer specification structures. */
dbe31b9a 34#define __need_timespec
842907c6 35#include <time.h>
503054c0
RM
36
37__BEGIN_DECLS
38
dbe31b9a
RM
39/* This declaration puts `struct timeval' in global scope even if
40 <sys/time.h> has not been included to define it. That way the
41 `select' prototype below will not conflict with a later definition
42 of `struct timeval'. */
43struct timeval;
44
a5113b14
UD
45typedef __fd_mask fd_mask;
46
503054c0 47/* Representation of a set of file descriptors. */
2de99474 48typedef __fd_set fd_set;
503054c0
RM
49
50/* Maximum number of file descriptors in `fd_set'. */
51#define FD_SETSIZE __FD_SETSIZE
52
53#ifdef __USE_MISC
54/* Number of bits per word of `fd_set' (some code assumes this is 32). */
55#define NFDBITS __NFDBITS
56#endif
57
58
59/* Access macros for `fd_set'. */
60#define FD_SET(fd, fdsetp) __FD_SET ((fd), (fdsetp))
61#define FD_CLR(fd, fdsetp) __FD_CLR ((fd), (fdsetp))
62#define FD_ISSET(fd, fdsetp) __FD_ISSET ((fd), (fdsetp))
63#define FD_ZERO(fdsetp) __FD_ZERO (fdsetp)
64
65
66/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
67 readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
68 (if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out
69 after waiting the interval specified therein. Returns the number of ready
70 descriptors, or -1 for errors. */
71extern int __select __P ((int __nfds, __fd_set *__readfds,
72 __fd_set *__writefds, __fd_set *__exceptfds,
73 struct timeval *__timeout));
74extern int select __P ((int __nfds, __fd_set *__readfds,
75 __fd_set *__writefds, __fd_set *__exceptfds,
76 struct timeval *__timeout));
77
78/* Same as above only that the TIMEOUT value is given with higher
79 resolution. This version should be used. */
80extern int __pselect __P ((int __nfds, __fd_set *__readfds,
81 __fd_set *__writefds, __fd_set *__exceptfds,
82 struct timespec *__timeout));
83extern int pselect __P ((int __nfds, __fd_set *__readfds,
84 __fd_set *__writefds, __fd_set *__exceptfds,
85 struct timespec *__timeout));
86
87__END_DECLS
88
89#endif /* sys/select.h */