I've written the function to wrap an errno, but I have compile error: error: ‘EACCES’ undeclared (first use in this function) case EACCES: What I'm doing wrong? How can I wrap the errno with switch-case? status_t defined as enum of relevant errors.
static status_t GetErrorStatus (int errno_value) { status_t err_status = COMMON_ERROR; switch (errno_value) { case EACCES: err_status = NO_ACCESS_PERMISSION; break; case EPERM: err_status = NO_ACCESS_PERMISSION; break; case EIDRM: err_status = SEMAPHORE_REMOVED; break; case ENOENT: err_status = FILE_DOESNT_EXIST; break; case EEXIST: err_status = SEMAPHORE_ALREADY_EXISTS; break; default: err_status = COMMON_ERROR; } return (err_status); }
errnovalues to what looks like an enum or another set of macros representing integral values?EACCES, EPERMintoNO_ACCESS_PERMISSIONand allowing a desired sequent index or bit mask of error identifiers.