1 #define FSCK_ERROR_BIT 29
3 * This bit indicates whether a number is considered a system error number
4 * If yes, the system errno is just the result of clearing this bit from
7 #define SYSTEM_ERROR_BIT 30
9 /** Check whether the system error bit is set. */
10 #define IS_SYSTEM_ERROR(num) (!!((num) & (1 << SYSTEM_ERROR_BIT)))
12 /** Set the system error bit for the given number. */
13 #define ERRNO_TO_ERROR(num) ((num) | (1 << SYSTEM_ERROR_BIT))
16 * Check whether a given number is a system error number.
18 * \param num The value to be checked.
19 * \param _errno The system error number.
21 * \return True if \a num is the representation of the system
22 * error identified by \a _errno.
24 static inline int is_errno(int num, int _errno)
26 assert(num > 0 && _errno > 0);
27 return ERRNO_TO_ERROR(_errno) == num;