PostgreSQL Source Code  git master
win32error.c File Reference
#include "postgres.h"
Include dependency graph for win32error.c:

Go to the source code of this file.

Functions

void _dosmaperr (unsigned long e)
 

Variables

struct {
   DWORD   winerr
 
   int   doserr
 
doserrors []
 

Function Documentation

◆ _dosmaperr()

void _dosmaperr ( unsigned long  e)

Definition at line 177 of file win32error.c.

178 {
179  int i;
180 
181  if (e == 0)
182  {
183  errno = 0;
184  return;
185  }
186 
187  for (i = 0; i < lengthof(doserrors); i++)
188  {
189  if (doserrors[i].winerr == e)
190  {
191  int doserr = doserrors[i].doserr;
192 
193 #ifndef FRONTEND
194  ereport(DEBUG5,
195  (errmsg_internal("mapped win32 error code %lu to %d",
196  e, doserr)));
197 #elif defined(FRONTEND_DEBUG)
198  fprintf(stderr, "mapped win32 error code %lu to %d", e, doserr);
199 #endif
200  errno = doserr;
201  return;
202  }
203  }
204 
205 #ifndef FRONTEND
206  ereport(LOG,
207  (errmsg_internal("unrecognized win32 error code: %lu",
208  e)));
209 #else
210  fprintf(stderr, "unrecognized win32 error code: %lu", e);
211 #endif
212 
213  errno = EINVAL;
214 }
#define lengthof(array)
Definition: c.h:788
int errmsg_internal(const char *fmt,...)
Definition: elog.c:1159
#define LOG
Definition: elog.h:31
#define ereport(elevel,...)
Definition: elog.h:149
#define DEBUG5
Definition: elog.h:26
int i
Definition: isn.c:73
#define fprintf
Definition: port.h:242
e
Definition: preproc-init.c:82
int doserr
Definition: win32error.c:23
static const struct @182 doserrors[]
DWORD winerr
Definition: win32error.c:22

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

Referenced by BaseBackup(), 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().

Variable Documentation

◆ doserr

int doserr

Definition at line 23 of file win32error.c.

Referenced by _dosmaperr().

◆ 

const { ... } doserrors[]

Referenced by _dosmaperr().

◆ winerr

DWORD winerr

Definition at line 22 of file win32error.c.

Referenced by _dosmaperr().