1*49cdfc7eSAndroid Build Coastguard Worker // SPDX-License-Identifier: GPL-2.0-or-later 2*49cdfc7eSAndroid Build Coastguard Worker /* 3*49cdfc7eSAndroid Build Coastguard Worker * Copyright (c) 2020 Petr Vorel <[email protected]> 4*49cdfc7eSAndroid Build Coastguard Worker */ 5*49cdfc7eSAndroid Build Coastguard Worker 6*49cdfc7eSAndroid Build Coastguard Worker #ifndef TST_SAFE_TIMERFD_H__ 7*49cdfc7eSAndroid Build Coastguard Worker #define TST_SAFE_TIMERFD_H__ 8*49cdfc7eSAndroid Build Coastguard Worker 9*49cdfc7eSAndroid Build Coastguard Worker #include "lapi/timerfd.h" 10*49cdfc7eSAndroid Build Coastguard Worker 11*49cdfc7eSAndroid Build Coastguard Worker int safe_timerfd_create(const char *file, const int lineno, 12*49cdfc7eSAndroid Build Coastguard Worker int clockid, int flags); 13*49cdfc7eSAndroid Build Coastguard Worker 14*49cdfc7eSAndroid Build Coastguard Worker #define SAFE_TIMERFD_CREATE(clockid, flags)\ 15*49cdfc7eSAndroid Build Coastguard Worker safe_timerfd_create(__FILE__, __LINE__, (clockid), (flags)) 16*49cdfc7eSAndroid Build Coastguard Worker 17*49cdfc7eSAndroid Build Coastguard Worker int safe_timerfd_gettime(const char *file, const int lineno, 18*49cdfc7eSAndroid Build Coastguard Worker int fd, struct itimerspec *curr_value); 19*49cdfc7eSAndroid Build Coastguard Worker 20*49cdfc7eSAndroid Build Coastguard Worker #define SAFE_TIMERFD_GETTIME(fd, curr_value)\ 21*49cdfc7eSAndroid Build Coastguard Worker safe_timerfd_gettime(__FILE__, __LINE__, (fd), (curr_value)) 22*49cdfc7eSAndroid Build Coastguard Worker 23*49cdfc7eSAndroid Build Coastguard Worker int safe_timerfd_settime(const char *file, const int lineno, 24*49cdfc7eSAndroid Build Coastguard Worker int fd, int flags, 25*49cdfc7eSAndroid Build Coastguard Worker const struct itimerspec *new_value, 26*49cdfc7eSAndroid Build Coastguard Worker struct itimerspec *old_value); 27*49cdfc7eSAndroid Build Coastguard Worker 28*49cdfc7eSAndroid Build Coastguard Worker #define SAFE_TIMERFD_SETTIME(fd, flags, new_value, old_value)\ 29*49cdfc7eSAndroid Build Coastguard Worker safe_timerfd_settime(__FILE__, __LINE__, (fd), (flags), (new_value), \ 30*49cdfc7eSAndroid Build Coastguard Worker (old_value)) 31*49cdfc7eSAndroid Build Coastguard Worker 32*49cdfc7eSAndroid Build Coastguard Worker #endif /* SAFE_TIMERFD_H__ */ 33