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