patch-2.3.1 linux/include/linux/sched.h
Next file: linux/include/linux/sem.h
Previous file: linux/include/linux/rtnetlink.h
Back to the patch index
Back to the overall index
- Lines: 150
- Date:
Thu May 13 14:42:16 1999
- Orig file:
v2.3.0/linux/include/linux/sched.h
- Orig date:
Tue May 11 13:04:01 1999
diff -u --recursive --new-file v2.3.0/linux/include/linux/sched.h linux/include/linux/sched.h
@@ -79,6 +79,7 @@
#define TASK_ZOMBIE 4
#define TASK_STOPPED 8
#define TASK_SWAPPING 16
+#define TASK_EXCLUSIVE 32
/*
* Scheduling policies
@@ -184,11 +185,11 @@
void * segments;
};
-#define INIT_MM { \
+#define INIT_MM(name) { \
&init_mmap, NULL, NULL, \
swapper_pg_dir, \
ATOMIC_INIT(1), 1, \
- MUTEX, \
+ __MUTEX_INITIALIZER(name.mmap_sem), \
0, \
0, 0, 0, 0, \
0, 0, 0, \
@@ -267,7 +268,7 @@
/* Pointer to task[] array linkage. */
struct task_struct **tarray_ptr;
- struct wait_queue *wait_chldexit; /* for wait4() */
+ wait_queue_head_t wait_chldexit; /* for wait4() */
struct semaphore *vfork_sem; /* for vfork() */
unsigned long policy, rt_priority;
unsigned long it_real_value, it_prof_value, it_virt_value;
@@ -345,7 +346,7 @@
* INIT_TASK is used to set up the first task table, touch at
* your own risk!. Base=0, limit=0x1fffff (=2MB)
*/
-#define INIT_TASK \
+#define INIT_TASK(name) \
/* state etc */ { 0,0,0,KERNEL_DS,&default_exec_domain,0, \
/* counter */ DEF_PRIORITY,DEF_PRIORITY,0, \
/* SMP */ 0,0,0,-1, \
@@ -356,7 +357,7 @@
/* proc links*/ &init_task,&init_task,NULL,NULL,NULL, \
/* pidhash */ NULL, NULL, \
/* tarray */ &task[0], \
-/* chld wait */ NULL, NULL, \
+/* chld wait */ __WAIT_QUEUE_HEAD_INITIALIZER(name.wait_chldexit), NULL, \
/* timeout */ SCHED_OTHER,0,0,0,0,0,0,0, \
/* timer */ { NULL, NULL, 0, 0, it_real_fn }, \
/* utime */ {0,0,0,0},0, \
@@ -464,12 +465,12 @@
#define CURRENT_TIME (xtime.tv_sec)
-extern void FASTCALL(__wake_up(struct wait_queue ** p, unsigned int mode));
-extern void FASTCALL(sleep_on(struct wait_queue ** p));
-extern long FASTCALL(sleep_on_timeout(struct wait_queue ** p,
+extern void FASTCALL(__wake_up(wait_queue_head_t *q, unsigned int mode));
+extern void FASTCALL(sleep_on(wait_queue_head_t *q));
+extern long FASTCALL(sleep_on_timeout(wait_queue_head_t *q,
signed long timeout));
-extern void FASTCALL(interruptible_sleep_on(struct wait_queue ** p));
-extern long FASTCALL(interruptible_sleep_on_timeout(struct wait_queue ** p,
+extern void FASTCALL(interruptible_sleep_on(wait_queue_head_t *q));
+extern long FASTCALL(interruptible_sleep_on_timeout(wait_queue_head_t *q,
signed long timeout));
extern void FASTCALL(wake_up_process(struct task_struct * tsk));
@@ -630,54 +631,39 @@
extern int do_execve(char *, char **, char **, struct pt_regs *);
extern int do_fork(unsigned long, unsigned long, struct pt_regs *);
-/*
- * The wait-queues are circular lists, and you have to be *very* sure
- * to keep them correct. Use only these two functions to add/remove
- * entries in the queues.
- */
-extern inline void __add_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
-{
- wait->next = *p ? : WAIT_QUEUE_HEAD(p);
- *p = wait;
-}
-
-extern rwlock_t waitqueue_lock;
-
-extern inline void add_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
+extern inline void add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)
{
unsigned long flags;
- write_lock_irqsave(&waitqueue_lock, flags);
- __add_wait_queue(p, wait);
- write_unlock_irqrestore(&waitqueue_lock, flags);
+ wq_write_lock_irqsave(&q->lock, flags);
+ __add_wait_queue(q, wait);
+ wq_write_unlock_irqrestore(&q->lock, flags);
}
-extern inline void __remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
+extern inline void add_wait_queue_exclusive(wait_queue_head_t *q,
+ wait_queue_t * wait)
{
- struct wait_queue * next = wait->next;
- struct wait_queue * head = next;
- struct wait_queue * tmp;
+ unsigned long flags;
- while ((tmp = head->next) != wait) {
- head = tmp;
- }
- head->next = next;
+ wq_write_lock_irqsave(&q->lock, flags);
+ __add_wait_queue_tail(q, wait);
+ wq_write_unlock_irqrestore(&q->lock, flags);
}
-extern inline void remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
+extern inline void remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)
{
unsigned long flags;
- write_lock_irqsave(&waitqueue_lock, flags);
- __remove_wait_queue(p, wait);
- write_unlock_irqrestore(&waitqueue_lock, flags);
+ wq_write_lock_irqsave(&q->lock, flags);
+ __remove_wait_queue(q, wait);
+ wq_write_unlock_irqrestore(&q->lock, flags);
}
#define __wait_event(wq, condition) \
do { \
- struct wait_queue __wait; \
+ wait_queue_t __wait; \
+ init_waitqueue_entry(&__wait, current); \
\
- __wait.task = current; \
add_wait_queue(&wq, &__wait); \
for (;;) { \
current->state = TASK_UNINTERRUPTIBLE; \
@@ -698,9 +684,9 @@
#define __wait_event_interruptible(wq, condition, ret) \
do { \
- struct wait_queue __wait; \
+ wait_queue_t __wait; \
+ init_waitqueue_entry(&__wait, current); \
\
- __wait.task = current; \
add_wait_queue(&wq, &__wait); \
for (;;) { \
current->state = TASK_INTERRUPTIBLE; \
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)