2023-01-08 14:29:30 +00:00
|
|
|
/* bits/errno-return.h: A convenient way of setting errno after a syscall. */
|
2023-01-07 10:21:53 +00:00
|
|
|
|
2023-01-06 16:35:07 +00:00
|
|
|
#ifndef _BITS_ERRNO_RETURN_H
|
|
|
|
#define _BITS_ERRNO_RETURN_H
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
#define __errno_return(value, type) \
|
|
|
|
do { \
|
|
|
|
if (value < 0) \
|
|
|
|
{ \
|
|
|
|
errno = (int)(-value); \
|
|
|
|
return (type)-1; \
|
|
|
|
} \
|
|
|
|
return (type)value; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#endif
|