Changeset 21398 for trunk/src/msvcrt/errno.c
- Timestamp:
- Jul 28, 2010, 8:14:30 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/msvcrt/errno.c
r10005 r21398 19 19 */ 20 20 21 #ifndef __MINIVCRT__ 22 21 23 #include "msvcrt.h" 22 24 #include "msvcrt/errno.h" … … 29 31 #include "msvcrt/string.h" 30 32 31 32 33 #include "wine/debug.h" 33 34 34 35 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); 35 36 37 #else /* !__MINIVCRT__ */ 38 39 #include <winbase.h> 40 #include <winerror.h> 41 42 #include "minivcrt.h" 43 #include "minivcrt_internal.h" 44 45 #include <errno.h> 46 47 #endif /* !__MINIVCRT__ */ 36 48 37 49 /* INTERNAL: Set the crt and dos errno's from the OS error given. */ 38 50 void MSVCRT__set_errno(int err) 39 51 { 40 int *msv_errno = MSVCRT__errno(); 52 #ifndef __MINIVCRT__ 53 54 int *__errno = MSVCRT__errno(); 41 55 unsigned long *doserrno = MSVCRT_doserrno(); 42 56 43 57 *doserrno = err; 58 59 #define ERR_CASE(oserr) case oserr: 60 #define ERR_MAPS(oserr,crterr) case oserr:*__errno = MSVCRT_##crterr;break; 61 62 #else /* !__MINIVCRT__ */ 63 64 int *__errno = _errno(); 65 66 #define ERR_CASE(oserr) case oserr: 67 #define ERR_MAPS(oserr,crterr) case oserr:*__errno = crterr;break; 68 69 #endif /* !__MINIVCRT__ */ 44 70 45 71 switch(err) 46 72 { 47 #define ERR_CASE(oserr) case oserr:48 #define ERR_MAPS(oserr,crterr) case oserr:*msv_errno = crterr;break;49 73 ERR_CASE(ERROR_ACCESS_DENIED) 50 74 ERR_CASE(ERROR_NETWORK_ACCESS_DENIED) … … 57 81 ERR_CASE(ERROR_NOT_LOCKED) 58 82 ERR_CASE(ERROR_INVALID_ACCESS) 59 ERR_MAPS(ERROR_LOCK_VIOLATION, MSVCRT_EACCES);83 ERR_MAPS(ERROR_LOCK_VIOLATION, EACCES); 60 84 ERR_CASE(ERROR_FILE_NOT_FOUND) 61 85 ERR_CASE(ERROR_NO_MORE_FILES) … … 65 89 ERR_CASE(ERROR_BAD_NET_NAME) 66 90 ERR_CASE(ERROR_FILENAME_EXCED_RANGE) 67 ERR_MAPS(ERROR_PATH_NOT_FOUND, MSVCRT_ENOENT);68 ERR_MAPS(ERROR_IO_DEVICE, MSVCRT_EIO);69 ERR_MAPS(ERROR_BAD_FORMAT, MSVCRT_ENOEXEC);70 ERR_MAPS(ERROR_INVALID_HANDLE, MSVCRT_EBADF);91 ERR_MAPS(ERROR_PATH_NOT_FOUND, ENOENT); 92 ERR_MAPS(ERROR_IO_DEVICE, EIO); 93 ERR_MAPS(ERROR_BAD_FORMAT, ENOEXEC); 94 ERR_MAPS(ERROR_INVALID_HANDLE, EBADF); 71 95 ERR_CASE(ERROR_OUTOFMEMORY) 72 96 ERR_CASE(ERROR_INVALID_BLOCK) 73 97 ERR_CASE(ERROR_NOT_ENOUGH_QUOTA); 74 ERR_MAPS(ERROR_ARENA_TRASHED, MSVCRT_ENOMEM);75 ERR_MAPS(ERROR_BUSY, MSVCRT_EBUSY);98 ERR_MAPS(ERROR_ARENA_TRASHED, ENOMEM); 99 ERR_MAPS(ERROR_BUSY, EBUSY); 76 100 ERR_CASE(ERROR_ALREADY_EXISTS) 77 ERR_MAPS(ERROR_FILE_EXISTS, MSVCRT_EEXIST);78 ERR_MAPS(ERROR_BAD_DEVICE, MSVCRT_ENODEV);79 ERR_MAPS(ERROR_TOO_MANY_OPEN_FILES, MSVCRT_EMFILE);80 ERR_MAPS(ERROR_DISK_FULL, MSVCRT_ENOSPC);81 ERR_MAPS(ERROR_BROKEN_PIPE, MSVCRT_EPIPE);82 ERR_MAPS(ERROR_POSSIBLE_DEADLOCK, MSVCRT_EDEADLK);83 ERR_MAPS(ERROR_DIR_NOT_EMPTY, MSVCRT_ENOTEMPTY);84 ERR_MAPS(ERROR_BAD_ENVIRONMENT, MSVCRT_E2BIG);101 ERR_MAPS(ERROR_FILE_EXISTS, EEXIST); 102 ERR_MAPS(ERROR_BAD_DEVICE, ENODEV); 103 ERR_MAPS(ERROR_TOO_MANY_OPEN_FILES, EMFILE); 104 ERR_MAPS(ERROR_DISK_FULL, ENOSPC); 105 ERR_MAPS(ERROR_BROKEN_PIPE, EPIPE); 106 ERR_MAPS(ERROR_POSSIBLE_DEADLOCK, EDEADLK); 107 ERR_MAPS(ERROR_DIR_NOT_EMPTY, ENOTEMPTY); 108 ERR_MAPS(ERROR_BAD_ENVIRONMENT, E2BIG); 85 109 ERR_CASE(ERROR_WAIT_NO_CHILDREN) 86 ERR_MAPS(ERROR_CHILD_NOT_COMPLETE, MSVCRT_ECHILD);110 ERR_MAPS(ERROR_CHILD_NOT_COMPLETE, ECHILD); 87 111 ERR_CASE(ERROR_NO_PROC_SLOTS) 88 112 ERR_CASE(ERROR_MAX_THRDS_REACHED) 89 ERR_MAPS(ERROR_NESTING_NOT_ALLOWED, MSVCRT_EAGAIN);113 ERR_MAPS(ERROR_NESTING_NOT_ALLOWED, EAGAIN); 90 114 default: 91 115 /* Remaining cases map to EINVAL */ 92 116 /* FIXME: may be missing some errors above */ 93 * msv_errno = MSVCRT_EINVAL;117 *__errno = MSVCRT(EINVAL); 94 118 } 95 119 } 120 121 #ifndef __MINIVCRT__ 96 122 97 123 /********************************************************************* … … 100 126 int* MSVCRT__errno(void) 101 127 { 102 dprintf(("MSVCRT: __errno %d",msvcrt_get_thread_data()->msv_errno)); 128 dprintf(("MSVCRT: __errno %d",msvcrt_get_thread_data()->msv_errno)); 103 129 return &msvcrt_get_thread_data()->msv_errno; 104 130 } … … 109 135 unsigned long* MSVCRT_doserrno(void) 110 136 { 111 dprintf(("MSVCRT: _doserrno %d",msvcrt_get_thread_data()->doserrno)); 137 dprintf(("MSVCRT: _doserrno %d",msvcrt_get_thread_data()->doserrno)); 112 138 return &msvcrt_get_thread_data()->doserrno; 113 139 } … … 138 164 MSVCRT__cprintf("%s: %s\n",str,MSVCRT_strerror(msvcrt_get_thread_data()->msv_errno)); 139 165 } 166 167 #endif /* !__MINIVCRT__ */
Note:
See TracChangeset
for help on using the changeset viewer.