PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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

void _dosmaperr ( unsigned long  e)

Definition at line 171 of file win32error.c.

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

Referenced by BaseBackup(), copyFile(), dsm_impl_pin_segment(), dsm_impl_unpin_segment(), FileRead(), FileWrite(), getrusage(), and readdir().

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

Variable Documentation

int doserr

Definition at line 23 of file win32error.c.

Referenced by _dosmaperr().

const { ... } doserrors[]

Referenced by _dosmaperr().

DWORD winerr

Definition at line 22 of file win32error.c.

Referenced by _dosmaperr().