F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
error.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Os/Posix/error.cpp
3 // \brief implementation for posix errno conversion
4 // ======================================================================
5 #include <cerrno>
6 #include "Os/Posix/error.hpp"
7 
8 namespace Os {
9 namespace Posix {
10 
13  switch (errno_input) {
14  case 0:
15  status = File::Status::OP_OK;
16  break;
17  // Fallthrough intended
18  case ENOSPC:
19  case EFBIG:
20  status = File::Status::NO_SPACE;
21  break;
22  case ENOENT:
23  status = File::Status::DOESNT_EXIST;
24  break;
25  // Fallthrough intended
26  case EPERM:
27  case EACCES:
29  break;
30  case EEXIST:
31  status = File::Status::FILE_EXISTS;
32  break;
33  case EBADF:
34  status = File::Status::NOT_OPENED;
35  break;
36  // Fallthrough intended
37  case ENOSYS:
38  case EOPNOTSUPP:
39  status = File::Status::NOT_SUPPORTED;
40  break;
41  case EINVAL:
42  status = File::Status::INVALID_ARGUMENT;
43  break;
44  default:
46  break;
47  }
48  return status;
49 }
50 
53  switch (posix_status) {
54  case 0:
55  status = Task::Status::OP_OK;
56  break;
57  case EINVAL:
58  status = Task::Status::INVALID_PARAMS;
59  break;
60  case EPERM:
61  status = Task::Status::ERROR_PERMISSION;
62  break;
63  case EAGAIN:
64  status = Task::Status::ERROR_RESOURCES;
65  break;
66  default:
67  status = Task::Status::UNKNOWN_ERROR;
68  break;
69  }
70  return status;
71 }
72 
73 }
74 }
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
@ OP_OK
Operation was successful.
Definition: FileSystem.hpp:15
@ NO_PERMISSION
No permission to write.
Definition: FileSystem.hpp:18
@ OTHER_ERROR
other OS-specific error
Definition: FileSystem.hpp:25
@ NO_SPACE
No space left.
Definition: FileSystem.hpp:17
File::Status errno_to_file_status(PlatformIntType errno_input)
Definition: error.cpp:11
Task::Status posix_status_to_task_status(PlatformIntType posix_status)
Definition: error.cpp:51