8 #include "sys/list_head.h"
12 #define WNOHANG 0x00000001
15 #define WUNTRACED 0x00000002
18 #define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status))
22 #define WIFSTOPPED(status) (((status)&0xff) == 0x7f)
28 #define WEXITSTATUS(status) (((status)&0xff00) >> 8)
32 #define WTERMSIG(status) ((status)&0x7f)
34 #define WIFEXITED(status) (WTERMSIG(status) == 0)
37 #define WSTOPSIG(status) (WEXITSTATUS(status))
40 #define TASK_RUNNING 0x00
41 #define TASK_INTERRUPTIBLE (1 << 0)
42 #define TASK_UNINTERRUPTIBLE (1 << 1)
43 #define TASK_STOPPED (1 << 2)
44 #define TASK_TRACED (1 << 3)
45 #define EXIT_ZOMBIE (1 << 4)
46 #define EXIT_DEAD (1 << 5)
54 #define WQ_FLAG_EXCLUSIVE 0x01
pid_t wait(int *status)
Suspends the execution of the calling thread until ANY child has changed state.
Definition: waitpid.c:35
struct wait_queue_head_t wait_queue_head_t
Head of the waiting queue.
wait_queue_entry_t * sleep_on(wait_queue_head_t *wq)
Sets the state of the current process to TASK_UNINTERRUPTIBLE and inserts it into the specified wait ...
Definition: scheduler.c:241
int default_wake_function(wait_queue_entry_t *wait, unsigned mode, int sync)
The default wake function, a wrapper for try_to_wake_up.
Definition: scheduler.c:235
void add_wait_queue(wait_queue_head_t *head, wait_queue_entry_t *wq)
Adds the element to the waiting queue.
Definition: wait.c:66
wait_queue_entry_t * wait_queue_entry_alloc(void)
Allocates the memory for a wait_queue_entry.
Definition: wait.c:33
struct wait_queue_entry_t wait_queue_entry_t
Entry of the waiting queue.
void init_waitqueue_entry(wait_queue_entry_t *wq, struct task_struct *task)
Initialize the waiting queue entry.
Definition: wait.c:59
void remove_wait_queue(wait_queue_head_t *head, wait_queue_entry_t *wq)
Removes the element from the waiting queue.
Definition: wait.c:74
void wait_queue_entry_dealloc(wait_queue_entry_t *wait_queue_entry)
Frees the memory of a wait_queue_entry.
Definition: wait.c:51
atomic_t spinlock_t
Spinlock structure.
Definition: spinlock.h:16
this is our task object. Every process in the system has this, and it holds a lot of information....
Definition: process.h:82
Entry of the waiting queue.
Definition: wait.h:71
struct task_struct * task
Task associated with the wait queue entry.
Definition: wait.h:75
int(* func)(struct wait_queue_entry_t *wait, unsigned mode, int sync)
Function associated with the wait queue entry.
Definition: wait.h:77
unsigned int flags
Flags of the type WaitQueueFlags.
Definition: wait.h:73
struct list_head task_list
Handler for placing the entry inside a waiting queue double linked-list.
Definition: wait.h:79
Head of the waiting queue.
Definition: wait.h:63
struct list_head task_list
Head of the waiting queue, it contains wait_queue_entry_t elements.
Definition: wait.h:67
spinlock_t lock
Locking element for the waiting queque.
Definition: wait.h:65