2 * This bit indicates whether a number is considered a system error number
3 * If yes, the system errno is just the result of clearing this bit from
6 #define SYSTEM_ERROR_BIT 30
8 /** Check whether the system error bit is set. */
9 #define IS_SYSTEM_ERROR(num) (!!((num) & (1 << SYSTEM_ERROR_BIT)))
11 /** Set the system error bit for the given number. */
12 #define ERRNO_TO_ERROR(num) ((num) | (1 << SYSTEM_ERROR_BIT))
15 * Check whether a given number is a system error number.
17 * \param num The value to be checked.
18 * \param _errno The system error number.
20 * \return True if \a num is the representation of the system
21 * error identified by \a _errno.
23 static inline int is_errno(int num, int _errno)
25 assert(num > 0 && _errno > 0);
26 return ERRNO_TO_ERROR(_errno) == num;