@@ -311,6 +311,15 @@
/* Define to 1 if <sys/user.h> defines struct user_regs_struct */
/* #undef HAVE_SYS_USER_REGS */
+/* Define to 1 if you have the `timerfd_create' function. */
+#define HAVE_TIMERFD_CREATE 1
+
+/* Define to 1 if you have the `timerfd_gettime' function. */
+#define HAVE_TIMERFD_GETTIME 1
+
+/* Define to 1 if you have the `timerfd_settime' function. */
+#define HAVE_TIMERFD_SETTIME 1
+
/* can use __thread to define thread-local variables */
#define HAVE_TLS 1
@@ -310,6 +310,15 @@
/* Define to 1 if <sys/user.h> defines struct user_regs_struct */
#undef HAVE_SYS_USER_REGS
+/* Define to 1 if you have the `timerfd_create' function. */
+#undef HAVE_TIMERFD_CREATE
+
+/* Define to 1 if you have the `timerfd_gettime' function. */
+#undef HAVE_TIMERFD_GETTIME
+
+/* Define to 1 if you have the `timerfd_settime' function. */
+#undef HAVE_TIMERFD_SETTIME
+
/* can use __thread to define thread-local variables */
#undef HAVE_TLS
@@ -14681,6 +14681,9 @@ for ac_func in \
strrchr \
strstr \
syscall \
+ timerfd_create \
+ timerfd_gettime \
+ timerfd_settime \
utimensat \
process_vm_readv \
process_vm_writev \
@@ -4169,6 +4169,9 @@ AC_CHECK_FUNCS([ \
strrchr \
strstr \
syscall \
+ timerfd_create \
+ timerfd_gettime \
+ timerfd_settime \
utimensat \
process_vm_readv \
process_vm_writev \
@@ -54,7 +54,7 @@
* timerfd_* system call numbers introduced in 2.6.23. These constants are
* not yet in the glibc 2.7 headers, that is why they are defined here.
*/
-#ifndef __NR_timerfd_create
+#if !defined(__NR_timerfd_create) && !defined(HAVE_TIMERFD_CREATE)
#if defined(__x86_64__)
#define __NR_timerfd_create 283
#elif defined(__i386__)
@@ -68,7 +68,7 @@
#endif
#endif
-#ifndef __NR_timerfd_settime
+#if !defined(__NR_timerfd_settime) && !defined(HAVE_TIMERFD_SETTIME)
#if defined(__x86_64__)
#define __NR_timerfd_settime 286
#define __NR_timerfd_gettime 287
@@ -127,21 +127,27 @@ void set_timespec(struct timespec *tmr, unsigned long long ustime)
tmr->tv_nsec = (long) (1000ULL * (ustime % 1000000ULL));
}
+#if !defined(HAVE_TIMERFD_CREATE)
int timerfd_create(int clockid, int flags)
{
return syscall(__NR_timerfd_create, clockid, flags);
}
+#endif
+#if !defined(HAVE_TIMERFD_SETTIME)
int timerfd_settime(int ufc, int flags, const struct itimerspec *utmr,
struct itimerspec *otmr)
{
return syscall(__NR_timerfd_settime, ufc, flags, utmr, otmr);
}
+#endif
+#if !defined(HAVE_TIMERFD_GETTIME)
int timerfd_gettime(int ufc, struct itimerspec *otmr)
{
return syscall(__NR_timerfd_gettime, ufc, otmr);
}
+#endif
long waittmr(int tfd, int timeo)
{
modern libc provides these functions, moreover this also ensures that we are 64bit time_t safe. Fallback to existing definitions if libc does not have the implementation or syscall is not defined Signed-off-by: Khem Raj <raj.khem@gmail.com> --- config.h | 9 +++++++++ config.h.in | 9 +++++++++ configure | 3 +++ configure.ac | 3 +++ memcheck/tests/linux/timerfd-syscall.c | 10 ++++++++-- 5 files changed, 32 insertions(+), 2 deletions(-) -- 2.25.1 _______________________________________________ Valgrind-developers mailing list Valgrind-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-developers