Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtexec / osdep.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 #ifndef OSDEP_H
24 #define OSDEP_H
25
26 /******************************************************************
27  *
28  * $XConsortium: osdep.h /main/4 1996/01/15 11:43:44 rswiston $
29  *
30  * Bitmask routines to support the usage of select() in dtexec.
31  * Revised for Spec1170 conformance.
32  *
33  */
34
35
36 #ifdef _POSIX_SOURCE
37 # include <limits.h>
38 #else
39 # define _POSIX_SOURCE
40 # include <limits.h>
41 # undef _POSIX_SOURCE
42 #endif
43
44 #include <sys/time.h>
45 #include <sys/types.h>
46 #ifndef __hpux
47 # include <sys/select.h>
48 # define FD_SET_CAST(x) (x)
49 #else
50 # define FD_SET_CAST(x) ((int *)(x))
51 #endif
52
53 #ifndef OPEN_MAX
54 # define OPEN_MAX 128
55 #endif
56
57 #if OPEN_MAX <= 128
58 # define MAXSOCKS (OPEN_MAX)
59 #else
60 # define MAXSOCKS 128
61 #endif
62
63 #define BITSET(buf, i)          FD_SET(i, &(buf))
64 #define BITCLEAR(buf, i)        FD_CLR(i, &(buf))
65 #define GETBIT(buf, i)          FD_ISSET(i, &(buf))
66 #define COPYBITS(src, dst)      (dst) = (src)
67 #define CLEARBITS(buf)          FD_ZERO(&buf)
68
69 #endif /* OSDEP_H */