File: rfcntl.h

package info (click to toggle)
dpm-postgres 1.7.4.7-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 13,788 kB
  • ctags: 10,782
  • sloc: ansic: 146,136; sh: 13,362; perl: 11,142; python: 5,529; cpp: 5,113; sql: 1,790; makefile: 955; fortran: 113
file content (64 lines) | stat: -rw-r--r-- 2,300 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * $Id: rfcntl.h 3171 2010-02-15 08:42:46Z baud $
 */

/*
 * @(#)rfcntl.h	1.10 06/04/98  CERN CN-SW/DC Antoine Trannoy, Jean-Philippe Baud
 */

/*
 * Copyright (C) 1990-2010 by CERN/CN/SW/DC
 * All rights reserved
 */

/* rfcntl.h		Macros to convert flags to a single set	*/

/*
 * The SHIFT set of flags is the one defined in Irix (SGI), Unicos (CRAY) and on Apollo machines.
 * These flags do not have the same value on SUN's machines, DEC stations or
 * Linux.
 *
 *		SHIFT		SUN		LINUX		LynxOS
 *				DARWIN, OSF
 *
 * O_RDONLY	000000		000000		000000		000000
 * O_WRONLY	000001		000001		000001		000001
 * O_RDWR	000002		000002		000002		000002
 * O_NDELAY	000004		000004		004000  !	000100 !
 * 0_APPEND	000010		000010		002000  !	000004 !
 * O_CREAT	000400		001000  !	000100  !	000010 !
 * O_TRUNC	001000		002000	!	001000		000020 !
 * O_EXCL	002000		004000	!	000200  !	000040 !
 */

#if defined(sun) || defined(sgi) || defined(hpux) || defined(_AIX) || (defined(__osf__) && defined(__alpha)) || defined(linux) || defined(_WIN32) || defined(__Lynx__) || defined( __APPLE__)

#if defined(sgi) || defined(hpux) || defined(_AIX)  || defined(SOLARIS) || defined(_WIN32) 
#define htonopnflg(A)		(A)
#define ntohopnflg(A)		(A)
#endif	/* sgi || hpux || AIX */

#if (defined(__osf__) && defined(__alpha)) || defined( __APPLE__)
#define htonopnflg(A)		(((A) & ~(007000)) | (((A) & 007000) >> 1)) 
#define ntohopnflg(A)		(((A) & ~(003400)) | (((A) & 003400) << 1))
#endif	/* alpha-osf || Darwin */

#if defined(linux)
#define htonopnflg(A)		(((A) & 004000) >> 9) | (((A) & 002000) >> 7) | \
				(((A) & 000100) << 2) | (((A) & 000200) << 3) | \
				((A) & 001003)
#define ntohopnflg(A)		(((A) & 000004) << 9) | (((A) & 000010) << 7) | \
				(((A) & 000400) >> 2) | (((A) & 002000) >> 3) | \
				((A) & 001003)
#endif	/* linux */

#if defined(__Lynx__)
#define htonopnflg(A)		(((A) & 000100) >> 4) | (((A) & 000004) << 1) | \
				(((A) & 000010) << 5) | (((A) & 000020) << 5) | \
				(((A) & 000040) << 5) | ((A) & 000003)
#define ntohopnflg(A)		(((A) & 000004) << 4) | (((A) & 000010) >> 1) | \
				(((A) & 000400) >> 5) | (((A) & 001000) >> 5) | \
				(((A) & 002000) >> 5) | ((A) & 000003)
#endif	/* __Lynx__ */

#endif	/* sun || sgi || hpux || AIX || alpha-osf || linux || _WIN32 || __Lynx__ || Darwin */