Document return values
[ACE_TAO.git] / ACE / ace / OS_NS_errno.cpp
blob537b325925779b4c09efa8a2698b2e2c7e1e5cbc
1 // -*- C++ -*-
2 #include "ace/OS_NS_errno.h"
4 #if !defined (ACE_HAS_INLINED_OSCALLS)
5 # include "ace/OS_NS_errno.inl"
6 #endif /* ACE_HAS_INLINED_OSCALLS */
9 #ifdef ACE_MQX
10 int
11 ACE_OS::mqx_error_to_errno(int mqx_error)
13 switch (mqx_error)
15 // Not really an error.
16 case FS_EOF:
17 return 0;
19 case FS_INVALID_FUNCTION_CODE:
20 case FS_INVALID_PARAMETER:
21 case FS_INVALID_HANDLE:
22 case FS_ERROR_INVALID_DRIVE_HANDLE:
23 case FS_ERROR_INVALID_FILE_HANDLE:
24 case MQX_INVALID_POINTER:
25 case MQX_INVALID_PARAMETER:
26 case FS_INVALID_MEMORY_BLOCK_ADDRESS:
27 case MQX_INVALID_SIZE:
28 case MQX_INVALID_MEMORY_BLOCK:
29 case MQX_INVALID_TASK_PRIORITY:
30 case MQX_INVALID_TASK_STATE:
31 case MQX_INVALID_TASK_ID:
32 case MQX_INVALID_PROCESSOR_NUMBER:
33 case MQX_INVALID_VECTORED_INTERRUPT:
34 case MQX_INVALID_TEMPLATE_INDEX:
35 case MQX_INVALID_CONFIGURATION:
36 case MQX_INVALID_COMPONENT_HANDLE:
37 case MQX_INVALID_COMPONENT_BASE:
38 case MQX_INVALID_COMPONENT_NAME:
39 case MQX_INVALID_HANDLE:
40 case MQX_INVALID_TASK_QUEUE:
41 case MQX_INVALID_LWSEM:
42 case MQX_SCHED_INVALID_POLICY:
43 case MQX_SCHED_INVALID_PARAMETER_PTR:
44 case MQX_SCHED_INVALID_PARAMETER:
45 case MQX_SCHED_INVALID_TASK_ID:
46 case MQX_INVALID_IO_CHANNEL:
47 case MQX_INVALID_DEVICE:
48 case MQX_INVALID_CLOCK_SPEED:
49 case MQX_IPC_INVALID_MESSAGE:
50 case MQX_MEM_POOL_INVALID:
51 case MQX_LWMEM_POOL_INVALID:
52 case MQX_LWEVENT_INVALID:
53 case MQX_LWTIMER_INVALID:
54 return EINVAL;
55 case FS_FILE_NOT_FOUND:
56 case FS_PATH_NOT_FOUND:
57 return ENOENT;
58 case FS_ACCESS_DENIED:
59 case FS_OPERATION_NOT_ALLOWED:
60 case FS_SHARING_VIOLATION:
61 case MQX_NOT_RESOURCE_OWNER:
62 case MQX_ACCESS_ERROR:
63 return EPERM;
64 case FS_INSUFFICIENT_MEMORY:
65 case FS_PMGR_INSUF_MEMORY:
66 case MQX_OUT_OF_MEMORY:
67 case MQX_KERNEL_MEMORY_TOO_SMALL:
68 case MQX_MEM_POOL_TOO_SMALL:
69 case MQX_OUT_OF_MMU_PAGE_TABLES:
70 return ENOMEM;
71 case FS_FILE_EXISTS:
72 case MQX_COMPONENT_EXISTS:
73 case MQX_IPC_ROUTE_EXISTS:
74 case MQX_MMU_CONTEXT_EXISTS:
75 case FS_ALREADY_ASSIGNED:
76 return EEXIST;
77 case FS_DISK_FULL:
78 case FS_ROOT_DIR_FULL:
79 return ENOSPC;
80 case FS_DISK_IS_WRITE_PROTECTED:
81 return EROFS;
82 case FS_BAD_DISK_UNIT:
83 case FS_INVALID_LENGTH_IN_DISK_OPERATION:
84 case FS_NOT_A_DOS_DISK:
85 case FS_SECTOR_NOT_FOUND:
86 case FS_WRITE_FAULT:
87 case FS_READ_FAULT:
88 case FS_NOT_INITIALIZED:
89 case FS_ERROR_UNKNOWN_FS_VERSION:
90 case FS_LOST_CHAIN:
91 case FS_INVALID_DEVICE:
92 case FS_INVALID_CLUSTER_NUMBER:
93 case FS_FAILED_TO_DELETE_LFN:
94 case FS_BAD_LFN_ENTRY:
95 case FS_PMGR_INVALID_PARTITION:
96 case FS_PMGR_UNKNOWN_PARTITION:
97 case FS_PMGR_INVALID_PARTTABLE:
98 case FS_PMGR_EXFAT_PARTITION:
99 case MQX_IO_OPERATION_NOT_AVAILABLE:
100 return EIO;
101 case FS_CANNOT_CREATE_DIRECTORY:
102 return ENOTDIR;
103 case MQX_LWSEM_WAIT_TIMEOUT:
104 return ETIME;
106 // These seem like generic errors
107 case MQX_MMU_ERROR:
108 case MQX_ERROR:
110 // Need more info to categorize
111 case FS_ATTEMPT_TO_REMOVE_CURRENT_DIR:
112 case MQX_INVALID_CHECKSUM:
113 case MQX_OUT_OF_TASK_DESCRIPTORS:
114 case MQX_CANNOT_CALL_FUNCTION_FROM_ISR:
115 case MQX_TASK_QUEUE_EMPTY:
116 case MQX_NO_TASK_TEMPLATE:
117 case MQX_COMPONENT_DOES_NOT_EXIST:
118 case MQX_COULD_NOT_CREATE_IPC_TASK:
119 case MQX_TOO_MANY_PRIORITY_LEVELS:
120 case MQX_TOO_MANY_INTERRUPTS:
121 case MQX_DUPLICATE_TASK_TEMPLATE_INDEX:
122 case MQX_TIMER_ISR_INSTALL_FAIL:
123 case MQX_INTER_PROCESSOR_INIT_FAILED:
124 case MQX_IPC_SERVICE_NOT_AVAILABLE:
125 case MQX_MMU_CONTEXT_DOES_NOT_EXIST:
126 case MQX_MMU_PARENT_TASK_CANNOT_BE_MMU:
127 case MQX_RTC_UNLOCK_FAILED:
128 case MQX_NO_USER_TASKS:
129 case MQX_TOO_MANY_USER_TASKS:
130 case MQX_TASKQ_CREATE_FAILED:
131 case MQX_INVALD_INT_ENABLE:
132 case MQX_UNABLE_TO_CREATE_COMPONENT:
133 case MQX_CLOCK_TRIM_FAILED:
135 /* These are serious and should definitely return EFAULT unless there is a
136 * more appropriate error code.
138 case MQX_CORRUPT_MEMORY_SYSTEM:
139 case MQX_CORRUPT_STORAGE_POOL:
140 case MQX_CORRUPT_STORAGE_POOL_FREE_LIST:
141 case MQX_CORRUPT_STORAGE_POOL_POINTERS:
142 case MQX_CORRUPT_QUEUE:
143 case MQX_CORRUPT_INTERRUPT_STACK:
144 case MQX_UNHANDLED_INTERRUPT:
146 default:
147 return EFAULT;
150 #endif