1 /*-------------------------------------------------------------------------
4 * Map win32 error codes to errno values
6 * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
9 * src/port/win32error.c
11 *-------------------------------------------------------------------------
17 #include "postgres_fe.h"
28 ERROR_INVALID_FUNCTION, EINVAL
31 ERROR_FILE_NOT_FOUND, ENOENT
34 ERROR_PATH_NOT_FOUND, ENOENT
37 ERROR_TOO_MANY_OPEN_FILES, EMFILE
40 ERROR_ACCESS_DENIED, EACCES
43 ERROR_INVALID_HANDLE, EBADF
46 ERROR_ARENA_TRASHED, ENOMEM
49 ERROR_NOT_ENOUGH_MEMORY, ENOMEM
52 ERROR_INVALID_BLOCK, ENOMEM
55 ERROR_BAD_ENVIRONMENT, E2BIG
58 ERROR_BAD_FORMAT, ENOEXEC
61 ERROR_INVALID_ACCESS, EINVAL
64 ERROR_INVALID_DATA, EINVAL
67 ERROR_INVALID_DRIVE, ENOENT
70 ERROR_CURRENT_DIRECTORY, EACCES
73 ERROR_NOT_SAME_DEVICE, EXDEV
76 ERROR_NO_MORE_FILES, ENOENT
79 ERROR_LOCK_VIOLATION, EACCES
82 ERROR_SHARING_VIOLATION, EACCES
85 ERROR_BAD_NETPATH, ENOENT
88 ERROR_NETWORK_ACCESS_DENIED, EACCES
91 ERROR_BAD_NET_NAME, ENOENT
94 ERROR_FILE_EXISTS, EEXIST
97 ERROR_CANNOT_MAKE, EACCES
100 ERROR_FAIL_I24, EACCES
103 ERROR_INVALID_PARAMETER, EINVAL
106 ERROR_NO_PROC_SLOTS, EAGAIN
109 ERROR_DRIVE_LOCKED, EACCES
112 ERROR_BROKEN_PIPE, EPIPE
115 ERROR_DISK_FULL, ENOSPC
118 ERROR_INVALID_TARGET_HANDLE, EBADF
121 ERROR_INVALID_HANDLE, EINVAL
124 ERROR_WAIT_NO_CHILDREN, ECHILD
127 ERROR_CHILD_NOT_COMPLETE, ECHILD
130 ERROR_DIRECT_ACCESS_HANDLE, EBADF
133 ERROR_NEGATIVE_SEEK, EINVAL
136 ERROR_SEEK_ON_DEVICE, EACCES
139 ERROR_DIR_NOT_EMPTY, ENOTEMPTY
142 ERROR_NOT_LOCKED, EACCES
145 ERROR_BAD_PATHNAME, ENOENT
148 ERROR_MAX_THRDS_REACHED, EAGAIN
151 ERROR_LOCK_FAILED, EACCES
154 ERROR_ALREADY_EXISTS, EEXIST
157 ERROR_FILENAME_EXCED_RANGE, ENOENT
160 ERROR_NESTING_NOT_ALLOWED, EAGAIN
163 ERROR_NOT_ENOUGH_QUOTA, ENOMEM
166 ERROR_DELETE_PENDING, ENOENT
171 _dosmaperr(unsigned long e)
181 for (i = 0; i < lengthof(doserrors); i++)
183 if (doserrors[i].winerr == e)
185 int doserr = doserrors[i].doserr;
189 (errmsg_internal("mapped win32 error code %lu to %d",
191 #elif defined(FRONTEND_DEBUG)
192 fprintf(stderr, "mapped win32 error code %lu to %d", e, doserr);
201 (errmsg_internal("unrecognized win32 error code: %lu",
204 fprintf(stderr, "unrecognized win32 error code: %lu", e);