23 #include <my_global.h>
34 { ERROR_INVALID_FUNCTION, EINVAL },
35 { ERROR_FILE_NOT_FOUND, ENOENT },
36 { ERROR_PATH_NOT_FOUND, ENOENT },
37 { ERROR_TOO_MANY_OPEN_FILES, EMFILE },
38 { ERROR_ACCESS_DENIED, EACCES },
39 { ERROR_INVALID_HANDLE, EBADF },
40 { ERROR_ARENA_TRASHED, ENOMEM },
41 { ERROR_NOT_ENOUGH_MEMORY, ENOMEM },
42 { ERROR_INVALID_BLOCK, ENOMEM },
43 { ERROR_BAD_ENVIRONMENT, E2BIG },
44 { ERROR_BAD_FORMAT, ENOEXEC },
45 { ERROR_INVALID_ACCESS, EINVAL },
46 { ERROR_INVALID_DATA, EINVAL },
47 { ERROR_INVALID_DRIVE, ENOENT },
48 { ERROR_CURRENT_DIRECTORY, EACCES },
49 { ERROR_NOT_SAME_DEVICE, EXDEV },
50 { ERROR_NO_MORE_FILES, ENOENT },
51 { ERROR_LOCK_VIOLATION, EACCES },
52 { ERROR_BAD_NETPATH, ENOENT },
53 { ERROR_NETWORK_ACCESS_DENIED, EACCES },
54 { ERROR_BAD_NET_NAME, ENOENT },
55 { ERROR_FILE_EXISTS, EEXIST },
56 { ERROR_CANNOT_MAKE, EACCES },
57 { ERROR_FAIL_I24, EACCES },
58 { ERROR_INVALID_PARAMETER, EINVAL },
59 { ERROR_NO_PROC_SLOTS, EAGAIN },
60 { ERROR_DRIVE_LOCKED, EACCES },
61 { ERROR_BROKEN_PIPE, EPIPE },
62 { ERROR_DISK_FULL, ENOSPC },
63 { ERROR_INVALID_TARGET_HANDLE, EBADF },
64 { ERROR_INVALID_HANDLE, EINVAL },
65 { ERROR_WAIT_NO_CHILDREN, ECHILD },
66 { ERROR_CHILD_NOT_COMPLETE, ECHILD },
67 { ERROR_DIRECT_ACCESS_HANDLE, EBADF },
68 { ERROR_NEGATIVE_SEEK, EINVAL },
69 { ERROR_SEEK_ON_DEVICE, EACCES },
70 { ERROR_DIR_NOT_EMPTY, ENOTEMPTY },
71 { ERROR_NOT_LOCKED, EACCES },
72 { ERROR_BAD_PATHNAME, ENOENT },
73 { ERROR_MAX_THRDS_REACHED, EAGAIN },
74 { ERROR_LOCK_FAILED, EACCES },
75 { ERROR_ALREADY_EXISTS, EEXIST },
76 { ERROR_FILENAME_EXCED_RANGE, ENOENT },
77 { ERROR_NESTING_NOT_ALLOWED, EAGAIN },
78 { ERROR_NOT_ENOUGH_QUOTA, ENOMEM }
82 #define ERRTABLESIZE (sizeof(errtable)/sizeof(errtable[0]))
86 #define MIN_EXEC_ERROR ERROR_INVALID_STARTING_CODESEG
87 #define MAX_EXEC_ERROR ERROR_INFLOOP_IN_RELOC_CHAIN
91 #define MIN_EACCES_RANGE ERROR_WRITE_PROTECT
92 #define MAX_EACCES_RANGE ERROR_SHARING_BUFFER_EXCEEDED
95 static int get_errno_from_oserr(
unsigned long oserrno)
100 for (i= 0; i < ERRTABLESIZE; ++
i)
102 if (oserrno == errtable[i].oscode)
104 return errtable[
i].sysv_errno;
112 if (oserrno >= MIN_EACCES_RANGE && oserrno <= MAX_EACCES_RANGE)
114 else if (oserrno >= MIN_EXEC_ERROR && oserrno <= MAX_EXEC_ERROR)
121 void my_osmaperr (
unsigned long oserrno)
123 errno= get_errno_from_oserr(oserrno);