PostgreSQL Source Code: src/include/port/win32_port.h File Reference (original) (raw)

#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
#include <ntstatus.h>
#include <winternl.h>
#include <process.h>
#include <signal.h>
#include <direct.h>
#include <sys/stat.h>

Go to the source code of this file.

Macros
#define ENABLE_SSPI 1
#define _WINSOCKAPI_
#define WIN32_LEAN_AND_MEAN
#define UMDF_USING_NTSTATUS
#define fstat microsoft_native_fstat
#define stat microsoft_native_stat
#define mkdir(a, b) mkdir(a)
#define fsync(fd) _commit(fd)
#define USES_WINSOCK
#define HAVE_UNION_SEMUN 1
#define IPC_RMID 256
#define IPC_CREAT 512
#define IPC_EXCL 1024
#define IPC_PRIVATE 234564
#define IPC_NOWAIT 2048
#define IPC_STAT 4096
#define EACCESS 2048
#define EIDRM 4096
#define SETALL 8192
#define GETNCNT 16384
#define GETVAL 65536
#define SETVAL 131072
#define GETPID 262144
#define WIFEXITED(w) (((w) & 0XFFFFFF00) == 0)
#define WIFSIGNALED(w) (WIFEXITED(w))
#define WEXITSTATUS(w) (w)
#define WTERMSIG(w) (w)
#define sigmask(sig) ( 1 << ((sig)-1) )
#define SIGHUP 1
#define SIGQUIT 3
#define SIGTRAP 5
#define SIGABRT 22 /* Set to match W32 value -- not UNIX value */
#define SIGKILL 9
#define SIGPIPE 13
#define SIGALRM 14
#define SIGSTOP 17
#define SIGTSTP 18
#define SIGCONT 19
#define SIGCHLD 20
#define SIGWINCH 28
#define SIGUSR1 30
#define SIGUSR2 31
#define ITIMER_REAL 0
#define fseeko(stream, offset, origin) fseeko64(stream, offset, origin)
#define ftello(stream) ftello64(stream)
#define symlink(oldpath, newpath) pgsymlink(oldpath, newpath)
#define readlink(path, buf, size) pgreadlink(path, buf, size)
#define fstat(fileno, sb) _pgfstat64(fileno, sb)
#define stat(path, sb) _pgstat64(path, sb)
#define lstat(path, sb) _pglstat64(path, sb)
#define S_IRUSR _S_IREAD
#define S_IWUSR _S_IWRITE
#define S_IXUSR _S_IEXEC
#define S_IRWXU (S_IRUSR | S_IWUSR S_IXUSR)
#define S_IRGRP 0
#define S_IWGRP 0
#define S_IXGRP 0
#define S_IRWXG 0
#define S_IROTH 0
#define S_IWOTH 0
#define S_IXOTH 0
#define S_IRWXO 0
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define S_IFLNK S_IFCHR
#define S_ISLNK(m) (((m) & S_IFLNK) == S_IFLNK)
#define O_CLOEXEC _O_NOINHERIT
#define O_DIRECT 0x80000000
#define O_DSYNC 0x04000000
#define EAGAIN WSAEWOULDBLOCK
#define EINTR WSAEINTR
#define EMSGSIZE WSAEMSGSIZE
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#define EWOULDBLOCK WSAEWOULDBLOCK
#define ECONNABORTED WSAECONNABORTED
#define ECONNRESET WSAECONNRESET
#define EINPROGRESS WSAEINPROGRESS
#define EISCONN WSAEISCONN
#define ENOBUFS WSAENOBUFS
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
#define ECONNREFUSED WSAECONNREFUSED
#define ENOTSOCK WSAENOTSOCK
#define EOPNOTSUPP WSAEOPNOTSUPP
#define EADDRINUSE WSAEADDRINUSE
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
#define EHOSTDOWN WSAEHOSTDOWN
#define EHOSTUNREACH WSAEHOSTUNREACH
#define ENETDOWN WSAENETDOWN
#define ENETRESET WSAENETRESET
#define ENETUNREACH WSAENETUNREACH
#define ENOTCONN WSAENOTCONN
#define ETIMEDOUT WSAETIMEDOUT
#define strtok_r strtok_s
#define locale_t _locale_t
#define tolower_l _tolower_l
#define toupper_l _toupper_l
#define towlower_l _towlower_l
#define towupper_l _towupper_l
#define isdigit_l _isdigit_l
#define iswdigit_l _iswdigit_l
#define isalpha_l _isalpha_l
#define iswalpha_l _iswalpha_l
#define isalnum_l _isalnum_l
#define iswalnum_l _iswalnum_l
#define isupper_l _isupper_l
#define iswupper_l _iswupper_l
#define islower_l _islower_l
#define iswlower_l _iswlower_l
#define isgraph_l _isgraph_l
#define iswgraph_l _iswgraph_l
#define isprint_l _isprint_l
#define iswprint_l _iswprint_l
#define ispunct_l _ispunct_l
#define iswpunct_l _iswpunct_l
#define isspace_l _isspace_l
#define iswspace_l _iswspace_l
#define strcoll_l _strcoll_l
#define strxfrm_l _strxfrm_l
#define wcscoll_l _wcscoll_l
#define setlocale(a, b) pgwin32_setlocale(a,b)
#define UNBLOCKED_SIGNAL_QUEUE() (pg_signal_queue & ~pg_signal_mask)
#define PG_SIGNAL_COUNT 32
#define kill(pid, sig) pgkill(pid,sig)
#define socket(af, type, protocol) pgwin32_socket(af, type, protocol)
#define bind(s, addr, addrlen) pgwin32_bind(s, addr, addrlen)
#define listen(s, backlog) pgwin32_listen(s, backlog)
#define accept(s, addr, addrlen) pgwin32_accept(s, addr, addrlen)
#define connect(s, name, namelen) pgwin32_connect(s, name, namelen)
#define select(n, r, w, e, timeout) pgwin32_select(n, r, w, e, timeout)
#define recv(s, buf, len, flags) pgwin32_recv(s, buf, len, flags)
#define send(s, buf, len, flags) pgwin32_send(s, buf, len, flags)
#define RTLD_NOW 1
#define RTLD_GLOBAL 0
#define putenv(x) pgwin32_putenv(x)
#define setenv(x, y, z) pgwin32_setenv(x,y,z)
#define unsetenv(x) pgwin32_unsetenv(x)
Typedefs
typedef __int64 pgoff_t
typedef int uid_t
typedef int gid_t
typedef long key_t
Functions
int setitimer (int which, const struct itimerval *value, struct itimerval *ovalue)
DWORD pgwin32_get_file_type (HANDLE hFile)
int pgsymlink (const char *oldpath, const char *newpath)
int pgreadlink (const char *path, char *buf, size_t size)
int _pgfstat64 (int fileno, struct stat *buf)
int _pgstat64 (const char *name, struct stat *buf)
int _pglstat64 (const char *name, struct stat *buf)
char * pgwin32_setlocale (int category, const char *locale)
void pgwin32_signal_initialize (void)
HANDLE pgwin32_create_signal_listener (pid_t pid)
void pgwin32_dispatch_queued_signals (void)
void pg_queue_signal (int signum)
int pgkill (int pid, int sig)
SOCKET pgwin32_socket (int af, int type, int protocol)
int pgwin32_bind (SOCKET s, struct sockaddr *addr, int addrlen)
int pgwin32_listen (SOCKET s, int backlog)
SOCKET pgwin32_accept (SOCKET s, struct sockaddr *addr, int *addrlen)
int pgwin32_connect (SOCKET s, const struct sockaddr *addr, int addrlen)
int pgwin32_select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout)
int pgwin32_recv (SOCKET s, char *buf, int len, int flags)
int pgwin32_send (SOCKET s, const void *buf, int len, int flags)
int pgwin32_waitforsinglesocket (SOCKET s, int what, int timeout)
int pgwin32_ReserveSharedMemoryRegion (HANDLE)
void pgwin32_install_crashdump_handler (void)
void * dlopen (const char *file, int mode)
void * dlsym (void *handle, const char *symbol)
int dlclose (void *handle)
char * dlerror (void)
void _dosmaperr (unsigned long)
int pgwin32_putenv (const char *)
int pgwin32_setenv (const char *name, const char *value, int overwrite)
int pgwin32_unsetenv (const char *name)
int pgwin32_is_service (void)
int pgwin32_is_admin (void)
BOOL AddUserToTokenDacl (HANDLE hToken)
ssize_t pg_pread (int fd, void *buf, size_t size, pgoff_t offset)
ssize_t pg_pwrite (int fd, const void *buf, size_t size, pgoff_t offset)
Variables
PGDLLIMPORT volatile int pg_signal_queue
PGDLLIMPORT int pg_signal_mask
PGDLLIMPORT HANDLE pgwin32_signal_event
PGDLLIMPORT HANDLE pgwin32_initial_signal_pipe
PGDLLIMPORT int pgwin32_noblock

