Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions | Variables

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 168 of file win32error.c.

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

Referenced by BaseBackup(), FileRead(), FileWrite(), getErrorText(), getrusage(), and readdir().

{
    int         i;

    if (e == 0)
    {
        errno = 0;
        return;
    }

    for (i = 0; i < lengthof(doserrors); i++)
    {
        if (doserrors[i].winerr == e)
        {
            errno = doserrors[i].doserr;
#ifndef FRONTEND
            ereport(DEBUG5,
                    (errmsg_internal("mapped win32 error code %lu to %d",
                                     e, errno)));
#elif FRONTEND_DEBUG
            fprintf(stderr, _("mapped win32 error code %lu to %d"), e, errno);
#endif
            return;
        }
    }

#ifndef FRONTEND
    ereport(LOG,
            (errmsg_internal("unrecognized win32 error code: %lu",
                             e)));
#else
    fprintf(stderr, _("unrecognized win32 error code: %lu"), e);
#endif

    errno = EINVAL;
    return;
}


Variable Documentation

int doserr

Definition at line 23 of file win32error.c.

struct { ... } doserrors[] [static]

Referenced by _dosmaperr().

DWORD winerr

Definition at line 22 of file win32error.c.

Referenced by _dosmaperr().