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-2022, 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  * Supplement to <errno.h>.
358  *
359  * We redefine network-related Berkeley error symbols as the corresponding WSA
360  * constants. This allows strerror.c to recognize them as being in the Winsock
361  * error code range and pass them off to win32_socket_strerror(), since
362  * Windows' version of plain strerror() won't cope. Note that this will break
363  * if these names are used for anything else besides Windows Sockets errors.
364  * See TranslateSocketError() when changing this list.
365  */
366 #undef EAGAIN
367 #define EAGAIN WSAEWOULDBLOCK
368 #undef EINTR
369 #define EINTR WSAEINTR
370 #undef EMSGSIZE
371 #define EMSGSIZE WSAEMSGSIZE
372 #undef EAFNOSUPPORT
373 #define EAFNOSUPPORT WSAEAFNOSUPPORT
374 #undef EWOULDBLOCK
375 #define EWOULDBLOCK WSAEWOULDBLOCK
376 #undef ECONNABORTED
377 #define ECONNABORTED WSAECONNABORTED
378 #undef ECONNRESET
379 #define ECONNRESET WSAECONNRESET
380 #undef EINPROGRESS
381 #define EINPROGRESS WSAEINPROGRESS
382 #undef EISCONN
383 #define EISCONN WSAEISCONN
384 #undef ENOBUFS
385 #define ENOBUFS WSAENOBUFS
386 #undef EPROTONOSUPPORT
387 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
388 #undef ECONNREFUSED
389 #define ECONNREFUSED WSAECONNREFUSED
390 #undef ENOTSOCK
391 #define ENOTSOCK WSAENOTSOCK
392 #undef EOPNOTSUPP
393 #define EOPNOTSUPP WSAEOPNOTSUPP
394 #undef EADDRINUSE
395 #define EADDRINUSE WSAEADDRINUSE
396 #undef EADDRNOTAVAIL
397 #define EADDRNOTAVAIL WSAEADDRNOTAVAIL
398 #undef EHOSTDOWN
399 #define EHOSTDOWN WSAEHOSTDOWN
400 #undef EHOSTUNREACH
401 #define EHOSTUNREACH WSAEHOSTUNREACH
402 #undef ENETDOWN
403 #define ENETDOWN WSAENETDOWN
404 #undef ENETRESET
405 #define ENETRESET WSAENETRESET
406 #undef ENETUNREACH
407 #define ENETUNREACH WSAENETUNREACH
408 #undef ENOTCONN
409 #define ENOTCONN WSAENOTCONN
410 #undef ETIMEDOUT
411 #define ETIMEDOUT WSAETIMEDOUT
412 
413 /*
414  * Locale stuff.
415  *
416  * Extended locale functions with gratuitous underscore prefixes.
417  * (These APIs are nevertheless fully documented by Microsoft.)
418  */
419 #define locale_t _locale_t
420 #define tolower_l _tolower_l
421 #define toupper_l _toupper_l
422 #define towlower_l _towlower_l
423 #define towupper_l _towupper_l
424 #define isdigit_l _isdigit_l
425 #define iswdigit_l _iswdigit_l
426 #define isalpha_l _isalpha_l
427 #define iswalpha_l _iswalpha_l
428 #define isalnum_l _isalnum_l
429 #define iswalnum_l _iswalnum_l
430 #define isupper_l _isupper_l
431 #define iswupper_l _iswupper_l
432 #define islower_l _islower_l
433 #define iswlower_l _iswlower_l
434 #define isgraph_l _isgraph_l
435 #define iswgraph_l _iswgraph_l
436 #define isprint_l _isprint_l
437 #define iswprint_l _iswprint_l
438 #define ispunct_l _ispunct_l
439 #define iswpunct_l _iswpunct_l
440 #define isspace_l _isspace_l
441 #define iswspace_l _iswspace_l
442 #define strcoll_l _strcoll_l
443 #define strxfrm_l _strxfrm_l
444 #define wcscoll_l _wcscoll_l
445 #define wcstombs_l _wcstombs_l
446 #define mbstowcs_l _mbstowcs_l
447 
448 /*
449  * Versions of libintl >= 0.18? try to replace setlocale() with a macro
450  * to their own versions. Remove the macro, if it exists, because it
451  * ends up calling the wrong version when the backend and libintl use
452  * different versions of msvcrt.
453  */
454 #if defined(setlocale)
455 #undef setlocale
456 #endif
457 
458 /*
459  * Define our own wrapper macro around setlocale() to work around bugs in
460  * Windows' native setlocale() function.
461  */
462 extern char *pgwin32_setlocale(int category, const char *locale);
463 
464 #define setlocale(a,b) pgwin32_setlocale(a,b)
465 
466 
467 /* In backend/port/win32/signal.c */
468 extern PGDLLIMPORT volatile int pg_signal_queue;
469 extern PGDLLIMPORT int pg_signal_mask;
470 extern PGDLLIMPORT HANDLE pgwin32_signal_event;
472 
473 #define UNBLOCKED_SIGNAL_QUEUE() (pg_signal_queue & ~pg_signal_mask)
474 #define PG_SIGNAL_COUNT 32
475 
476 extern void pgwin32_signal_initialize(void);
477 extern HANDLE pgwin32_create_signal_listener(pid_t pid);
478 extern void pgwin32_dispatch_queued_signals(void);
479 extern void pg_queue_signal(int signum);
480 
481 /* In src/port/kill.c */
482 #define kill(pid,sig) pgkill(pid,sig)
483 extern int pgkill(int pid, int sig);
484 
485 /* In backend/port/win32/socket.c */
486 #ifndef FRONTEND
487 #define socket(af, type, protocol) pgwin32_socket(af, type, protocol)
488 #define bind(s, addr, addrlen) pgwin32_bind(s, addr, addrlen)
489 #define listen(s, backlog) pgwin32_listen(s, backlog)
490 #define accept(s, addr, addrlen) pgwin32_accept(s, addr, addrlen)
491 #define connect(s, name, namelen) pgwin32_connect(s, name, namelen)
492 #define select(n, r, w, e, timeout) pgwin32_select(n, r, w, e, timeout)
493 #define recv(s, buf, len, flags) pgwin32_recv(s, buf, len, flags)
494 #define send(s, buf, len, flags) pgwin32_send(s, buf, len, flags)
495 
496 extern SOCKET pgwin32_socket(int af, int type, int protocol);
497 extern int pgwin32_bind(SOCKET s, struct sockaddr *addr, int addrlen);
498 extern int pgwin32_listen(SOCKET s, int backlog);
499 extern SOCKET pgwin32_accept(SOCKET s, struct sockaddr *addr, int *addrlen);
500 extern int pgwin32_connect(SOCKET s, const struct sockaddr *name, int namelen);
501 extern int pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout);
502 extern int pgwin32_recv(SOCKET s, char *buf, int len, int flags);
503 extern int pgwin32_send(SOCKET s, const void *buf, int len, int flags);
504 extern int pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout);
505 
506 extern PGDLLIMPORT int pgwin32_noblock;
507 
508 #endif /* FRONTEND */
509 
510 /* in backend/port/win32_shmem.c */
511 extern int pgwin32_ReserveSharedMemoryRegion(HANDLE);
512 
513 /* in backend/port/win32/crashdump.c */
514 extern void pgwin32_install_crashdump_handler(void);
515 
516 /* in port/win32dlopen.c */
517 extern void *dlopen(const char *file, int mode);
518 extern void *dlsym(void *handle, const char *symbol);
519 extern int dlclose(void *handle);
520 extern char *dlerror(void);
521 
522 #define RTLD_NOW 1
523 #define RTLD_GLOBAL 0
524 
525 /* in port/win32error.c */
526 extern void _dosmaperr(unsigned long);
527 
528 /* in port/win32env.c */
529 extern int pgwin32_putenv(const char *);
530 extern int pgwin32_setenv(const char *name, const char *value, int overwrite);
531 extern int pgwin32_unsetenv(const char *name);
532 
533 #define putenv(x) pgwin32_putenv(x)
534 #define setenv(x,y,z) pgwin32_setenv(x,y,z)
535 #define unsetenv(x) pgwin32_unsetenv(x)
536 
537 /* in port/win32security.c */
538 extern int pgwin32_is_service(void);
539 extern int pgwin32_is_admin(void);
540 
541 /* Windows security token manipulation (in src/common/exec.c) */
542 extern BOOL AddUserToTokenDacl(HANDLE hToken);
543 
544 /* Things that exist in MinGW headers, but need to be added to MSVC */
545 #ifdef _MSC_VER
546 
547 #ifndef _WIN64
548 typedef long ssize_t;
549 #else
550 typedef __int64 ssize_t;
551 #endif
552 
553 typedef unsigned short mode_t;
554 
555 #define F_OK 0
556 #define W_OK 2
557 #define R_OK 4
558 
559 #endif /* _MSC_VER */
560 
561 #if defined(__MINGW32__) || defined(__MINGW64__)
562 /*
563  * Mingw claims to have a strtof, and my reading of its source code suggests
564  * that it ought to work (and not need this hack), but the regression test
565  * results disagree with me; whether this is a version issue or not is not
566  * clear. However, using our wrapper (and the misrounded-input variant file,
567  * already required for supporting ancient systems) can't make things any
568  * worse, except for a tiny performance loss when reading zeros.
569  *
570  * See also cygwin.h for another instance of this.
571  */
572 #define HAVE_BUGGY_STRTOF 1
573 #endif
574 
575 /* in port/win32pread.c */
576 extern ssize_t pg_pread(int fd, void *buf, size_t nbyte, off_t offset);
577 
578 /* in port/win32pwrite.c */
579 extern ssize_t pg_pwrite(int fd, const void *buf, size_t nbyte, off_t offset);
580 
581 #endif /* PG_WIN32_PORT_H */
unsigned char symbol
Definition: api.h:2
#define PGDLLIMPORT
Definition: c.h:1252
const char * name
Definition: encode.c:561
static struct @143 value
static char * locale
Definition: initdb.c:129
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)