PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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)
 

Functions

const charwinsock_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.

◆ read

#define read (   a,
  b,
  c 
)    _read(a,b,c)

Definition at line 13 of file win32.h.

◆ write

#define write (   a,
  b,
  c 
)    _write(a,b,c)

Definition at line 14 of file win32.h.

Function Documentation

◆ winsock_strerror()

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

Definition at line 277 of file win32.c.

278{
279 unsigned long flags;
280 int offs;
282
283 for (size_t i = 0; !success && i < DLLS_SIZE; i++)
284 {
285
286 if (!dlls[i].loaded)
287 {
288 dlls[i].loaded = 1; /* Only load once */
289 dlls[i].handle = (void *) LoadLibraryEx(dlls[i].dll_name,
290 0,
292 }
293
294 if (dlls[i].dll_name && !dlls[i].handle)
295 continue; /* Didn't load */
296
300
301 success = 0 != FormatMessage(flags,
302 dlls[i].handle, err,
304 strerrbuf, buflen - 64,
305 0);
306 }
307
308 if (!success)
309 sprintf(strerrbuf, libpq_gettext("unrecognized socket error: 0x%08X/%d"), err, err);
310 else
311 {
312 strerrbuf[buflen - 1] = '\0';
314 if (offs > (int) buflen - 64)
315 offs = buflen - 64;
316 sprintf(strerrbuf + offs, " (0x%08X/%d)", err, err);
317 }
318 return strerrbuf;
319}
void err(int eval, const char *fmt,...)
Definition err.c:43
static bool success
Definition initdb.c:188
int i
Definition isn.c:77
#define sprintf
Definition port.h:263
static int fb(int x)
void * handle
Definition win32.c:237
int loaded
Definition win32.c:238
#define libpq_gettext(x)
Definition win32.c:39
static int LookupWSErrorMessage(DWORD err, char *dest)
Definition win32.c:218
#define DLLS_SIZE
Definition win32.c:268
static struct MessageDLL dlls[]

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