1 /*-------------------------------------------------------------------------
4 * Map win32 error codes to errno values
6 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
11 *-------------------------------------------------------------------------
24 ERROR_INVALID_FUNCTION
, EINVAL
27 ERROR_FILE_NOT_FOUND
, ENOENT
30 ERROR_PATH_NOT_FOUND
, ENOENT
33 ERROR_TOO_MANY_OPEN_FILES
, EMFILE
36 ERROR_ACCESS_DENIED
, EACCES
39 ERROR_INVALID_HANDLE
, EBADF
42 ERROR_ARENA_TRASHED
, ENOMEM
45 ERROR_NOT_ENOUGH_MEMORY
, ENOMEM
48 ERROR_INVALID_BLOCK
, ENOMEM
51 ERROR_BAD_ENVIRONMENT
, E2BIG
54 ERROR_BAD_FORMAT
, ENOEXEC
57 ERROR_INVALID_ACCESS
, EINVAL
60 ERROR_INVALID_DATA
, EINVAL
63 ERROR_INVALID_DRIVE
, ENOENT
66 ERROR_CURRENT_DIRECTORY
, EACCES
69 ERROR_NOT_SAME_DEVICE
, EXDEV
72 ERROR_NO_MORE_FILES
, ENOENT
75 ERROR_LOCK_VIOLATION
, EACCES
78 ERROR_SHARING_VIOLATION
, EACCES
81 ERROR_BAD_NETPATH
, ENOENT
84 ERROR_NETWORK_ACCESS_DENIED
, EACCES
87 ERROR_BAD_NET_NAME
, ENOENT
90 ERROR_FILE_EXISTS
, EEXIST
93 ERROR_CANNOT_MAKE
, EACCES
96 ERROR_FAIL_I24
, EACCES
99 ERROR_INVALID_PARAMETER
, EINVAL
102 ERROR_NO_PROC_SLOTS
, EAGAIN
105 ERROR_DRIVE_LOCKED
, EACCES
108 ERROR_BROKEN_PIPE
, EPIPE
111 ERROR_DISK_FULL
, ENOSPC
114 ERROR_INVALID_TARGET_HANDLE
, EBADF
117 ERROR_INVALID_HANDLE
, EINVAL
120 ERROR_WAIT_NO_CHILDREN
, ECHILD
123 ERROR_CHILD_NOT_COMPLETE
, ECHILD
126 ERROR_DIRECT_ACCESS_HANDLE
, EBADF
129 ERROR_NEGATIVE_SEEK
, EINVAL
132 ERROR_SEEK_ON_DEVICE
, EACCES
135 ERROR_DIR_NOT_EMPTY
, ENOTEMPTY
138 ERROR_NOT_LOCKED
, EACCES
141 ERROR_BAD_PATHNAME
, ENOENT
144 ERROR_MAX_THRDS_REACHED
, EAGAIN
147 ERROR_LOCK_FAILED
, EACCES
150 ERROR_ALREADY_EXISTS
, EEXIST
153 ERROR_FILENAME_EXCED_RANGE
, ENOENT
156 ERROR_NESTING_NOT_ALLOWED
, EAGAIN
159 ERROR_NOT_ENOUGH_QUOTA
, ENOMEM
164 _dosmaperr(unsigned long e
)
174 for (i
= 0; i
< lengthof(doserrors
); i
++)
176 if (doserrors
[i
].winerr
== e
)
178 errno
= doserrors
[i
].doserr
;
181 (errmsg_internal("mapped win32 error code %lu to %d",
184 fprintf(stderr
, _("mapped win32 error code %lu to %d"), e
, errno
);
192 (errmsg_internal("unrecognized win32 error code: %lu",
195 fprintf(stderr
, _("unrecognized win32 error code: %lu"), e
);