timerfd: update flags decoding master
authorMike Frysinger <vapier@gentoo.org>
Wed, 31 Dec 2014 00:08:50 +0000 (19:08 -0500)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 31 Dec 2014 00:27:57 +0000 (00:27 +0000)
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
xlat/timerfdflags.in

diff --git a/time.c b/time.c
index 31f0846ee316c9fd486ac01ef30ef682700b800f..b61a74e968831ba1defa41e055784b0b9a85317e 100644 (file)
--- a/time.c
+++ b/time.c
@@ -28,6 +28,7 @@
  */
 
 #include "defs.h"
+#include <fcntl.h>
 #include <linux/version.h>
 #include <sys/timex.h>
 #include <linux/ioctl.h>
@@ -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
index cfd506d77aabfd485d2eaf55469ada5a5be1b58e..e4e2b104f427dca6b1cba43bd35cd3a6223389d4 100644 (file)
@@ -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