_WINSOCKAPI_

accept

bind

connect

EACCESS

EADDRINUSE

EADDRNOTAVAIL

EAFNOSUPPORT

EAGAIN

ECONNABORTED

ECONNREFUSED

ECONNRESET

EHOSTDOWN

EHOSTUNREACH

EIDRM

EINPROGRESS

EINTR

EISCONN

EMSGSIZE

ENABLE_SSPI

ENETDOWN

ENETRESET

ENETUNREACH

ENOBUFS

ENOTCONN

ENOTSOCK

EOPNOTSUPP

EPROTONOSUPPORT

ETIMEDOUT

EWOULDBLOCK

fseeko

| #define fseeko | ( | | stream, | | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | ------- | | | offset, | | | | | | origin | | | | | ) | fseeko64(stream, offset, origin) | | |

fstat [1/2]

fstat [2/2]

fsync

ftello

GETNCNT

GETPID

GETVAL

HAVE_UNION_SEMUN

IPC_CREAT

IPC_EXCL

IPC_NOWAIT

IPC_PRIVATE

IPC_RMID

IPC_STAT

isalnum_l

isalpha_l

isdigit_l

isgraph_l

islower_l

isprint_l

ispunct_l

isspace_l

isupper_l

iswalnum_l

iswalpha_l

