Changeset 183 for trunk/src/emx/include/sys/select.h
- Timestamp:
- May 19, 2003, 4:41:00 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/include/sys/select.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r182 r183 3 3 #ifndef _SYS_SELECT_H 4 4 #define _SYS_SELECT_H 5 #define _SYS_SELECT_H_ 5 6 6 7 #if defined (__cplusplus) … … 8 9 #endif 9 10 11 #include <sys/cdefs.h> 12 13 /** Define sigset_t here for pselect(). */ 14 #if !defined (_SIGSET_T) 15 #define _SIGSET_T 16 typedef unsigned long sigset_t; 17 #endif 18 19 /** Define the number of file handles in the select buffer. 20 * @remark we might wanna bump this one up a bit... */ 10 21 #if !defined (FD_SETSIZE) 11 #define FD_SETSIZE 22 #define FD_SETSIZE 256 12 23 #elif FD_SETSIZE < 256 13 24 #error FD_SETSIZE must be at least 256 14 25 #endif 15 26 27 /** BSD thingy to figure out the size of a bitmap array. */ 28 #ifndef _howmany 29 #define _howmany(a,b) (((a) + ((b) - 1)) / (b)) 30 #endif 31 #if defined(TCPV40HDRS) && !defined(howmany) 32 #define howmany(a,b) (((a) + ((b) - 1)) / (b)) 33 #endif 34 16 35 #if !defined (_FD_SET_T) 17 36 #define _FD_SET_T 37 /** The base type for the select file descriptor bitmap. */ 38 typedef unsigned long __fd_mask; 39 /** Number of bits in a byte. */ 40 #define NBBY 8 41 /** Number of bits in a byte. */ 42 #define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */ 43 /** Select set. */ 44 typedef struct fd_set 45 { 46 __fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)]; 47 } fd_set; 18 48 19 typedef struct _fd_set 20 { 21 unsigned long fds_bits[(FD_SETSIZE+31) / 32]; 22 } fd_set; 49 #if defined(__BSD_VISIBLE) || defined(TCPV40HDRS) 50 typedef __fd_mask fd_mask; 51 #define fds_bits __fds_bits 52 #define NFDBITS _NFDBITS 53 #endif 23 54 24 55 #endif 25 56 26 #define FD_SET(n,s) ((s)->fds_bits[(n)/32] |= (1L << ((n) & 0x1f))) 27 #define FD_CLR(n,s) ((s)->fds_bits[(n)/32] &= ~(1L << ((n) & 0x1f))) 28 #define FD_ISSET(n,s) ((s)->fds_bits[(n)/32] & (1L << ((n) & 0x1f))) 29 #define FD_ZERO(s) (void)memset (s, 0, sizeof (*(s))) 57 #ifndef FD_SET 58 /** Set a bit in the select file descriptor bitmap. */ 59 #define FD_SET(n,s) ((s)->__fds_bits[(n)/_NFDBITS] |= (1L << ((n) & (_NFDBITS - 1)))) 60 /** Clear a bit in the select file descriptor bitmap. */ 61 #define FD_CLR(n,s) ((s)->__fds_bits[(n)/_NFDBITS] &= ~(1L << ((n) & (_NFDBITS - 1)))) 62 /** Test if a bit in the select file descriptor bitmap is set. */ 63 #define FD_ISSET(n,s) ((s)->__fds_bits[(n)/_NFDBITS] & (1L << ((n) & (_NFDBITS - 1)))) 64 /** Initialize the select file descriptor bitmap clearing all bits. */ 65 #define FD_ZERO(s) (void)memset(s, 0, sizeof(*(s))) 66 #if __BSD_VISIBLE 67 /** Copy a select file descriptor bitmap. */ 68 #define FD_COPY(src,trg) (void)(*(trg) = *(src)) 69 #endif 70 #endif /* !FD_SET */ 30 71 31 72 struct timeval; 73 int select (int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *); 74 int _select (int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *); 75 void *memset (void *, int, size_t); /* Used by FD_ZERO */ 76 #ifdef _LIBC_TODO 77 /** A slightly different select call which have better time precision and signal support. */ 78 #warning int pselect(int, fd_set *, fd_set *, fd_set *, const struct timespec *, const sigset_t *); 79 #endif 32 80 33 int select (int, struct _fd_set *, struct _fd_set *, struct _fd_set *, 34 struct timeval *); 81 #ifdef TCPV40HDRS 82 /** This is the TCPIP v4.0 bsd styled select. 83 * Normally it's mapped to select(), but since we don't want any such 84 * confusion we don't. 85 * @remark The normal select() doesn't have socket capabilities int the sys style libc. 86 */ 87 int _System bsdselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *); 88 #define os2_select tcpip40_os2_select 89 #endif 90 /** This is the TCPIP OS/2 styled select. */ 91 int _System os2_select(int *, int, int, int, long); 35 92 36 int _select (int, struct _fd_set *, struct _fd_set *, struct _fd_set *, 37 struct timeval *); 38 39 void *memset (void *, int, size_t); /* Used by FD_ZERO */ 93 /* toolkit BSD pollution: */ 94 #ifndef TCPV40HDRS 95 /* 96 * Used to maintain information about processes that wish to be 97 * notified when I/O becomes possible. 98 */ 99 #pragma pack(1) 100 struct selinfo { 101 pid_t si_pid; /* process to be notified */ 102 short si_flags; /* see below */ 103 }; 104 #pragma pack() 105 #define SI_COLL 0x0001 /* collision occurred */ 106 #endif /* !TCPV40HDRS */ 40 107 41 108 #if defined (__cplusplus) -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.