1 |
greg |
3.8 |
/* RCSid $Id: selcall.h,v 3.7 2003/06/26 00:58:09 schorsch Exp $ */ |
2 |
gregl |
3.1 |
/* |
3 |
|
|
* header file for select call compatibility |
4 |
greg |
3.4 |
*/ |
5 |
schorsch |
3.6 |
#ifndef _RAD_SELCALL_H_ |
6 |
|
|
#define _RAD_SELCALL_H_ |
7 |
|
|
#ifdef __cplusplus |
8 |
|
|
extern "C" { |
9 |
|
|
#endif |
10 |
gregl |
3.1 |
|
11 |
|
|
#include <sys/types.h> |
12 |
schorsch |
3.7 |
#ifdef _WIN32 |
13 |
|
|
/*#include <winsock2.h>*/ |
14 |
|
|
#else |
15 |
|
|
#include <sys/time.h> |
16 |
|
|
#endif |
17 |
gregl |
3.1 |
#ifdef INCL_SEL_H |
18 |
|
|
#include <sys/select.h> |
19 |
|
|
#endif |
20 |
|
|
|
21 |
|
|
#ifndef FD_SETSIZE |
22 |
schorsch |
3.7 |
#ifdef _WIN32 |
23 |
|
|
#else |
24 |
|
|
#include <sys/param.h> |
25 |
|
|
#endif |
26 |
gregl |
3.1 |
#define FD_SETSIZE NOFILE /* maximum # select file descriptors */ |
27 |
|
|
#endif |
28 |
|
|
#ifndef FD_SET |
29 |
|
|
#ifndef NFDBITS |
30 |
|
|
#define NFDBITS (8*sizeof(int)) /* number of bits per fd_mask */ |
31 |
|
|
#endif |
32 |
|
|
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) |
33 |
|
|
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) |
34 |
|
|
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) |
35 |
gregl |
3.2 |
#ifdef BSD |
36 |
gregl |
3.1 |
#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) |
37 |
gregl |
3.2 |
#else |
38 |
|
|
#define FD_ZERO(p) memset((char *)(p), 0, sizeof(*(p))) |
39 |
gregl |
3.1 |
#endif |
40 |
gregl |
3.3 |
#endif |
41 |
schorsch |
3.6 |
|
42 |
|
|
|
43 |
|
|
#ifdef __cplusplus |
44 |
|
|
} |
45 |
|
|
#endif |
46 |
|
|
#endif /* _RAD_SELCALL_H_ */ |