1 /* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.24 2004/05/27 13:08:54 momjian Exp $ */
3 /* undefine and redefine after #include */
12 /* Must be here to avoid conflicting with prototype in windows.h */
13 #define mkdir(a,b) mkdir(a)
18 /* defines for dynamic linking on Win32 platform */
19 #if defined(__CYGWIN__) || defined(__MINGW32__)
21 #if __GNUC__ && ! defined (__declspec)
22 #error You need egcs 1.1 or newer for compiling!
26 #define DLLIMPORT __declspec (dllexport)
27 #else /* not BUILDING_DLL */
28 #define DLLIMPORT __declspec (dllimport)
31 #elif defined(WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__)) /* not CYGWIN or MingW */
34 #define DLLIMPORT __declspec (dllexport)
36 #define DLLIMPORT __declspec (dllimport)
39 #else /* not CYGWIN, not MSVC, not MingW */
47 #undef HAVE_UNION_SEMUN
48 #define HAVE_UNION_SEMUN 1
53 #define IPC_PRIVATE 234564
54 #define IPC_NOWAIT 2048
75 int shmdt(const void *shmaddr);
76 void *shmat(int memId, void *shmaddr, int flag);
77 int shmctl(int shmid, int flag, struct shmid_ds * dummy);
78 int shmget(int memKey, int size, int flag);
88 unsigned short *array;
98 int semctl(int semId, int semNum, int flag, union semun);
99 int semget(int semKey, int semNum, int flags);
100 int semop(int semId, struct sembuf * sops, int flag);
103 /* In backend/port/win32/signal.c */
104 void pgwin32_signal_initialize(void);
105 extern DLLIMPORT HANDLE pgwin32_signal_event;
106 void pgwin32_dispatch_queued_signals(void);
107 void pg_queue_signal(int signum);
109 #define sigmask(sig) ( 1 << (sig-1) )
111 /* Signal function return values */
115 #define SIG_DFL ((pqsigfunc)0)
116 #define SIG_ERR ((pqsigfunc)-1)
117 #define SIG_IGN ((pqsigfunc)1)
119 #define kill(pid,sig) pgkill(pid,sig)
120 extern int pgkill(int pid, int sig);
123 #define pg_usleep(t) pgwin32_backend_usleep(t)
124 void pgwin32_backend_usleep(long microsec);
127 /* In backend/port/win32/socket.c */
129 #define socket(af, type, protocol) pgwin32_socket(af, type, protocol)
130 #define accept(s, addr, addrlen) pgwin32_accept(s, addr, addrlen)
131 #define connect(s, name, namelen) pgwin32_connect(s, name, namelen)
132 #define select(n, r, w, e, timeout) pgwin32_select(n, r, w, e, timeout)
133 #define recv(s, buf, len, flags) pgwin32_recv(s, buf, len, flags)
134 #define send(s, buf, len, flags) pgwin32_send(s, buf, len, flags)
136 SOCKET pgwin32_socket(int af, int type, int protocol);
137 SOCKET pgwin32_accept(SOCKET s, struct sockaddr* addr, int* addrlen);
138 int pgwin32_connect(SOCKET s, const struct sockaddr* name, int namelen);
139 int pgwin32_select(int nfds, fd_set* readfs, fd_set* writefds, fd_set* exceptfds, const struct timeval* timeout);
140 int pgwin32_recv(SOCKET s, char* buf, int len, int flags);
141 int pgwin32_send(SOCKET s, char* buf, int len, int flags);
143 const char *pgwin32_socket_strerror(int err);
147 /* Some extra signals */
151 #define SIGABRT 22 /* Set to match W32 value -- not UNIX
160 #define SIGTTOU 22 /* Same as SIGABRT -- no problem, I hope */
167 int tz_minuteswest; /* Minutes west of GMT. */
168 int tz_dsttime; /* Nonzero if DST is ever in effect. */
171 /* for setitimer in backend/port/win32/timer.c */
172 #define ITIMER_REAL 0
174 struct timeval it_interval;
175 struct timeval it_value;
177 int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue);
183 * Supplement to <sys/types.h>.
187 #define pid_t unsigned long
191 #define ushort unsigned short
194 * Supplement to <sys/stat.h>.
199 * Supplement to <errno.h>.
204 #define EINTR WSAEINTR
205 #define EAGAIN WSAEWOULDBLOCK
206 #define EMSGSIZE WSAEMSGSIZE
207 #define EAFNOSUPPORT WSAEAFNOSUPPORT
208 #define EWOULDBLOCK WSAEWOULDBLOCK
209 #define ECONNRESET WSAECONNRESET
210 #define EINPROGRESS WSAEINPROGRESS
211 #define ENOBUFS WSAENOBUFS
212 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
213 #define ECONNREFUSED WSAECONNREFUSED
214 #define EBADFD WSAENOTSOCK
215 #define EOPNOTSUPP WSAEOPNOTSUPP