diff options
Diffstat (limited to 'src/include/errno.h')
-rw-r--r-- | src/include/errno.h | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/src/include/errno.h b/src/include/errno.h index 9e75d50fe..3817fd4bc 100644 --- a/src/include/errno.h +++ b/src/include/errno.h @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2016 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -27,9 +27,6 @@ #include <map> -// Map to to store strings of errorno codes -typedef std::map<int, const char*> ErrorNoNames; - #define ENOENT 2 // No such file or directory #define EIO 5 // I/O error #define ENXIO 6 // No such device or address @@ -46,27 +43,16 @@ typedef std::map<int, const char*> ErrorNoNames; #define EWOULDBLOCK EAGAIN // operation would block -// @Brief Initialize an ErrorNoNames map -// Note: All keys and values are preceded with a '-', this is because the -// the errno's will be set to 2's complement when there's an error. -inline ErrorNoNames init_map() -{ - ErrorNoNames l_map; - l_map[-ENOENT] = "-ENOENT"; - l_map[-EIO] = "-EIO"; - l_map[-ENXIO] = "-ENXIO"; - l_map[-ENOEXEC] = "-ENOEXEC"; - l_map[-EBADF] = "-EBADF"; - l_map[-EAGAIN] = "-EAGAIN"; - l_map[-EACCES] = "-EACCES"; - l_map[-EFAULT] = "-EFAULT"; - l_map[-EINVAL] = "-EINVAL"; - l_map[-ENFILE] = "-ENFILE"; - l_map[-EDEADLK] = "-EDEADLK"; - l_map[-ETIME] = "-ETIME"; - l_map[-EALREADY] = "-EALREADY"; - l_map[-EWOULDBLOCK] = "-EWOULDBLOCK"; - return l_map; -}; +/** + * @brief Returns string representation of an errno. + * + * @param[in] i_errno errno to get string for. + * + * @return const char* - If found, String associated with errno + * else, "UNKNOWN" string + * +*/ +const char * ErrnoToString( int i_errno ); + #endif |