xref: /haiku/headers/private/shared/syscall_utils.h (revision 7e8cb518e98937dad5b0ffb53829e596d8a71fde)
1 /*
2  * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _SYSCALL_UTILS_H
6 #define _SYSCALL_UTILS_H
7 
8 #define RETURN_AND_SET_ERRNO(err)			\
9 	do {									\
10 		__typeof(err) raseResult = (err);	\
11 		if (raseResult < 0) {				\
12 			errno = raseResult;				\
13 			return -1;						\
14 		}									\
15 		return raseResult;					\
16 	} while (false)
17 
18 #endif	// _SYSCALL_UTILS_H
19