• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) International Business Machines  Corp., 2007
4  * Copyright (c) 2014 Fujitsu Ltd.
5  */
6 
7 #ifndef LAPI_TIMERFD_H__
8 #define LAPI_TIMERFD_H__
9 
10 #include <time.h>
11 #include "config.h"
12 #include "lapi/syscalls.h"
13 
14 #ifdef HAVE_SYS_TIMERFD_H
15 #include <sys/timerfd.h>
16 #endif
17 
18 #if !defined(HAVE_TIMERFD_CREATE)
timerfd_create(int clockid,int flags)19 static inline int timerfd_create(int clockid, int flags)
20 {
21 	return ltp_syscall(__NR_timerfd_create, clockid, flags);
22 }
23 #endif
24 
25 #if !defined(HAVE_TIMERFD_GETTIME)
timerfd_settime(int fd,int flags,const struct itimerspec * new_value,struct itimerspec * old_value)26 static inline int timerfd_settime(int fd, int flags,
27                                   const struct itimerspec *new_value,
28                                   struct itimerspec *old_value)
29 {
30 	return ltp_syscall(__NR_timerfd_settime, fd, flags, new_value,
31 			   old_value);
32 }
33 #endif
34 
35 #if !defined(HAVE_TIMERFD_SETTIME)
timerfd_gettime(int fd,struct itimerspec * curr_value)36 static inline int timerfd_gettime(int fd, struct itimerspec *curr_value)
37 {
38 	return ltp_syscall(__NR_timerfd_gettime, fd, curr_value);
39 }
40 #endif
41 
42 #endif /* LAPI_TIMERFD_H__ */
43