]> granicus.if.org Git - postgresql/blob - src/include/port/win32.h
Make Win32 tests to match existing Cygwin tests, where appropriate.
[postgresql] / src / include / port / win32.h
1 /* $Header: /cvsroot/pgsql/src/include/port/win32.h,v 1.7 2003/04/18 01:03:42 momjian Exp $ */
2
3 #include <port/win32defs.h>
4
5 #define USES_WINSOCK
6 #define NOFILE            100
7
8 /* defines for dynamic linking on Win32 platform */
9 #ifdef __CYGWIN__
10
11 #if __GNUC__ && ! defined (__declspec)
12 #error You need egcs 1.1 or newer for compiling!
13 #endif
14
15 #ifdef BUILDING_DLL
16 #define DLLIMPORT __declspec (dllexport)
17 #else                                                   /* not BUILDING_DLL */
18 #define DLLIMPORT __declspec (dllimport)
19 #endif
20
21 #elif defined(WIN32) && defined(_MSC_VER)               /* not CYGWIN */
22
23 #if defined(_DLL)
24 #define DLLIMPORT __declspec (dllexport)
25 #else                                                   /* not _DLL */
26 #define DLLIMPORT __declspec (dllimport)
27 #endif
28
29 #else                                                   /* not CYGWIN, not MSVC */
30
31 #define DLLIMPORT
32
33 #endif
34
35 /*
36  * Supplement to <sys/types.h>.
37  */
38 #define uid_t int
39 #define gid_t int
40 #define pid_t unsigned long
41 #define ssize_t int
42 #define mode_t int
43 #define key_t long
44 #define ushort unsigned short
45
46 /*
47  * Supplement to <sys/stat.h>.
48  */
49 #define lstat slat
50
51 #define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
52 #define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
53
54 #define S_IRUSR _S_IREAD
55 #define S_IWUSR _S_IWRITE
56 #define S_IXUSR _S_IEXEC
57 #define S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
58
59 /*
60  * Supplement to <errno.h>.
61  */
62 #include <errno.h>
63 #undef EAGAIN
64 #undef EINTR
65 #define EINTR WSAEINTR
66 #define EAGAIN WSAEWOULDBLOCK
67 #define EMSGSIZE WSAEMSGSIZE
68 #define EAFNOSUPPORT WSAEAFNOSUPPORT
69 #define EWOULDBLOCK WSAEWOULDBLOCK
70 #define ECONNRESET WSAECONNRESET
71 #define EINPROGRESS WSAEINPROGRESS
72
73 /*
74  * Supplement to <math.h>.
75  */
76 #define isnan _isnan
77 #define finite _finite
78 extern double rint(double x);
79
80 /*
81  * Supplement to <stdio.h>.
82  */
83 #define snprintf _snprintf
84 #define vsnprintf _vsnprintf
85
86