iswdigit_l

iswgraph_l

iswlower_l

iswprint_l

iswpunct_l

iswspace_l

iswupper_l

ITIMER_REAL

kill

listen

locale_t

lstat

mkdir

O_CLOEXEC

O_DIRECT

O_DSYNC

PG_SIGNAL_COUNT

putenv

recv

RTLD_GLOBAL

RTLD_NOW

S_IFLNK

S_IRGRP

S_IROTH

S_IRUSR

S_IRWXG

S_IRWXO

S_IRWXU

S_ISDIR

S_ISLNK

S_ISREG

S_IWGRP

S_IWOTH

S_IWUSR

S_IXGRP

S_IXOTH

S_IXUSR

select

send

SETALL

setenv

setlocale

SETVAL

SIGABRT

SIGALRM

SIGCHLD

SIGCONT

SIGHUP

SIGKILL

sigmask

SIGPIPE

SIGQUIT

SIGSTOP

SIGTRAP

SIGTSTP

SIGUSR1

SIGUSR2

SIGWINCH

socket

stat [1/2]

stat [2/2]

strcoll_l

strtok_r

strxfrm_l

tolower_l

toupper_l

towlower_l

towupper_l

UMDF_USING_NTSTATUS

UNBLOCKED_SIGNAL_QUEUE

unsetenv

USES_WINSOCK

wcscoll_l

WEXITSTATUS

WIFEXITED

| #define WIFEXITED | ( | | w | ) | (((w) & 0XFFFFFF00) == 0) | | ----------------------------------------------------------------------------- | - | | - | - | ------------------------- |

WIFSIGNALED

WIN32_LEAN_AND_MEAN

WTERMSIG

gid_t

key_t

pgoff_t

uid_t

_dosmaperr()

Definition at line 177 of file win32error.c.

