diff options
author | John M. Calandrino <jmc@jupiter-cs.cs.unc.edu> | 2007-04-18 11:28:06 -0400 |
---|---|---|
committer | John M. Calandrino <jmc@jupiter-cs.cs.unc.edu> | 2007-04-18 11:28:06 -0400 |
commit | 882253a1054313258d7209b60af0e9c2a1e5e80e (patch) | |
tree | 6b4fb5a061d0f1920b00e0efccd46ed657835110 /arch | |
parent | 4838ef57bb645fcf41c0a33b3c08ea97680e4307 (diff) |
Added priority inheritance within semaphores - compiles but has not been
tested.
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/pi_sem_syscalls.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/i386/kernel/pi_sem_syscalls.c b/arch/i386/kernel/pi_sem_syscalls.c index 3b196abba5..07c11fd327 100644 --- a/arch/i386/kernel/pi_sem_syscalls.c +++ b/arch/i386/kernel/pi_sem_syscalls.c | |||
@@ -8,8 +8,8 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <asm/atomic.h> | 10 | #include <asm/atomic.h> |
11 | #include <linux/sched.h> | ||
11 | #include <linux/wait.h> | 12 | #include <linux/wait.h> |
12 | #include <linux/rt_param.h> | ||
13 | 13 | ||
14 | asmlinkage long sys_pi_sema_init (struct pi_semaphore *sem) | 14 | asmlinkage long sys_pi_sema_init (struct pi_semaphore *sem) |
15 | { | 15 | { |
@@ -28,7 +28,6 @@ fastcall void __pi_up_wakeup(void /* special register calling convention */); | |||
28 | * "__down_failed" is a special asm handler that calls the C | 28 | * "__down_failed" is a special asm handler that calls the C |
29 | * routine that actually waits. See arch/i386/kernel/semaphore.c | 29 | * routine that actually waits. See arch/i386/kernel/semaphore.c |
30 | */ | 30 | */ |
31 | /* TODO: Update sem prio, if necessary, by modifying __down_failed? */ | ||
32 | asmlinkage long sys_pi_down(struct pi_semaphore * sem) | 31 | asmlinkage long sys_pi_down(struct pi_semaphore * sem) |
33 | { | 32 | { |
34 | might_sleep(); | 33 | might_sleep(); |
@@ -49,7 +48,6 @@ asmlinkage long sys_pi_down(struct pi_semaphore * sem) | |||
49 | * Note! This is subtle. We jump to wake people up only if | 48 | * Note! This is subtle. We jump to wake people up only if |
50 | * the semaphore was negative (== somebody was waiting on it). | 49 | * the semaphore was negative (== somebody was waiting on it). |
51 | */ | 50 | */ |
52 | /* TODO: add to __up_wakeup to update sem prio! */ | ||
53 | asmlinkage long sys_pi_up(struct pi_semaphore * sem) | 51 | asmlinkage long sys_pi_up(struct pi_semaphore * sem) |
54 | { | 52 | { |
55 | __asm__ __volatile__( | 53 | __asm__ __volatile__( |
@@ -65,15 +63,18 @@ asmlinkage long sys_pi_up(struct pi_semaphore * sem) | |||
65 | return 0; | 63 | return 0; |
66 | } | 64 | } |
67 | 65 | ||
66 | /* Clear wait queue and wakeup waiting tasks. */ | ||
68 | asmlinkage long sys_pi_sema_free_wq(struct pi_semaphore * sem) | 67 | asmlinkage long sys_pi_sema_free_wq(struct pi_semaphore * sem) |
69 | { | 68 | { |
70 | /* TODO: clear queue here... */ | ||
71 | struct list_head *tmp, *next; | 69 | struct list_head *tmp, *next; |
72 | unsigned long flags; | 70 | unsigned long flags; |
73 | 71 | ||
74 | spin_lock_irqsave(&sem->wait.lock, flags); | 72 | spin_lock_irqsave(&sem->wait.lock, flags); |
75 | list_for_each_safe(tmp, next, &sem->wait.task_list) | 73 | list_for_each_safe(tmp, next, &sem->wait.task_list) { |
74 | wait_queue_t *curr = list_entry(tmp, wait_queue_t, task_list); | ||
76 | list_del(tmp); | 75 | list_del(tmp); |
76 | curr->func(curr, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 0, NULL); | ||
77 | } | ||
77 | spin_unlock_irqrestore(&sem->wait.lock, flags); | 78 | spin_unlock_irqrestore(&sem->wait.lock, flags); |
78 | 79 | ||
79 | return 0; | 80 | return 0; |