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