diff options
Diffstat (limited to 'winsup/cygwin/timerfd.cc')
-rw-r--r-- | winsup/cygwin/timerfd.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/winsup/cygwin/timerfd.cc b/winsup/cygwin/timerfd.cc index 08fff312c..a03749a60 100644 --- a/winsup/cygwin/timerfd.cc +++ b/winsup/cygwin/timerfd.cc @@ -394,11 +394,18 @@ timerfd_tracker::close () InterlockedDecrement (&tfd_shared->instance_count); } -void -timerfd_tracker::ioctl_set_ticks (uint64_t exp_cnt) +int +timerfd_tracker::ioctl_set_ticks (uint64_t new_exp_cnt) { + LONG64 exp_cnt = (LONG64) new_exp_cnt; + if (exp_cnt == 0 || exp_cnt == -1LL) + return -EINVAL; + if (!enter_critical_section ()) + return -EBADF; set_expiration_count (exp_cnt); timer_expired (); + leave_critical_section (); + return 0; } void |