From f1639d8f51cd609a43f5091f4cc3b31be4c63ec4 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 30 Dec 2014 19:08:50 -0500 Subject: [PATCH] timerfd: update flags decoding The current code only decodes TFD_TIMER_ABSTIME when the kernel has a bunch of newer flags. We have to handle fallbacks for all of them since the kernel doesn't currently export things to userspace. * time.c: Include fcntl.h for O_* defines. (TFD_TIMER_ABSTIME): Move to xlat/timerfdflags.in. * xlat/timerfdflags.in: Add more definitions. --- time.c | 5 +---- xlat/timerfdflags.in | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/time.c b/time.c index 31f0846e..b61a74e9 100644 --- a/time.c +++ b/time.c @@ -28,6 +28,7 @@ */ #include "defs.h" +#include #include #include #include @@ -809,10 +810,6 @@ rtc_ioctl(struct tcb *tcp, long code, long arg) return 1; } -#ifndef TFD_TIMER_ABSTIME -#define TFD_TIMER_ABSTIME (1 << 0) -#endif - #include "xlat/timerfdflags.h" int diff --git a/xlat/timerfdflags.in b/xlat/timerfdflags.in index cfd506d7..e4e2b104 100644 --- a/xlat/timerfdflags.in +++ b/xlat/timerfdflags.in @@ -1 +1,21 @@ +/* The Linux userspace headers didn't export these for a long time. */ + +#ifndef TFD_TIMER_ABSTIME +# define TFD_TIMER_ABSTIME (1 << 0) +#endif TFD_TIMER_ABSTIME + +#ifndef TFD_TIMER_CANCEL_ON_SET +# define TFD_TIMER_CANCEL_ON_SET (1 << 1) +#endif +TFD_TIMER_CANCEL_ON_SET + +#ifndef TFD_CLOEXEC +# define TFD_CLOEXEC O_CLOEXEC +#endif +TFD_CLOEXEC + +#ifndef TFD_NONBLOCK +# define TFD_NONBLOCK O_NONBLOCK +#endif +TFD_NONBLOCK -- 2.40.0