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