178{

179 int i;

180

181 if (e == 0)

182 {

184 return;

185 }

186

188 {

190 {

192

193#ifndef FRONTEND

197#elif defined(FRONTEND_DEBUG)

199#endif

201 return;

202 }

203 }

204

205#ifndef FRONTEND

208 e)));

209#else

210 fprintf(stderr, "unrecognized win32 error code: %lu", e);

211#endif

212

214}

#define fprintf(file, fmt, msg)

int int errmsg_internal(const char *fmt,...) pg_attribute_printf(1

#define ereport(elevel,...)

static const struct @205 doserrors[]

References DEBUG5, doserr, doserrors, ereport, errmsg_internal(), fb(), fprintf, i, lengthof, LOG, and winerr.

Referenced by BaseBackup(), cache_locale_time(), copyFile(), dsm_impl_pin_segment(), dsm_impl_unpin_segment(), fdatasync(), fileinfo_to_stat(), FileReadV(), FileWriteV(), getrusage(), initialize_ntdll(), link(), pg_import_system_collations(), pg_pread(), pg_pwrite(), pgwin32_get_file_type(), and readdir().

_pgfstat64()

int _pgfstat64 ( int fileno, struct stat * buf ) extern

Definition at line 255 of file win32stat.c.

256{

259 unsigned short st_mode;

260

262 {

264 return -1;

265 }

266

269 return -1;

270

272 {

273

276

277

278

279

280

283 break;

284

287 break;

288

291 default:

293 return -1;

294 }

295

297 buf->st_mode = st_mode;

298 buf->st_dev = fileno;

299 buf->st_rdev = fileno;

300 buf->st_nlink = 1;

301 return 0;

302}

static char buf[DEFAULT_XLOG_SEG_SIZE]

DWORD pgwin32_get_file_type(HANDLE hFile)

static int fileinfo_to_stat(HANDLE hFile, struct stat *buf)

References buf, fb(), fileinfo_to_stat(), and pgwin32_get_file_type().

_pglstat64()

Definition at line 113 of file win32stat.c.

114{

115

116

117

118

119

120

122 int ret;

123

126 {

128 {

129

130

131

132

133

134

135

137 ret = 0;

138 }

139 else

140 return -1;

141 }

142 else

144

145

146

147

148

150 {

153

154

155

156

157

158

160 if (size < 0)

161 {

164 {

165

167 ret = -1;

168 }

170 {

171

172 }

173 else

174 {

175

176 ret = -1;

177 }

178 }

179 else

180 {

181

184 buf->st_size = size;

185 ret = 0;

186 }

187 }

188

191 return ret;

192}

#define readlink(path, buf, size)

PGDLLIMPORT RtlGetLastNtStatus_t pg_RtlGetLastNtStatus

References buf, fb(), fileinfo_to_stat(), MAXPGPATH, name, next, pg_RtlGetLastNtStatus, readlink, S_IFLNK, and S_ISDIR.

Referenced by _pgstat64().

_pgstat64()

Definition at line 198 of file win32stat.c.

199{

201 int ret;

203

205

207

208

209 while (ret == 0 && S_ISLNK(buf->st_mode))

210 {

213

215 {

217 return -1;

218 }

219

220

221

222

223

224

225

227 if (size < 0)

228 {

231 {

232

234 }

235 return -1;

236 }

237 if (size >= sizeof(next))

238 {

240 return -1;

241 }

242 next[size] = 0;

243

246 }

247

248 return ret;

249}

size_t strlcpy(char *dst, const char *src, size_t siz)

int _pglstat64(const char *name, struct stat *buf)

References _pglstat64(), buf, fb(), MAXPGPATH, name, next, pg_RtlGetLastNtStatus, readlink, S_ISLNK, and strlcpy().

AddUserToTokenDacl()

dlclose()

int dlclose ( void * handle) extern

dlerror()

dlopen()

dlsym()

pg_pread()

Definition at line 20 of file win32pread.c.

21{

25

28 {

30 return -1;

31 }

32

33

34 size = Min(size, 1024 * 1024 * 1024);

35

36

39

41 {

43 return 0;

44

46 return -1;

47 }

48

49 return result;

50}

static int fd(const char *x, int i)

void _dosmaperr(unsigned long)

References _dosmaperr(), buf, fb(), fd(), and Min.

pg_pwrite()

Definition at line 20 of file win32pwrite.c.

21{

25

28 {

30 return -1;

31 }

32

33

34 size = Min(size, 1024 * 1024 * 1024);

35

36

39

41 {

43 return -1;

44 }

45

46 return result;

47}

References _dosmaperr(), buf, fb(), fd(), and Min.

pg_queue_signal()

void pg_queue_signal ( int signum) extern

pgkill()

pgwin32_accept()

pgwin32_bind()

Definition at line 315 of file socket.c.

316{

317 int res;

318

319 res = bind(s, addr, addrlen);

320 if (res < 0)

322 return res;

323}

#define bind(s, addr, addrlen)

References bind, and TranslateSocketError().

pgwin32_connect()

pgwin32_create_signal_listener()

HANDLE pgwin32_create_signal_listener ( pid_t pid) extern

pgwin32_dispatch_queued_signals()

void pgwin32_dispatch_queued_signals ( void ) extern

Definition at line 120 of file signal.c.

121{

123

127 {

128

129 int i;

130

132 {

134 {

135

138

143 {

146

148

152

156

158 break;

159

160

161 }

162 }

163 }

164 }

167}

void(* pqsigfunc)(SIGNAL_ARGS)

static struct sigaction pg_signal_array[PG_SIGNAL_COUNT]

static pqsigfunc pg_signal_defaults[PG_SIGNAL_COUNT]

#define UNBLOCKED_SIGNAL_QUEUE()

References Assert, fb(), i, pg_signal_array, PG_SIGNAL_COUNT, pg_signal_crit_sec, pg_signal_defaults, pg_signal_queue, pgwin32_signal_event, sig, sigmask, and UNBLOCKED_SIGNAL_QUEUE.

Referenced by pg_usleep(), PGSemaphoreLock(), pgwin32_poll_signals(), pgwin32_select(), pgwin32_waitforsinglesocket(), pqsigprocmask(), and WaitEventSetWait().

pgwin32_get_file_type()

pgwin32_install_crashdump_handler()

void pgwin32_install_crashdump_handler ( void ) extern

pgwin32_is_admin()

int pgwin32_is_admin ( void ) extern

Definition at line 49 of file win32security.c.

50{

56

61 {

62 log_error(_("could not get SID for Administrators group: error code %lu\n"),

65 }

66

71 {

72 log_error(_("could not get SID for PowerUsers group: error code %lu\n"),

75 }

76

79 {

80 log_error(_("could not check access token membership: error code %lu\n"),

83 }

84

87

89 return 1;

90 else

91 return 0;

92}

#define log_error(errcodefn,...)

References _, fb(), and log_error.

Referenced by check_root().

pgwin32_is_service()

int pgwin32_is_service ( void ) extern

Definition at line 120 of file win32security.c.

121{

128

129

132

133

136 {

139 }

140

141

145 {

146 fprintf(stderr, "could not get SID for local system account\n");

147 return -1;

148 }

149

151 {

152 fprintf(stderr, "could not check access token membership: error code %lu\n",

155 return -1;

156 }

158

160 {

163 }

164

165

169 {

170 fprintf(stderr, "could not get SID for service group: error code %lu\n",

172 return -1;

173 }

174

176 {

177 fprintf(stderr, "could not check access token membership: error code %lu\n",

180 return -1;

181 }

183

186 else

188

190}

References fb(), and fprintf.

Referenced by send_message_to_server_log(), vwrite_stderr(), and write_stderr().

pgwin32_listen()

pgwin32_putenv()

Definition at line 27 of file win32env.c.

28{

30 char *cp;

32 static const char *const modulenames[] = {

33 "msvcrt",

34 "msvcrtd",

35 "msvcr70",

36 "msvcr70d",

37 "msvcr71",

38 "msvcr71d",

39 "msvcr80",

40 "msvcr80d",

41 "msvcr90",

42 "msvcr90d",

43 "msvcr100",

44 "msvcr100d",

45 "msvcr110",

46 "msvcr110d",

47 "msvcr120",

48 "msvcr120d",

49 "ucrtbase",

50 "ucrtbased",

52 };

53 int i;

54

55

56

57

58

59

60

61

62

65 return -1;

68 {

70 return -1;

71 }

72 *cp = '\0';

74 if (*cp)

75 {

76

77

78

79

80

82 {

84 return -1;

85 }

86 }

88

89

90

91

92

93

94

95

97 {

100

102 {

104

109 }

110 }

111

112

113

114

115

116

118}

void(* pg_funcptr_t)(void)

References fb(), free, and i.

Referenced by pgwin32_setenv(), and pgwin32_unsetenv().

pgwin32_recv()

Definition at line 382 of file socket.c.

383{

385 int r;

388 int n;

389

391 return -1;

392

395

398 return b;

399

401 {

403 return -1;

404 }

405

407 {

408

409

410

411

413 return -1;

414 }

415

416

417

418 for (n = 0; n < 5; n++)

419 {

422 return -1;

423

426 return b;

428 {

430 return -1;

431 }

432

433

434

435

436

437

438

439

441 }

443 (errmsg_internal("could not read from ready socket (after retries)")));

445 return -1;

446}

void pg_usleep(long microsec)

References b, buf, ereport, errmsg_internal(), EWOULDBLOCK, fb(), len, NOTICE, pg_usleep(), pgwin32_noblock, pgwin32_poll_signals(), pgwin32_waitforsinglesocket(), and TranslateSocketError().

pgwin32_ReserveSharedMemoryRegion()

int pgwin32_ReserveSharedMemoryRegion ( HANDLE hChild) extern

Definition at line 573 of file win32_shmem.c.

574{

575 void *address;

576

580

581

585 if (address == NULL)

586 {

587

588 elog(LOG, "could not reserve shared memory region (addr=%p) for child %p: error code %lu",

590 return false;

591 }

593 {

594

595

596

597

598

599

600 elog(LOG, "reserved shared memory region got incorrect address %p, expected %p",

602 return false;

603 }

604

605

608 if (address == NULL)

609 {

610 elog(LOG, "could not reserve shared memory region (addr=%p) for child %p: error code %lu",

612 return false;

613 }

615 {

616 elog(LOG, "reserved shared memory region got incorrect address %p, expected %p",

618 return false;

619 }

620

621 return true;

622}

#define PROTECTIVE_REGION_SIZE

void * ShmemProtectiveRegion

static Size UsedShmemSegSize

References Assert, elog, fb(), LOG, PROTECTIVE_REGION_SIZE, ShmemProtectiveRegion, UsedShmemSegAddr, and UsedShmemSegSize.

pgwin32_select()

Definition at line 517 of file socket.c.

518{

520

521

524 int i;

525 int r;

530

532

534 return -1;

535

538

539

540

541

542

543

544

545

546

547

548

550 {

552 {

553 char c;

556

557 buf.buf = &c;

558 buf.len = 0;

559

563 }

564

565

567 {

572 }

573 }

574

575

576

577

579 {

580

582 }

583

585 {

586 for (i = 0; i < readfds->fd_count; i++)

587 {

591 }

592 }

594 {

596 {

599 {

600

604 }

605 }

606 }

607

609 {

610 int flags = 0;

611

614

617

619 {

621

622 while (--i >= 0)

626 return -1;

627 }

628 }

629

633 {

634

635

636

637

639

641 {

644 elog(ERROR, "failed to enumerate network events: error code %d",

646

648 {

652 {

654

656 }

657 }

658

660 {

663 {

665

667 }

668 }

669 }

670 }

671

672

674 {

677 }

678

680 {

685 return 0;

686 }

687

688

690 {

697 return -1;

698 }

699

700

706}

void pgwin32_dispatch_queued_signals(void)

References Assert, buf, EINTR, elog, ERROR, fb(), i, pgwin32_dispatch_queued_signals(), pgwin32_poll_signals(), pgwin32_signal_event, and TranslateSocketError().

pgwin32_send()

pgwin32_setenv()

Definition at line 121 of file win32env.c.

122{

123 int res;

125

126

129 {

131 return -1;

132 }

133

134

136 return 0;

137

139 if (envstr)

140 return -1;

141

143

146 return res;

147}

static void overwrite(PGconn *conn, Oid lobjId, int start, int len)

int pgwin32_putenv(const char *envval)

References fb(), free, malloc, name, overwrite(), pgwin32_putenv(), sprintf, and value.

pgwin32_setlocale()

Definition at line 172 of file win32setlocale.c.

173{

175 char *result;

176

177 if (locale == NULL)

179 else

181

182

184

185

186

187

188

189 if (result)

191

192 return result;

193}

#define unconstify(underlying_type, expr)

static const struct locale_map locale_map_argument[]

static const struct locale_map locale_map_result[]

static const char * map_locale(const struct locale_map *map, const char *locale)

References fb(), locale_map_argument, locale_map_result, map_locale(), setlocale, and unconstify.

pgwin32_signal_initialize()

void pgwin32_signal_initialize ( void ) extern

Definition at line 79 of file signal.c.

80{

81 int i;

83

85

87 {

92 }

95

96

101

102

106 (errmsg_internal("could not create signal handler thread")));

107

108

111 (errmsg_internal("could not set console control handler")));

112}

static DWORD WINAPI pg_signal_thread(LPVOID param)

static BOOL WINAPI pg_console_handler(DWORD dwCtrlType)

References ereport, errmsg_internal(), FATAL, fb(), i, pg_console_handler(), pg_signal_array, PG_SIGNAL_COUNT, pg_signal_crit_sec, pg_signal_defaults, pg_signal_mask, pg_signal_queue, pg_signal_thread(), and pgwin32_signal_event.

Referenced by InitPostmasterChild(), InitStandaloneProcess(), and PostmasterMain().

pgwin32_socket()

pgwin32_unsetenv()

pgwin32_waitforsinglesocket()

Definition at line 181 of file socket.c.

182{

185 static int isUDP = 0;

187 int r;

188

189

191 {

193

197 }

201

202

203

204

205

206

210

211

212

213

214

215

217 {

219 return 0;

220 }

221

224

225

226

227

228

229

230

231

233 {

234 for (;;)

235 {

237

239 {

240 char c;

243

244 buf.buf = &c;

245 buf.len = 0;

246

248 if (r == 0)

249 {

251 return 1;

252 }

254 {

257 return 0;

258 }

259 }

260 else

261 break;

262 }

263 }

264 else

266

268

270 {

273 return 0;

274 }

276 return 1;

278 {

280 return 0;

281 }

283 (errmsg_internal("unrecognized return value from WaitForMultipleObjects: %d (error code %lu)", r, GetLastError())));

284 return 0;

285}

static int isDataGram(SOCKET s)

References buf, EINTR, ereport, errmsg_internal(), ERROR, EWOULDBLOCK, fb(), isDataGram(), pgwin32_dispatch_queued_signals(), pgwin32_signal_event, and TranslateSocketError().

Referenced by pgwin32_connect(), pgwin32_recv(), and pgwin32_send().

setitimer()

Definition at line 86 of file timer.c.

87{

89 Assert(value->it_interval.tv_sec == 0 && value->it_interval.tv_usec == 0);

91

93 {

94

98 (errmsg_internal("could not create timer event: error code %lu",

100

102

104

108 (errmsg_internal("could not create timer thread: error code %lu",

110 }

111

112

119

120 return 0;

121}

#define MemSet(start, val, len)

CRITICAL_SECTION crit_sec

static timerCA timerCommArea

static DWORD WINAPI pg_timer_thread(LPVOID param)

static HANDLE timerThreadHandle

References Assert, timerCA::crit_sec, ereport, errmsg_internal(), timerCA::event, FATAL, fb(), ITIMER_REAL, MemSet, pg_timer_thread(), timerCommArea, timerThreadHandle, timerCA::value, and value.

Referenced by do_watch(), fork_process(), and schedule_alarm().

pg_signal_mask

pg_signal_queue

pgwin32_initial_signal_pipe

pgwin32_noblock

pgwin32_signal_event