PostgreSQL Source Code  git master
win32_port.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * win32_port.h
4  * Windows-specific compatibility stuff.
5  *
6  * Note this is read in MinGW as well as native Windows builds,
7  * but not in Cygwin builds.
8  *
9  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
10  * Portions Copyright (c) 1994, Regents of the University of California
11  *
12  * src/include/port/win32_port.h
13  *
14  *-------------------------------------------------------------------------
15  */
16 #ifndef PG_WIN32_PORT_H
17 #define PG_WIN32_PORT_H
18 
19 /*
20  * Always build with SSPI support. Keep it as a #define in case
21  * we want a switch to disable it sometime in the future.
22  */
23 #define ENABLE_SSPI 1
24 
25 /* undefine and redefine after #include */
26 #undef mkdir
27 
28 #undef ERROR
29 
30 /*
31  * VS2013 and later issue warnings about using the old Winsock API,
32  * which we don't really want to hear about.
33  */
34 #ifdef _MSC_VER
35 #define _WINSOCK_DEPRECATED_NO_WARNINGS
36 #endif
37 
38 /*
39  * The MinGW64 headers choke if this is already defined - they
40  * define it themselves.
41  */
42 #if !defined(__MINGW64_VERSION_MAJOR) || defined(_MSC_VER)
43 #define _WINSOCKAPI_
44 #endif
45 
46 /*
47  * windows.h includes a lot of other headers, slowing down compilation
48  * significantly. WIN32_LEAN_AND_MEAN reduces that a bit. It'd be better to
49  * remove the include of windows.h (as well as indirect inclusions of it) from
50  * such a central place, but until then...
51  *
52  * To be able to include ntstatus.h tell windows.h to not declare NTSTATUS by
53  * temporarily defining UMDF_USING_NTSTATUS, otherwise we'll get warning about
54  * macro redefinitions, as windows.h also defines NTSTATUS (yuck). That in
55  * turn requires including ntstatus.h, winternl.h to get common symbols.
56  */
57 #define WIN32_LEAN_AND_MEAN
58 #define UMDF_USING_NTSTATUS
59 
60 #include <winsock2.h>
61 #include <ws2tcpip.h>
62 #include <windows.h>
63 #include <ntstatus.h>
64 #include <winternl.h>
65 
66 #undef small
67 #include <process.h>
68 #include <signal.h>
69 #include <direct.h>
70 #undef near
71 
72 /* needed before sys/stat hacking below: */
73 #define fstat microsoft_native_fstat
74 #define stat microsoft_native_stat
75 #include <sys/stat.h>
76 #undef fstat
77 #undef stat
78 
79 /* Must be here to avoid conflicting with prototype in windows.h */
80 #define mkdir(a,b) mkdir(a)
81 
82 #define ftruncate(a,b) chsize(a,b)
83 
84 /* Windows doesn't have fsync() as such, use _commit() */
85 #define fsync(fd) _commit(fd)
86 
87 /*
88  * For historical reasons, we allow setting wal_sync_method to
89  * fsync_writethrough on Windows, even though it's really identical to fsync
90  * (both code paths wind up at _commit()).
91  */
92 #define HAVE_FSYNC_WRITETHROUGH
93 #define FSYNC_WRITETHROUGH_IS_FSYNC
94 
95 #define USES_WINSOCK
96 
97 /*
98  * IPC defines
99  */
100 #undef HAVE_UNION_SEMUN
101 #define HAVE_UNION_SEMUN 1
102 
103 #define IPC_RMID 256
104 #define IPC_CREAT 512
105 #define IPC_EXCL 1024
106 #define IPC_PRIVATE 234564
107 #define IPC_NOWAIT 2048
108 #define IPC_STAT 4096
109 
110 #define EACCESS 2048
111 #ifndef EIDRM
112 #define EIDRM 4096
113 #endif
114 
115 #define SETALL 8192
116 #define GETNCNT 16384
117 #define GETVAL 65536
118 #define SETVAL 131072
119 #define GETPID 262144
120 
121 
122 /*
123  * Signal stuff
124  *
125  * For WIN32, there is no wait() call so there are no wait() macros
126  * to interpret the return value of system(). Instead, system()
127  * return values < 0x100 are used for exit() termination, and higher
128  * values are used to indicate non-exit() termination, which is
129  * similar to a unix-style signal exit (think SIGSEGV ==
130  * STATUS_ACCESS_VIOLATION). Return values are broken up into groups:
131  *
132  * https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values
133  *
134  * NT_SUCCESS 0 - 0x3FFFFFFF
135  * NT_INFORMATION 0x40000000 - 0x7FFFFFFF
136  * NT_WARNING 0x80000000 - 0xBFFFFFFF
137  * NT_ERROR 0xC0000000 - 0xFFFFFFFF
138  *
139  * Effectively, we don't care on the severity of the return value from
140  * system(), we just need to know if it was because of exit() or generated
141  * by the system, and it seems values >= 0x100 are system-generated.
142  * See this URL for a list of WIN32 STATUS_* values:
143  *
144  * Wine (URL used in our error messages) -
145  * http://source.winehq.org/source/include/ntstatus.h
146  * Descriptions -
147  * https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55
148  *
149  * The comprehensive exception list is included in ntstatus.h from the
150  * Windows Driver Kit (WDK). A subset of the list is also included in
151  * winnt.h from the Windows SDK. Defining WIN32_NO_STATUS before including
152  * windows.h helps to avoid any conflicts.
153  *
154  * Some day we might want to print descriptions for the most common
155  * exceptions, rather than printing an include file name. We could use
156  * RtlNtStatusToDosError() and pass to FormatMessage(), which can print
157  * the text of error values, but MinGW does not support
158  * RtlNtStatusToDosError().
159  */
160 #define WIFEXITED(w) (((w) & 0XFFFFFF00) == 0)
161 #define WIFSIGNALED(w) (!WIFEXITED(w))
162 #define WEXITSTATUS(w) (w)
163 #define WTERMSIG(w) (w)
164 
165 #define sigmask(sig) ( 1 << ((sig)-1) )
166 
167 /* Signal function return values */
168 #undef SIG_DFL
169 #undef SIG_ERR
170 #undef SIG_IGN
171 #define SIG_DFL ((pqsigfunc)0)
172 #define SIG_ERR ((pqsigfunc)-1)
173 #define SIG_IGN ((pqsigfunc)1)
174 
175 /* Some extra signals */
176 #define SIGHUP 1
177 #define SIGQUIT 3
178 #define SIGTRAP 5
179 #define SIGABRT 22 /* Set to match W32 value -- not UNIX value */
180 #define SIGKILL 9
181 #define SIGPIPE 13
182 #define SIGALRM 14
183 #define SIGSTOP 17
184 #define SIGTSTP 18
185 #define SIGCONT 19
186 #define SIGCHLD 20
187 #define SIGWINCH 28
188 #define SIGUSR1 30
189 #define SIGUSR2 31
190 
191 /* MinGW has gettimeofday(), but MSVC doesn't */
192 #ifdef _MSC_VER
193 /* Last parameter not used */
194 extern int gettimeofday(struct timeval *tp, void *tzp);
195 #endif
196 
197 /* for setitimer in backend/port/win32/timer.c */
198 #define ITIMER_REAL 0
199 struct itimerval
200 {
201  struct timeval it_interval;
202  struct timeval it_value;
203 };
204 
205 int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue);
206 
207 /*
208  * WIN32 does not provide 64-bit off_t, but does provide the functions operating
209  * with 64-bit offsets.
210  */
211 #define pgoff_t __int64
212 
213 #ifdef _MSC_VER
214 #define fseeko(stream, offset, origin) _fseeki64(stream, offset, origin)
215 #define ftello(stream) _ftelli64(stream)
216 #else
217 #ifndef fseeko
218 #define fseeko(stream, offset, origin) fseeko64(stream, offset, origin)
219 #endif
220 #ifndef ftello
221 #define ftello(stream) ftello64(stream)
222 #endif
223 #endif
224 
225 /*
226  * Win32 also doesn't have symlinks, but we can emulate them with
227  * junction points on newer Win32 versions.
228  *
229  * Cygwin has its own symlinks which work on Win95/98/ME where
230  * junction points don't, so use those instead. We have no way of
231  * knowing what type of system Cygwin binaries will be run on.
232  * Note: Some CYGWIN includes might #define WIN32.
233  */
234 extern int pgsymlink(const char *oldpath, const char *newpath);
235 extern int pgreadlink(const char *path, char *buf, size_t size);
236 
237 #define symlink(oldpath, newpath) pgsymlink(oldpath, newpath)
238 #define readlink(path, buf, size) pgreadlink(path, buf, size)
239 
240 /*
241  * Supplement to <sys/types.h>.
242  *
243  * Perl already has typedefs for uid_t and gid_t.
244  */
245 #ifndef PLPERL_HAVE_UID_GID
246 typedef int uid_t;
247 typedef int gid_t;
248 #endif
249 typedef long key_t;
250 
251 #ifdef _MSC_VER
252 typedef int pid_t;
253 #endif
254 
255 /*
256  * Supplement to <sys/stat.h>.
257  *
258  * We must pull in sys/stat.h before this part, else our overrides lose.
259  *
260  * stat() is not guaranteed to set the st_size field on win32, so we
261  * redefine it to our own implementation. See src/port/win32stat.c.
262  *
263  * The struct stat is 32 bit in MSVC, so we redefine it as a copy of
264  * struct __stat64. This also fixes the struct size for MINGW builds.
265  */
266 struct stat /* This should match struct __stat64 */
267 {
268  _dev_t st_dev;
269  _ino_t st_ino;
270  unsigned short st_mode;
271  short st_nlink;
272  short st_uid;
273  short st_gid;
274  _dev_t st_rdev;
275  __int64 st_size;
276  __time64_t st_atime;
277  __time64_t st_mtime;
278  __time64_t st_ctime;
279 };
280 
281 extern int _pgfstat64(int fileno, struct stat *buf);
282 extern int _pgstat64(const char *name, struct stat *buf);
283 extern int _pglstat64(const char *name, struct stat *buf);
284 
285 #define fstat(fileno, sb) _pgfstat64(fileno, sb)
286 #define stat(path, sb) _pgstat64(path, sb)
287 #define lstat(path, sb) _pglstat64(path, sb)
288 
289 /* These macros are not provided by older MinGW, nor by MSVC */
290 #ifndef S_IRUSR
291 #define S_IRUSR _S_IREAD
292 #endif
293 #ifndef S_IWUSR
294 #define S_IWUSR _S_IWRITE
295 #endif
296 #ifndef S_IXUSR
297 #define S_IXUSR _S_IEXEC
298 #endif
299 #ifndef S_IRWXU
300 #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
301 #endif
302 #ifndef S_IRGRP
303 #define S_IRGRP 0
304 #endif
305 #ifndef S_IWGRP
306 #define S_IWGRP 0
307 #endif
308 #ifndef S_IXGRP
309 #define S_IXGRP 0
310 #endif
311 #ifndef S_IRWXG
312 #define S_IRWXG 0
313 #endif
314 #ifndef S_IROTH
315 #define S_IROTH 0
316 #endif
317 #ifndef S_IWOTH
318 #define S_IWOTH 0
319 #endif
320 #ifndef S_IXOTH
321 #define S_IXOTH 0
322 #endif
323 #ifndef S_IRWXO
324 #define S_IRWXO 0
325 #endif
326 #ifndef S_ISDIR
327 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
328 #endif
329 #ifndef S_ISREG
330 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
331 #endif
332 
333 /*
334  * In order for lstat() to be able to report junction points as symlinks, we
335  * need to hijack a bit in st_mode, since neither MSVC nor MinGW provides
336  * S_ISLNK and there aren't any spare bits. We'll steal the one for character
337  * devices, because we don't otherwise make use of those.
338  */
339 #ifdef S_ISLNK
340 #error "S_ISLNK is already defined"
341 #endif
342 #ifdef S_IFLNK
343 #error "S_IFLNK is already defined"
344 #endif
345 #define S_IFLNK S_IFCHR
346 #define S_ISLNK(m) (((m) & S_IFLNK) == S_IFLNK)
347 
348 /*
349  * Supplement to <fcntl.h>.
350  * This is the same value as _O_NOINHERIT in the MS header file. This is
351  * to ensure that we don't collide with a future definition. It means
352  * we cannot use _O_NOINHERIT ourselves.
353  */
354 #define O_DSYNC 0x0080
355 
356 /*
357  * Our open() replacement does not create inheritable handles, so it is safe to
358  * ignore O_CLOEXEC. (If we were using Windows' own open(), it might be
359  * necessary to convert this to _O_NOINHERIT.)
360  */
361 #define O_CLOEXEC 0
362 
363 /*
364  * Supplement to <errno.h>.
365  *
366  * We redefine network-related Berkeley error symbols as the corresponding WSA
367  * constants. This allows strerror.c to recognize them as being in the Winsock
368  * error code range and pass them off to win32_socket_strerror(), since
369  * Windows' version of plain strerror() won't cope. Note that this will break
370  * if these names are used for anything else besides Windows Sockets errors.
371  * See TranslateSocketError() when changing this list.
372  */
373 #undef EAGAIN
374 #define EAGAIN WSAEWOULDBLOCK
375 #undef EINTR
376 #define EINTR WSAEINTR
377 #undef EMSGSIZE
378 #define EMSGSIZE WSAEMSGSIZE
379 #undef EAFNOSUPPORT
380 #define EAFNOSUPPORT WSAEAFNOSUPPORT
381 #undef EWOULDBLOCK
382 #define EWOULDBLOCK WSAEWOULDBLOCK
383 #undef ECONNABORTED
384 #define ECONNABORTED WSAECONNABORTED
385 #undef ECONNRESET
386 #define ECONNRESET WSAECONNRESET
387 #undef EINPROGRESS
388 #define EINPROGRESS WSAEINPROGRESS
389 #undef EISCONN
390 #define EISCONN WSAEISCONN
391 #undef ENOBUFS
392 #define ENOBUFS WSAENOBUFS
393 #undef EPROTONOSUPPORT
394 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
395 #undef ECONNREFUSED
396 #define ECONNREFUSED WSAECONNREFUSED
397 #undef ENOTSOCK
398 #define ENOTSOCK WSAENOTSOCK
399 #undef EOPNOTSUPP
400 #define EOPNOTSUPP WSAEOPNOTSUPP
401 #undef EADDRINUSE
402 #define EADDRINUSE WSAEADDRINUSE
403 #undef EADDRNOTAVAIL
404 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
405 #undef EHOSTDOWN
406 #define EHOSTDOWN WSAEHOSTDOWN
407 #undef EHOSTUNREACH
408 #define EHOSTUNREACH WSAEHOSTUNREACH
409 #undef ENETDOWN
410 #define ENETDOWN WSAENETDOWN
411 #undef ENETRESET
412 #define ENETRESET WSAENETRESET
413 #undef ENETUNREACH
414 #define ENETUNREACH WSAENETUNREACH
415 #undef ENOTCONN
416 #define ENOTCONN WSAENOTCONN
417 #undef ETIMEDOUT
418 #define ETIMEDOUT WSAETIMEDOUT
419 
420 /*
421  * Locale stuff.
422  *
423  * Extended locale functions with gratuitous underscore prefixes.
424  * (These APIs are nevertheless fully documented by Microsoft.)
425  */
426 #define locale_t _locale_t
427 #define tolower_l _tolower_l
428 #define toupper_l _toupper_l
429 #define towlower_l _towlower_l
430 #define towupper_l _towupper_l
431 #define isdigit_l _isdigit_l
432 #define iswdigit_l _iswdigit_l
433 #define isalpha_l _isalpha_l
434 #define iswalpha_l _iswalpha_l
435 #define isalnum_l _isalnum_l
436 #define iswalnum_l _iswalnum_l
437 #define isupper_l _isupper_l
438 #define iswupper_l _iswupper_l
439 #define islower_l _islower_l
440 #define iswlower_l _iswlower_l
441 #define isgraph_l _isgraph_l
442 #define iswgraph_l _iswgraph_l
443 #define isprint_l _isprint_l
444 #define iswprint_l _iswprint_l
445 #define ispunct_l _ispunct_l
446 #define iswpunct_l _iswpunct_l
447 #define isspace_l _isspace_l
448 #define iswspace_l _iswspace_l
449 #define strcoll_l _strcoll_l
450 #define strxfrm_l _strxfrm_l
451 #define wcscoll_l _wcscoll_l
452 #define wcstombs_l _wcstombs_l
453 #define mbstowcs_l _mbstowcs_l
454 
455 /*
456  * Versions of libintl >= 0.18? try to replace setlocale() with a macro
457  * to their own versions. Remove the macro, if it exists, because it
458  * ends up calling the wrong version when the backend and libintl use
459  * different versions of msvcrt.
460  */
461 #if defined(setlocale)
462 #undef setlocale
463 #endif
464 
465 /*
466  * Define our own wrapper macro around setlocale() to work around bugs in
467  * Windows' native setlocale() function.
468  */
469 extern char *pgwin32_setlocale(int category, const char *locale);
470 
471 #define setlocale(a,b) pgwin32_setlocale(a,b)
472 
473 
474 /* In backend/port/win32/signal.c */
475 extern PGDLLIMPORT volatile int pg_signal_queue;
476 extern PGDLLIMPORT int pg_signal_mask;
477 extern PGDLLIMPORT HANDLE pgwin32_signal_event;
479 
480 #define UNBLOCKED_SIGNAL_QUEUE() (pg_signal_queue & ~pg_signal_mask)
481 #define PG_SIGNAL_COUNT 32
482 
483 extern void pgwin32_signal_initialize(void);
484 extern HANDLE pgwin32_create_signal_listener(pid_t pid);
485 extern void pgwin32_dispatch_queued_signals(void);
486 extern void pg_queue_signal(int signum);
487 
488 /* In src/port/kill.c */
489 #define kill(pid,sig) pgkill(pid,sig)
490 extern int pgkill(int pid, int sig);
491 
492 /* In backend/port/win32/socket.c */
493 #ifndef FRONTEND
494 #define socket(af, type, protocol) pgwin32_socket(af, type, protocol)
495 #define bind(s, addr, addrlen) pgwin32_bind(s, addr, addrlen)
496 #define listen(s, backlog) pgwin32_listen(s, backlog)
497 #define accept(s, addr, addrlen) pgwin32_accept(s, addr, addrlen)
498 #define connect(s, name, namelen) pgwin32_connect(s, name, namelen)
499 #define select(n, r, w, e, timeout) pgwin32_select(n, r, w, e, timeout)
500 #define recv(s, buf, len, flags) pgwin32_recv(s, buf, len, flags)
501 #define send(s, buf, len, flags) pgwin32_send(s, buf, len, flags)
502 
503 extern SOCKET pgwin32_socket(int af, int type, int protocol);
504 extern int pgwin32_bind(SOCKET s, struct sockaddr *addr, int addrlen);
505 extern int pgwin32_listen(SOCKET s, int backlog);
506 extern SOCKET pgwin32_accept(SOCKET s, struct sockaddr *addr, int *addrlen);
507 extern int pgwin32_connect(SOCKET s, const struct sockaddr *name, int namelen);
508 extern int pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout);
509 extern int pgwin32_recv(SOCKET s, char *buf, int len, int flags);
510 extern int pgwin32_send(SOCKET s, const void *buf, int len, int flags);
511 extern int pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout);
512 
513 extern PGDLLIMPORT int pgwin32_noblock;
514 
515 #endif /* FRONTEND */
516 
517 /* in backend/port/win32_shmem.c */
518 extern int pgwin32_ReserveSharedMemoryRegion(HANDLE);
519 
520 /* in backend/port/win32/crashdump.c */
521 extern void pgwin32_install_crashdump_handler(void);
522 
523 /* in port/win32dlopen.c */
524 extern void *dlopen(const char *file, int mode);
525 extern void *dlsym(void *handle, const char *symbol);
526 extern int dlclose(void *handle);
527 extern char *dlerror(void);
528 
529 #define RTLD_NOW 1
530 #define RTLD_GLOBAL 0
531 
532 /* in port/win32error.c */
533 extern void _dosmaperr(unsigned long);
534 
535 /* in port/win32env.c */
536 extern int pgwin32_putenv(const char *);
537 extern int pgwin32_setenv(const char *name, const char *value, int overwrite);
538 extern int pgwin32_unsetenv(const char *name);
539 
540 #define putenv(x) pgwin32_putenv(x)
541 #define setenv(x,y,z) pgwin32_setenv(x,y,z)
542 #define unsetenv(x) pgwin32_unsetenv(x)
543 
544 /* in port/win32security.c */
545 extern int pgwin32_is_service(void);
546 extern int pgwin32_is_admin(void);
547 
548 /* Windows security token manipulation (in src/common/exec.c) */
549 extern BOOL AddUserToTokenDacl(HANDLE hToken);
550 
551 /* Things that exist in MinGW headers, but need to be added to MSVC */
552 #ifdef _MSC_VER
553 
554 #ifndef _WIN64
555 typedef long ssize_t;
556 #else
557 typedef __int64 ssize_t;
558 #endif
559 
560 typedef unsigned short mode_t;
561 
562 #define F_OK 0
563 #define W_OK 2
564 #define R_OK 4
565 
566 #endif /* _MSC_VER */
567 
568 #if defined(__MINGW32__) || defined(__MINGW64__)
569 /*
570  * Mingw claims to have a strtof, and my reading of its source code suggests
571  * that it ought to work (and not need this hack), but the regression test
572  * results disagree with me; whether this is a version issue or not is not
573  * clear. However, using our wrapper (and the misrounded-input variant file,
574  * already required for supporting ancient systems) can't make things any
575  * worse, except for a tiny performance loss when reading zeros.
576  *
577  * See also cygwin.h for another instance of this.
578  */
579 #define HAVE_BUGGY_STRTOF 1
580 #endif
581 
582 /* in port/win32pread.c */
583 extern ssize_t pg_pread(int fd, void *buf, size_t nbyte, off_t offset);
584 
585 /* in port/win32pwrite.c */
586 extern ssize_t pg_pwrite(int fd, const void *buf, size_t nbyte, off_t offset);
587 
588 #endif /* PG_WIN32_PORT_H */
unsigned char symbol
Definition: api.h:2
#define PGDLLIMPORT
Definition: c.h:1303
const char * name
Definition: encode.c:571
static struct @146 value
static char * locale
Definition: initdb.c:139
static PgChecksumMode mode
Definition: pg_checksums.c:65
const void size_t len
static int sig
Definition: pg_ctl.c:79
static char * buf
Definition: pg_test_fsync.c:67
static int fd(const char *x, int i)
Definition: preproc-init.c:105
struct timeval it_value
Definition: win32_port.h:202
struct timeval it_interval
Definition: win32_port.h:201
__time64_t st_mtime
Definition: win32_port.h:277
__int64 st_size
Definition: win32_port.h:275
short st_gid
Definition: win32_port.h:273
unsigned short st_mode
Definition: win32_port.h:270
_dev_t st_dev
Definition: win32_port.h:268
short st_uid
Definition: win32_port.h:272
_ino_t st_ino
Definition: win32_port.h:269
_dev_t st_rdev
Definition: win32_port.h:274
__time64_t st_atime
Definition: win32_port.h:276
__time64_t st_ctime
Definition: win32_port.h:278
short st_nlink
Definition: win32_port.h:271
static void overwrite(PGconn *conn, Oid lobjId, int start, int len)
Definition: testlo.c:108
HANDLE pgwin32_create_signal_listener(pid_t pid)
Definition: signal.c:227
int pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout)
Definition: socket.c:516
void pg_queue_signal(int signum)
Definition: signal.c:259
int pgwin32_send(SOCKET s, const void *buf, int len, int flags)
Definition: socket.c:458
PGDLLIMPORT int pgwin32_noblock
Definition: socket.c:28
int pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
Definition: socket.c:181
SOCKET pgwin32_socket(int af, int type, int protocol)
Definition: socket.c:291
int _pgfstat64(int fileno, struct stat *buf)
char * dlerror(void)
Definition: win32dlopen.c:40
int pgwin32_connect(SOCKET s, const struct sockaddr *name, int namelen)
Definition: socket.c:358
int pgwin32_recv(SOCKET s, char *buf, int len, int flags)
Definition: socket.c:381
void pgwin32_dispatch_queued_signals(void)
Definition: signal.c:120
void pgwin32_install_crashdump_handler(void)
Definition: crashdump.c:178
BOOL AddUserToTokenDacl(HANDLE hToken)
int _pgstat64(const char *name, struct stat *buf)
int pgwin32_unsetenv(const char *name)
Definition: win32env.c:150
SOCKET pgwin32_accept(SOCKET s, struct sockaddr *addr, int *addrlen)
Definition: socket.c:336
PGDLLIMPORT volatile int pg_signal_queue
Definition: signal.c:24
ssize_t pg_pwrite(int fd, const void *buf, size_t nbyte, off_t offset)
Definition: win32pwrite.c:20
int gid_t
Definition: win32_port.h:247
void _dosmaperr(unsigned long)
Definition: win32error.c:177
int pgreadlink(const char *path, char *buf, size_t size)
void * dlsym(void *handle, const char *symbol)
Definition: win32dlopen.c:61
void * dlopen(const char *file, int mode)
Definition: win32dlopen.c:76
PGDLLIMPORT HANDLE pgwin32_initial_signal_pipe
Definition: signal.c:28
int pgwin32_bind(SOCKET s, struct sockaddr *addr, int addrlen)
Definition: socket.c:314
long key_t
Definition: win32_port.h:249
ssize_t pg_pread(int fd, void *buf, size_t nbyte, off_t offset)
Definition: win32pread.c:20
PGDLLIMPORT int pg_signal_mask
Definition: signal.c:25
int pgwin32_putenv(const char *)
Definition: win32env.c:27
int pgwin32_is_service(void)
int pgwin32_ReserveSharedMemoryRegion(HANDLE)
Definition: win32_shmem.c:568
int pgsymlink(const char *oldpath, const char *newpath)
int _pglstat64(const char *name, struct stat *buf)
PGDLLIMPORT HANDLE pgwin32_signal_event
Definition: signal.c:27
void pgwin32_signal_initialize(void)
Definition: signal.c:79
int pgwin32_is_admin(void)
Definition: win32security.c:49
char * pgwin32_setlocale(int category, const char *locale)
int pgwin32_setenv(const char *name, const char *value, int overwrite)
Definition: win32env.c:121
int pgkill(int pid, int sig)
int dlclose(void *handle)
Definition: win32dlopen.c:49
int uid_t
Definition: win32_port.h:246
int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
Definition: timer.c:86
int pgwin32_listen(SOCKET s, int backlog)
Definition: socket.c:325
int gettimeofday(struct timeval *tp, void *tzp)