Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
esp8266/sys/select.h
Go to the documentation of this file.
1
34#ifndef _SYS_SELECT_H_
35#define _SYS_SELECT_H_
36
37/* We can actually pull the FD Set macros from here, but sometimes that won't
38 * work. */
39#include <sys/types.h>
40#include <sys/time.h>
41
42#ifdef __cplusplus
43extern "C" {
44
45
46#ifndef _SYS_TYPES_FD_SET
47# define _SYS_TYPES_FD_SET
48# define NBBY 8 /* number of bits in a byte */
49/*
50 * Select uses bit masks of file descriptors in longs.
51 * These macros manipulate such bit fields (the filesystem macros use chars).
52 * FD_SETSIZE may be defined by the user, but the default here
53 * should be >= NOFILE (param.h).
54 */
55# ifndef FD_SETSIZE
56# define FD_SETSIZE 64
57# endif
58
59typedef long fd_mask;
60# define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */
61# ifndef howmany
62# define howmany(x,y) (((x)+((y)-1))/(y))
63# endif
64
65/* We use a macro for fd_set so that including Sockets.h afterwards
66 can work. */
67typedef struct _types_fd_set {
68 fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
70
71#define fd_set _types_fd_set
72
73# define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
74# define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
75# define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
76# define FD_ZERO(p) (__extension__ (void)({ \
77 size_t __i; \
78 char *__tmp = (char *)p; \
79 for (__i = 0; __i < sizeof (*(p)); ++__i) \
80 *__tmp++ = 0; \
81}))
82#endif // fd_set
83
84#endif
85
96int select(int nfds, fd_set *readfds, fd_set *writefds,
97 fd_set *exceptfds, struct timeval *timeout);
98
99#ifdef __cplusplus
100}
101#endif
102
103#endif /* _SYS_SELECT_H_ */
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
POSIX select().
Definition Fileio.cxx:473