From e5be942c842fc22c1c752da6ec68a45d91f37c0e Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sun, 14 Oct 2001 23:33:38 +0000 Subject: 2001-10-14 Marcus Brinkmann * glue-include/linux/sched.h (process_schedule_timeout): New function used as timer callback for schedule_timeout. (schedule_timeout): Implement it. --- pfinet/ChangeLog | 6 ++++++ pfinet/glue-include/linux/sched.h | 31 +++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/pfinet/ChangeLog b/pfinet/ChangeLog index 279ab1d6..d1601f26 100644 --- a/pfinet/ChangeLog +++ b/pfinet/ChangeLog @@ -1,3 +1,9 @@ +2001-10-14 Marcus Brinkmann + + * glue-include/linux/sched.h (process_schedule_timeout): New + function used as timer callback for schedule_timeout. + (schedule_timeout): Implement it. + 2001-07-25 Mark Kettenis * glue-include/linux/socket.h (SOMAXCONN): Only define if it diff --git a/pfinet/glue-include/linux/sched.h b/pfinet/glue-include/linux/sched.h index 897a2df0..f57de2c3 100644 --- a/pfinet/glue-include/linux/sched.h +++ b/pfinet/glue-include/linux/sched.h @@ -149,11 +149,38 @@ schedule (void) interruptible_sleep_on (current->next_wait); } +static inline void +process_schedule_timeout (unsigned long data) +{ + struct wait_queue **sleep = (struct wait_queue **) data; + + wake_up_interruptible (sleep); +} + static inline long schedule_timeout (long timeout) { - /* XXX this is only ever called to do SO_LINGER, which we don't support */ - assert (!"schedule_timeout"); + long expire = timeout + jiffies; + struct timer_list timer; + struct wait_queue *sleep = 0; /* See comment in wait.h why this suffices. */ + + init_timer (&timer); + timer.expires = expire; + timer.data = (unsigned long) &sleep; + timer.function = process_schedule_timeout; + add_timer (&timer); + + interruptible_sleep_on (&sleep); + if (signal_pending (current)) + { + /* We were canceled. */ + del_timer (&timer); + expire -= jiffies; + if (expire >= 0) + return expire; + else + return 0; + } return 0; } -- cgit v1.2.3