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.
This commit is contained in:
Mike Frysinger 2014-12-30 19:08:50 -05:00 committed by Dmitry V. Levin
parent e00a9571d4
commit f1639d8f51
2 changed files with 21 additions and 4 deletions

5
time.c
View File

@ -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

View 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