justincormack / ljsyscall

LuaJIT Unix syscall FFI
http://www.myriabit.com/ljsyscall/
Other
440 stars 54 forks source link

Add TFD_TIMER_CANCEL_ON_SET constant #181

Closed daurnimator closed 9 years ago

daurnimator commented 9 years ago

Available since linux 3.0 (22 Jul 2011)

The timerfd_settime() system call adds a TFD_TIMER_CANCEL_ON_SET flag. If this flag is set for a CLOCK_REALTIME absolute (TFD_TIMER_ABSTIME) timer, then the timer is expired if the clock is reset.

cqueues = require"cqueues";
S=require"syscall";
fd=S.timerfd_create("realtime", "cloexec,nonblock");
assert(fd:timerfd_settime(3));
print("Waiting for settimeofday");
cqueues.sleep({pollfd=fd:getfd(), events="r"})
print("Clock changed!")
daurnimator commented 9 years ago

Wrong place! You already had ABSTIME bound: https://github.com/justincormack/ljsyscall/blob/f364b0cfc243f0b3427a52029689c832bb49f72f/syscall/linux/constants.lua#L733

daurnimator commented 9 years ago

:+1: