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