PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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 if (e == 0)
180 {
181 errno = 0;
182 return;
183 }
184
185 for (size_t i = 0; i < lengthof(doserrors); i++)
186 {
187 if (doserrors[i].winerr == e)
188 {
189 int doserr = doserrors[i].doserr;
190
191#ifndef FRONTEND
193 (errmsg_internal("mapped win32 error code %lu to %d",
194 e, doserr)));
195#elif defined(FRONTEND_DEBUG)
196 fprintf(stderr, "mapped win32 error code %lu to %d", e, doserr);
197#endif
198 errno = doserr;
199 return;
200 }
201 }
202
203#ifndef FRONTEND
204 ereport(LOG,
205 (errmsg_internal("unrecognized win32 error code: %lu",
206 e)));
207#else
208 fprintf(stderr, "unrecognized win32 error code: %lu", e);
209#endif
210
211 errno = EINVAL;
212}
#define lengthof(array)
Definition c.h:932
#define fprintf(file, fmt, msg)
Definition cubescan.l:21
#define LOG
Definition elog.h:32
int int errmsg_internal(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
Definition elog.h:152
#define DEBUG5
Definition elog.h:27
int i
Definition isn.c:77
e
static int fb(int x)
#define EINVAL
Definition private.h:69
static const struct @206 doserrors[]
int doserr
Definition win32error.c:23
DWORD winerr
Definition win32error.c:22

References DEBUG5, doserr, doserrors, EINVAL, 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().

Variable Documentation

◆ doserr

int doserr

Definition at line 23 of file win32error.c.

Referenced by _dosmaperr().

◆ [struct]

const struct { ... } doserrors[]

Referenced by _dosmaperr().

◆ winerr

DWORD winerr

Definition at line 22 of file win32error.c.

Referenced by _dosmaperr().