Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2019-01-21 14:41:00 +0300
committerCorinna Vinschen <corinna@vinschen.de>2019-01-21 14:41:00 +0300
commit289b7c09c8bca6c84edfddf77c11b530bda95016 (patch)
tree17932274a165a43a9193282faf171463253236bf /winsup/cygwin/timerfd.cc
parent528f4d49384e1c3ad95d3a6913bf681ef714d51f (diff)
Cygwin: timerfd: move ioctl error handling into timerfd_tracker
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/timerfd.cc')
-rw-r--r--winsup/cygwin/timerfd.cc11
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