Do not specify LDLAGS twice.
[osl.git] / error.h
1 /**
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
4 * the given number.
5 */
6 #define SYSTEM_ERROR_BIT 30
7
8 /** Check whether the system error bit is set. */
9 #define IS_SYSTEM_ERROR(num) (!!((num) & (1 << SYSTEM_ERROR_BIT)))
10
11 /** Set the system error bit for the given number. */
12 #define ERRNO_TO_ERROR(num) ((num) | (1 << SYSTEM_ERROR_BIT))
13
14 /**
15 * Check whether a given number is a system error number.
16 *
17 * \param num The value to be checked.
18 * \param _errno The system error number.
19 *
20 * \return True if \a num is the representation of the system
21 * error identified by \a _errno.
22 */
23 static inline int is_errno(int num, int _errno)
24 {
25 assert(num > 0 && _errno > 0);
26 return ERRNO_TO_ERROR(_errno) == num;
27 }