summaryrefslogtreecommitdiff
path: root/pfinet
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2001-10-14 23:33:38 +0000
committerMarcus Brinkmann <marcus@gnu.org>2001-10-14 23:33:38 +0000
commite5be942c842fc22c1c752da6ec68a45d91f37c0e (patch)
treef07642ffb6ccbe69904e08faa75fbee67aac292d /pfinet
parent2b89b8557c47d496587edb991bfad1c268e7959d (diff)
2001-10-14 Marcus Brinkmann <marcus@gnu.org>
* glue-include/linux/sched.h (process_schedule_timeout): New function used as timer callback for schedule_timeout. (schedule_timeout): Implement it.
Diffstat (limited to 'pfinet')
-rw-r--r--pfinet/ChangeLog6
-rw-r--r--pfinet/glue-include/linux/sched.h31
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 <marcus@gnu.org>
+
+ * 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 <kettenis@gnu.org>
* 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;
}