[32] | 1 | /* $Id: waitqueue.c,v 1.1.1.1 2003/07/02 13:57:04 eleph Exp $ */
|
---|
| 2 | /*
|
---|
| 3 | * OS/2 implementation of Linux wait queue kernel services (stubs)
|
---|
| 4 | *
|
---|
| 5 | * (C) 2000-2002 InnoTek Systemberatung GmbH
|
---|
| 6 | * (C) 2000-2001 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
| 7 | *
|
---|
| 8 | * This program is free software; you can redistribute it and/or
|
---|
| 9 | * modify it under the terms of the GNU General Public License as
|
---|
| 10 | * published by the Free Software Foundation; either version 2 of
|
---|
| 11 | * the License, or (at your option) any later version.
|
---|
| 12 | *
|
---|
| 13 | * This program is distributed in the hope that it will be useful,
|
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 16 | * GNU General Public License for more details.
|
---|
| 17 | *
|
---|
| 18 | * You should have received a copy of the GNU General Public
|
---|
| 19 | * License along with this program; if not, write to the Free
|
---|
| 20 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
|
---|
| 21 | * USA.
|
---|
| 22 | *
|
---|
| 23 | */
|
---|
| 24 |
|
---|
| 25 | #include "linux.h"
|
---|
| 26 | #include <linux/init.h>
|
---|
| 27 | #include <linux/poll.h>
|
---|
| 28 | #include <asm/uaccess.h>
|
---|
| 29 | #include <asm/hardirq.h>
|
---|
| 30 | #include <dbgos2.h>
|
---|
| 31 |
|
---|
| 32 | //******************************************************************************
|
---|
| 33 | //******************************************************************************
|
---|
| 34 | void init_waitqueue_head(wait_queue_head_t *q)
|
---|
| 35 | {
|
---|
| 36 | // dprintf(("WARNING: init_waitqueue_head STUB"));
|
---|
| 37 | }
|
---|
| 38 | //******************************************************************************
|
---|
| 39 | //******************************************************************************
|
---|
[615] | 40 | void add_wait_queue(struct wait_queue_head *q, struct wait_queue_entry * wait)
|
---|
[32] | 41 | {
|
---|
| 42 | // dprintf3(("WARNING: add_wait_queue STUB"));
|
---|
| 43 | }
|
---|
| 44 | //******************************************************************************
|
---|
| 45 | //******************************************************************************
|
---|
[615] | 46 | void add_wait_queue_exclusive(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_entry)
|
---|
[32] | 47 | {
|
---|
| 48 | // dprintf3(("WARNING: add_wait_queue_exclusive STUB"));
|
---|
| 49 | }
|
---|
| 50 | //******************************************************************************
|
---|
| 51 | //******************************************************************************
|
---|
[615] | 52 | void remove_wait_queue(struct wait_queue_head *q, struct wait_queue_entry * wait)
|
---|
[32] | 53 | {
|
---|
| 54 | // dprintf(("WARNING: remove_wait_queue STUB"));
|
---|
| 55 | }
|
---|
| 56 | //******************************************************************************
|
---|
| 57 | //******************************************************************************
|
---|
| 58 | long interruptible_sleep_on_timeout(wait_queue_head_t *q, signed long timeout)
|
---|
| 59 | {
|
---|
| 60 | dprintf(("WARNING: interruptible_sleep_on_timeout STUB"));
|
---|
| 61 | return 1;
|
---|
| 62 | }
|
---|
| 63 | //******************************************************************************
|
---|
| 64 | //******************************************************************************
|
---|
| 65 | void interruptible_sleep_on(wait_queue_head_t *q)
|
---|
| 66 | {
|
---|
| 67 | dprintf(("WARNING: interruptible_sleep_on STUB"));
|
---|
| 68 | }
|
---|
| 69 | //******************************************************************************
|
---|
| 70 | //******************************************************************************
|
---|
| 71 | void __wake_up(wait_queue_head_t *q, unsigned int mode)
|
---|
| 72 | {
|
---|
| 73 | dprintf3(("WARNING: __wake_up STUB"));
|
---|
| 74 | }
|
---|
| 75 | //******************************************************************************
|
---|
| 76 | //******************************************************************************
|
---|
[615] | 77 | void init_waitqueue_entry(struct wait_queue_entry *wq_entry, struct task_struct *p)
|
---|
[32] | 78 | {
|
---|
| 79 | // dprintf(("WARNING: init_waitqueue_entry STUB"));
|
---|
| 80 | }
|
---|
| 81 | //******************************************************************************
|
---|
| 82 | //******************************************************************************
|
---|
| 83 | int waitqueue_active(wait_queue_head_t *q)
|
---|
| 84 | {
|
---|
| 85 | // dprintf(("WARNING: waitqueue_active STUB"));
|
---|
| 86 | return 0;
|
---|
| 87 | }
|
---|
| 88 | //******************************************************************************
|
---|
| 89 | //******************************************************************************
|
---|
[615] | 90 | /**
|
---|
| 91 | * complete: - signals a single thread waiting on this completion
|
---|
| 92 | * @x: holds the state of this particular completion
|
---|
| 93 | *
|
---|
| 94 | * This will wake up a single thread waiting on this completion. Threads will be
|
---|
| 95 | * awakened in the same order in which they were queued.
|
---|
| 96 | *
|
---|
| 97 | * See also complete_all(), wait_for_completion() and related routines.
|
---|
| 98 | *
|
---|
| 99 | * It may be assumed that this function implies a write memory barrier before
|
---|
| 100 | * changing the task state if and only if any tasks are woken up.
|
---|
| 101 | */
|
---|
| 102 | void complete(struct completion *x)
|
---|
| 103 | {
|
---|
| 104 | unsigned long flags;
|
---|
| 105 |
|
---|
| 106 | spin_lock_irqsave(&x->wait.lock, flags);
|
---|
| 107 | x->done++;
|
---|
| 108 | __wake_up_locked(&x->wait, TASK_NORMAL, 1);
|
---|
| 109 | spin_unlock_irqrestore(&x->wait.lock, flags);
|
---|
| 110 | }
|
---|
[625] | 111 | /**
|
---|
| 112 | * complete_all: - signals all threads waiting on this completion
|
---|
| 113 | * @x: holds the state of this particular completion
|
---|
| 114 | *
|
---|
| 115 | * This will wake up all threads waiting on this particular completion event.
|
---|
| 116 | *
|
---|
| 117 | * If this function wakes up a task, it executes a full memory barrier before
|
---|
| 118 | * accessing the task state.
|
---|
| 119 | *
|
---|
| 120 | * Since complete_all() sets the completion of @x permanently to done
|
---|
| 121 | * to allow multiple waiters to finish, a call to reinit_completion()
|
---|
| 122 | * must be used on @x if @x is to be used again. The code must make
|
---|
| 123 | * sure that all waiters have woken and finished before reinitializing
|
---|
| 124 | * @x. Also note that the function completion_done() can not be used
|
---|
| 125 | * to know if there are still waiters after complete_all() has been called.
|
---|
| 126 | */
|
---|
| 127 | void complete_all(struct completion *x)
|
---|
| 128 | {
|
---|
| 129 | unsigned long flags;
|
---|
| 130 |
|
---|
| 131 | spin_lock_irqsave(&x->wait.lock, flags);
|
---|
| 132 | __wake_up_locked(&x->wait, TASK_NORMAL, 1);
|
---|
| 133 | spin_unlock_irqrestore(&x->wait.lock, flags);
|
---|
| 134 | }
|
---|
[615] | 135 | //******************************************************************************
|
---|
| 136 | //******************************************************************************
|
---|
| 137 | void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr)
|
---|
| 138 | {
|
---|
| 139 | dprintf3(("WARNING: __wake_up_locked STUB"));
|
---|
| 140 | }
|
---|
[625] | 141 | //******************************************************************************
|
---|
| 142 | //******************************************************************************
|
---|
| 143 | /**
|
---|
| 144 | * wait_for_completion: - waits for completion of a task
|
---|
| 145 | * @x: holds the state of this particular completion
|
---|
| 146 | *
|
---|
| 147 | * This waits to be signaled for completion of a specific task. It is NOT
|
---|
| 148 | * interruptible and there is no timeout.
|
---|
| 149 | *
|
---|
| 150 | * See also similar routines (i.e. wait_for_completion_timeout()) with timeout
|
---|
| 151 | * and interrupt capability. Also see complete().
|
---|
| 152 | */
|
---|
| 153 | void wait_for_completion(struct completion *x)
|
---|
| 154 | {
|
---|
| 155 | dprintf3(("WARNING: wait_for_completion STUB"));
|
---|
| 156 | }
|
---|
| 157 |
|
---|
| 158 |
|
---|
| 159 | /**
|
---|
| 160 | * wait_for_completion_timeout: - waits for completion of a task (w/timeout)
|
---|
| 161 | * @x: holds the state of this particular completion
|
---|
| 162 | * @timeout: timeout value in jiffies
|
---|
| 163 | *
|
---|
| 164 | * This waits for either a completion of a specific task to be signaled or for a
|
---|
| 165 | * specified timeout to expire. The timeout is in jiffies. It is not
|
---|
| 166 | * interruptible.
|
---|
| 167 | *
|
---|
| 168 | * Return: 0 if timed out, and positive (at least 1, or number of jiffies left
|
---|
| 169 | * till timeout) if completed.
|
---|
| 170 | */
|
---|
| 171 | unsigned long wait_for_completion_timeout(struct completion *x, unsigned long timeout)
|
---|
| 172 | {
|
---|
| 173 | dprintf3(("WARNING: wait_for_completion_timeout STUB"));
|
---|
| 174 | return 1;
|
---|
| 175 | }
|
---|