PostgreSQL Source Code  git master
win32.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define close(a)   _close(a)
 
#define read(a, b, c)   _read(a,b,c)
 
#define write(a, b, c)   _write(a,b,c)
 
#define EINTR   WSAEINTR
 
#define EWOULDBLOCK   WSAEWOULDBLOCK
 
#define ECONNRESET   WSAECONNRESET
 
#define EINPROGRESS   WSAEINPROGRESS
 

Functions

const char * winsock_strerror (int err, char *strerrbuf, size_t buflen)
 

Macro Definition Documentation

◆ close

#define close (   a)    _close(a)

Definition at line 12 of file win32.h.

Referenced by AddToDataDirLockFile(), AlterSystemSetConfigFile(), BootStrapXLOG(), cfindloop(), CheckForExternalTrigger(), choose_dsm_implementation(), close_target_file(), ClosePostmasterPorts(), CloseTransientFile(), copy_file_range(), copyFile(), count_usable_fds(), CreateLockFile(), DebugFileOpen(), dir_close(), dir_existsfile(), dir_open_for_write(), dsm_impl_can_resize(), dsm_impl_mmap(), durable_rename(), exitArchiveRecovery(), exportFile(), extractPageMap(), FileClose(), find(), findLastCheckpoint(), FindStreamingStart(), fork_process(), FreeDesc(), FreeWaitEventSet(), fsync_fname(), get_controlfile(), GetNewRelFileNode(), importFile(), initializeInput(), InitializeLatchSupport(), lo_export(), lo_import_internal(), LruDelete(), LruInsert(), main(), pid_lock_file_exists(), PreallocXlogFiles(), ReadControlFile(), readfile(), readOneRecord(), ReadRecord(), RecheckDataDirLockFile(), RewriteControlFile(), rewriteVisibilityMap(), run_ifaddr_callback(), search_directory(), SetWALSegSize(), SimpleXLogPageRead(), slurpFile(), StartupXLOG(), StreamLogicalLog(), SysLogger_Start(), SysLoggerMain(), tar_finish(), test_file_descriptor_sync(), test_non_sync(), test_open(), test_open_sync(), test_sync(), TouchSocketLockFiles(), truncate_target_file(), tzloadbody(), UpdateControlFile(), verify_directories(), WaitForWALToBecomeAvailable(), walkdir(), WalReceiverMain(), WalSndErrorCleanup(), WriteControlFile(), WriteEmptyXLOG(), XLogDumpXLogRead(), XLogFileClose(), XLogFileInit(), XLogPageRead(), XLogRead(), XLogSendPhysical(), and XLogWalRcvWrite().

◆ ECONNRESET

#define ECONNRESET   WSAECONNRESET

Definition at line 23 of file win32.h.

◆ EINPROGRESS

#define EINPROGRESS   WSAEINPROGRESS

Definition at line 26 of file win32.h.

◆ EINTR

#define EINTR   WSAEINTR

Definition at line 18 of file win32.h.

◆ EWOULDBLOCK

#define EWOULDBLOCK   WSAEWOULDBLOCK

Definition at line 20 of file win32.h.

◆ read

◆ write

Function Documentation

◆ winsock_strerror()

const char* winsock_strerror ( int  err,
char *  strerrbuf,
size_t  buflen 
)

Definition at line 281 of file win32.c.

References dlls, DLLS_SIZE, MessageDLL::handle, i, libpq_gettext, MessageDLL::loaded, LookupWSErrorMessage(), and success.

282 {
283  unsigned long flags;
284  int offs,
285  i;
286  int success = LookupWSErrorMessage(err, strerrbuf);
287 
288  for (i = 0; !success && i < DLLS_SIZE; i++)
289  {
290 
291  if (!dlls[i].loaded)
292  {
293  dlls[i].loaded = 1; /* Only load once */
294  dlls[i].handle = (void *) LoadLibraryEx(
295  dlls[i].dll_name,
296  0,
297  LOAD_LIBRARY_AS_DATAFILE);
298  }
299 
300  if (dlls[i].dll_name && !dlls[i].handle)
301  continue; /* Didn't load */
302 
303  flags = FORMAT_MESSAGE_FROM_SYSTEM
304  | FORMAT_MESSAGE_IGNORE_INSERTS
305  | (dlls[i].handle ? FORMAT_MESSAGE_FROM_HMODULE : 0);
306 
307  success = 0 != FormatMessage(
308  flags,
309  dlls[i].handle, err,
310  MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
311  strerrbuf, buflen - 64,
312  0
313  );
314  }
315 
316  if (!success)
317  sprintf(strerrbuf, libpq_gettext("unrecognized socket error: 0x%08X/%d"), err, err);
318  else
319  {
320  strerrbuf[buflen - 1] = '\0';
321  offs = strlen(strerrbuf);
322  if (offs > (int) buflen - 64)
323  offs = buflen - 64;
324  sprintf(strerrbuf + offs, " (0x%08X/%d)", err, err);
325  }
326  return strerrbuf;
327 }
struct MessageDLL dlls[]
#define libpq_gettext(x)
Definition: win32.c:39
static bool success
Definition: pg_basebackup.c:99
static int LookupWSErrorMessage(DWORD err, char *dest)
Definition: win32.c:218
#define DLLS_SIZE
Definition: win32.c:268
int loaded
Definition: win32.c:238
void * handle
Definition: win32.c:237
int i