diff options
author | Bruce Momjian <bruce@momjian.us> | 2006-06-26 12:59:44 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2006-06-26 12:59:44 +0000 |
commit | e56756e94e46c42446ac8352f43fb7b51f899d2e (patch) | |
tree | df57479f46c71515d490010ab043123effe6bc6f /src/port/win32error.c | |
parent | e2fee8cf6df1b9fa69f46682bae244e44b19f661 (diff) | |
download | postgresql-e56756e94e46c42446ac8352f43fb7b51f899d2e.tar.gz |
Use Unix line endings instead of DOS ones, per Magnus.
Diffstat (limited to 'src/port/win32error.c')
-rw-r--r-- | src/port/win32error.c | 400 |
1 files changed, 200 insertions, 200 deletions
diff --git a/src/port/win32error.c b/src/port/win32error.c index 31127b683b..ff6ff83c04 100644 --- a/src/port/win32error.c +++ b/src/port/win32error.c @@ -1,200 +1,200 @@ -/*-------------------------------------------------------------------------
- *
- * win32error.c
- * Map win32 error codes to errno values
- *
- * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
- *
- * IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/win32error.c,v 1.1 2006/06/07 22:24:46 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-
-#include "postgres.h"
-
-static const struct
-{
- DWORD winerr;
- int doserr;
-} doserrors[] =
-
-{
- {
- ERROR_INVALID_FUNCTION, EINVAL
- },
- {
- ERROR_FILE_NOT_FOUND, ENOENT
- },
- {
- ERROR_PATH_NOT_FOUND, ENOENT
- },
- {
- ERROR_TOO_MANY_OPEN_FILES, EMFILE
- },
- {
- ERROR_ACCESS_DENIED, EACCES
- },
- {
- ERROR_INVALID_HANDLE, EBADF
- },
- {
- ERROR_ARENA_TRASHED, ENOMEM
- },
- {
- ERROR_NOT_ENOUGH_MEMORY, ENOMEM
- },
- {
- ERROR_INVALID_BLOCK, ENOMEM
- },
- {
- ERROR_BAD_ENVIRONMENT, E2BIG
- },
- {
- ERROR_BAD_FORMAT, ENOEXEC
- },
- {
- ERROR_INVALID_ACCESS, EINVAL
- },
- {
- ERROR_INVALID_DATA, EINVAL
- },
- {
- ERROR_INVALID_DRIVE, ENOENT
- },
- {
- ERROR_CURRENT_DIRECTORY, EACCES
- },
- {
- ERROR_NOT_SAME_DEVICE, EXDEV
- },
- {
- ERROR_NO_MORE_FILES, ENOENT
- },
- {
- ERROR_LOCK_VIOLATION, EACCES
- },
- {
- ERROR_SHARING_VIOLATION, EACCES
- },
- {
- ERROR_BAD_NETPATH, ENOENT
- },
- {
- ERROR_NETWORK_ACCESS_DENIED, EACCES
- },
- {
- ERROR_BAD_NET_NAME, ENOENT
- },
- {
- ERROR_FILE_EXISTS, EEXIST
- },
- {
- ERROR_CANNOT_MAKE, EACCES
- },
- {
- ERROR_FAIL_I24, EACCES
- },
- {
- ERROR_INVALID_PARAMETER, EINVAL
- },
- {
- ERROR_NO_PROC_SLOTS, EAGAIN
- },
- {
- ERROR_DRIVE_LOCKED, EACCES
- },
- {
- ERROR_BROKEN_PIPE, EPIPE
- },
- {
- ERROR_DISK_FULL, ENOSPC
- },
- {
- ERROR_INVALID_TARGET_HANDLE, EBADF
- },
- {
- ERROR_INVALID_HANDLE, EINVAL
- },
- {
- ERROR_WAIT_NO_CHILDREN, ECHILD
- },
- {
- ERROR_CHILD_NOT_COMPLETE, ECHILD
- },
- {
- ERROR_DIRECT_ACCESS_HANDLE, EBADF
- },
- {
- ERROR_NEGATIVE_SEEK, EINVAL
- },
- {
- ERROR_SEEK_ON_DEVICE, EACCES
- },
- {
- ERROR_DIR_NOT_EMPTY, ENOTEMPTY
- },
- {
- ERROR_NOT_LOCKED, EACCES
- },
- {
- ERROR_BAD_PATHNAME, ENOENT
- },
- {
- ERROR_MAX_THRDS_REACHED, EAGAIN
- },
- {
- ERROR_LOCK_FAILED, EACCES
- },
- {
- ERROR_ALREADY_EXISTS, EEXIST
- },
- {
- ERROR_FILENAME_EXCED_RANGE, ENOENT
- },
- {
- ERROR_NESTING_NOT_ALLOWED, EAGAIN
- },
- {
- ERROR_NOT_ENOUGH_QUOTA, ENOMEM
- }
-};
-
-void
-_dosmaperr(unsigned long e)
-{
- 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)));
-#else
- 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;
-}
+/*------------------------------------------------------------------------- + * + * win32error.c + * Map win32 error codes to errno values + * + * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group + * + * IDENTIFICATION + * $PostgreSQL: pgsql/src/port/win32error.c,v 1.2 2006/06/26 12:58:43 momjian Exp $ + * + *------------------------------------------------------------------------- + */ + +#include "postgres.h" + +static const struct +{ + DWORD winerr; + int doserr; +} doserrors[] = + +{ + { + ERROR_INVALID_FUNCTION, EINVAL + }, + { + ERROR_FILE_NOT_FOUND, ENOENT + }, + { + ERROR_PATH_NOT_FOUND, ENOENT + }, + { + ERROR_TOO_MANY_OPEN_FILES, EMFILE + }, + { + ERROR_ACCESS_DENIED, EACCES + }, + { + ERROR_INVALID_HANDLE, EBADF + }, + { + ERROR_ARENA_TRASHED, ENOMEM + }, + { + ERROR_NOT_ENOUGH_MEMORY, ENOMEM + }, + { + ERROR_INVALID_BLOCK, ENOMEM + }, + { + ERROR_BAD_ENVIRONMENT, E2BIG + }, + { + ERROR_BAD_FORMAT, ENOEXEC + }, + { + ERROR_INVALID_ACCESS, EINVAL + }, + { + ERROR_INVALID_DATA, EINVAL + }, + { + ERROR_INVALID_DRIVE, ENOENT + }, + { + ERROR_CURRENT_DIRECTORY, EACCES + }, + { + ERROR_NOT_SAME_DEVICE, EXDEV + }, + { + ERROR_NO_MORE_FILES, ENOENT + }, + { + ERROR_LOCK_VIOLATION, EACCES + }, + { + ERROR_SHARING_VIOLATION, EACCES + }, + { + ERROR_BAD_NETPATH, ENOENT + }, + { + ERROR_NETWORK_ACCESS_DENIED, EACCES + }, + { + ERROR_BAD_NET_NAME, ENOENT + }, + { + ERROR_FILE_EXISTS, EEXIST + }, + { + ERROR_CANNOT_MAKE, EACCES + }, + { + ERROR_FAIL_I24, EACCES + }, + { + ERROR_INVALID_PARAMETER, EINVAL + }, + { + ERROR_NO_PROC_SLOTS, EAGAIN + }, + { + ERROR_DRIVE_LOCKED, EACCES + }, + { + ERROR_BROKEN_PIPE, EPIPE + }, + { + ERROR_DISK_FULL, ENOSPC + }, + { + ERROR_INVALID_TARGET_HANDLE, EBADF + }, + { + ERROR_INVALID_HANDLE, EINVAL + }, + { + ERROR_WAIT_NO_CHILDREN, ECHILD + }, + { + ERROR_CHILD_NOT_COMPLETE, ECHILD + }, + { + ERROR_DIRECT_ACCESS_HANDLE, EBADF + }, + { + ERROR_NEGATIVE_SEEK, EINVAL + }, + { + ERROR_SEEK_ON_DEVICE, EACCES + }, + { + ERROR_DIR_NOT_EMPTY, ENOTEMPTY + }, + { + ERROR_NOT_LOCKED, EACCES + }, + { + ERROR_BAD_PATHNAME, ENOENT + }, + { + ERROR_MAX_THRDS_REACHED, EAGAIN + }, + { + ERROR_LOCK_FAILED, EACCES + }, + { + ERROR_ALREADY_EXISTS, EEXIST + }, + { + ERROR_FILENAME_EXCED_RANGE, ENOENT + }, + { + ERROR_NESTING_NOT_ALLOWED, EAGAIN + }, + { + ERROR_NOT_ENOUGH_QUOTA, ENOMEM + } +}; + +void +_dosmaperr(unsigned long e) +{ + 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))); +#else + 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; +} |