diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/capability.c | 8 | ||||
-rw-r--r-- | kernel/cpuset.c | 4 | ||||
-rw-r--r-- | kernel/exit.c | 64 | ||||
-rw-r--r-- | kernel/fork.c | 2 | ||||
-rw-r--r-- | kernel/irq/manage.c | 35 | ||||
-rw-r--r-- | kernel/sched.c | 8 | ||||
-rw-r--r-- | kernel/signal.c | 41 | ||||
-rw-r--r-- | kernel/sys.c | 41 |
8 files changed, 114 insertions, 89 deletions
diff --git a/kernel/capability.c b/kernel/capability.c index edb845a6e8..c8d3c77620 100644 --- a/kernel/capability.c +++ b/kernel/capability.c | |||
@@ -92,15 +92,17 @@ out: | |||
92 | * cap_set_pg - set capabilities for all processes in a given process | 92 | * cap_set_pg - set capabilities for all processes in a given process |
93 | * group. We call this holding task_capability_lock and tasklist_lock. | 93 | * group. We call this holding task_capability_lock and tasklist_lock. |
94 | */ | 94 | */ |
95 | static inline int cap_set_pg(int pgrp, kernel_cap_t *effective, | 95 | static inline int cap_set_pg(int pgrp_nr, kernel_cap_t *effective, |
96 | kernel_cap_t *inheritable, | 96 | kernel_cap_t *inheritable, |
97 | kernel_cap_t *permitted) | 97 | kernel_cap_t *permitted) |
98 | { | 98 | { |
99 | struct task_struct *g, *target; | 99 | struct task_struct *g, *target; |
100 | int ret = -EPERM; | 100 | int ret = -EPERM; |
101 | int found = 0; | 101 | int found = 0; |
102 | struct pid *pgrp; | ||
102 | 103 | ||
103 | do_each_task_pid(pgrp, PIDTYPE_PGID, g) { | 104 | pgrp = find_pid(pgrp_nr); |
105 | do_each_pid_task(pgrp, PIDTYPE_PGID, g) { | ||
104 | target = g; | 106 | target = g; |
105 | while_each_thread(g, target) { | 107 | while_each_thread(g, target) { |
106 | if (!security_capset_check(target, effective, | 108 | if (!security_capset_check(target, effective, |
@@ -113,7 +115,7 @@ static inline int cap_set_pg(int pgrp, kernel_cap_t *effective, | |||
113 | } | 115 | } |
114 | found = 1; | 116 | found = 1; |
115 | } | 117 | } |
116 | } while_each_task_pid(pgrp, PIDTYPE_PGID, g); | 118 | } while_each_pid_task(pgrp, PIDTYPE_PGID, g); |
117 | 119 | ||
118 | if (!found) | 120 | if (!found) |
119 | ret = 0; | 121 | ret = 0; |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 6b05dc69c9..f382b0f775 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1540,7 +1540,7 @@ static const struct file_operations cpuset_file_operations = { | |||
1540 | .release = cpuset_file_release, | 1540 | .release = cpuset_file_release, |
1541 | }; | 1541 | }; |
1542 | 1542 | ||
1543 | static struct inode_operations cpuset_dir_inode_operations = { | 1543 | static const struct inode_operations cpuset_dir_inode_operations = { |
1544 | .lookup = simple_lookup, | 1544 | .lookup = simple_lookup, |
1545 | .mkdir = cpuset_mkdir, | 1545 | .mkdir = cpuset_mkdir, |
1546 | .rmdir = cpuset_rmdir, | 1546 | .rmdir = cpuset_rmdir, |
@@ -2656,7 +2656,7 @@ static int cpuset_open(struct inode *inode, struct file *file) | |||
2656 | return single_open(file, proc_cpuset_show, pid); | 2656 | return single_open(file, proc_cpuset_show, pid); |
2657 | } | 2657 | } |
2658 | 2658 | ||
2659 | struct file_operations proc_cpuset_operations = { | 2659 | const struct file_operations proc_cpuset_operations = { |
2660 | .open = cpuset_open, | 2660 | .open = cpuset_open, |
2661 | .read = seq_read, | 2661 | .read = seq_read, |
2662 | .llseek = seq_lseek, | 2662 | .llseek = seq_lseek, |
diff --git a/kernel/exit.c b/kernel/exit.c index bc71fdfcd8..f132349c03 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -185,21 +185,19 @@ repeat: | |||
185 | * This checks not only the pgrp, but falls back on the pid if no | 185 | * This checks not only the pgrp, but falls back on the pid if no |
186 | * satisfactory pgrp is found. I dunno - gdb doesn't work correctly | 186 | * satisfactory pgrp is found. I dunno - gdb doesn't work correctly |
187 | * without this... | 187 | * without this... |
188 | * | ||
189 | * The caller must hold rcu lock or the tasklist lock. | ||
188 | */ | 190 | */ |
189 | int session_of_pgrp(int pgrp) | 191 | struct pid *session_of_pgrp(struct pid *pgrp) |
190 | { | 192 | { |
191 | struct task_struct *p; | 193 | struct task_struct *p; |
192 | int sid = 0; | 194 | struct pid *sid = NULL; |
193 | |||
194 | read_lock(&tasklist_lock); | ||
195 | 195 | ||
196 | p = find_task_by_pid_type(PIDTYPE_PGID, pgrp); | 196 | p = pid_task(pgrp, PIDTYPE_PGID); |
197 | if (p == NULL) | 197 | if (p == NULL) |
198 | p = find_task_by_pid(pgrp); | 198 | p = pid_task(pgrp, PIDTYPE_PID); |
199 | if (p != NULL) | 199 | if (p != NULL) |
200 | sid = process_session(p); | 200 | sid = task_session(p); |
201 | |||
202 | read_unlock(&tasklist_lock); | ||
203 | 201 | ||
204 | return sid; | 202 | return sid; |
205 | } | 203 | } |
@@ -212,47 +210,47 @@ int session_of_pgrp(int pgrp) | |||
212 | * | 210 | * |
213 | * "I ask you, have you ever known what it is to be an orphan?" | 211 | * "I ask you, have you ever known what it is to be an orphan?" |
214 | */ | 212 | */ |
215 | static int will_become_orphaned_pgrp(int pgrp, struct task_struct *ignored_task) | 213 | static int will_become_orphaned_pgrp(struct pid *pgrp, struct task_struct *ignored_task) |
216 | { | 214 | { |
217 | struct task_struct *p; | 215 | struct task_struct *p; |
218 | int ret = 1; | 216 | int ret = 1; |
219 | 217 | ||
220 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { | 218 | do_each_pid_task(pgrp, PIDTYPE_PGID, p) { |
221 | if (p == ignored_task | 219 | if (p == ignored_task |
222 | || p->exit_state | 220 | || p->exit_state |
223 | || is_init(p->real_parent)) | 221 | || is_init(p->real_parent)) |
224 | continue; | 222 | continue; |
225 | if (process_group(p->real_parent) != pgrp && | 223 | if (task_pgrp(p->real_parent) != pgrp && |
226 | process_session(p->real_parent) == process_session(p)) { | 224 | task_session(p->real_parent) == task_session(p)) { |
227 | ret = 0; | 225 | ret = 0; |
228 | break; | 226 | break; |
229 | } | 227 | } |
230 | } while_each_task_pid(pgrp, PIDTYPE_PGID, p); | 228 | } while_each_pid_task(pgrp, PIDTYPE_PGID, p); |
231 | return ret; /* (sighing) "Often!" */ | 229 | return ret; /* (sighing) "Often!" */ |
232 | } | 230 | } |
233 | 231 | ||
234 | int is_orphaned_pgrp(int pgrp) | 232 | int is_current_pgrp_orphaned(void) |
235 | { | 233 | { |
236 | int retval; | 234 | int retval; |
237 | 235 | ||
238 | read_lock(&tasklist_lock); | 236 | read_lock(&tasklist_lock); |
239 | retval = will_become_orphaned_pgrp(pgrp, NULL); | 237 | retval = will_become_orphaned_pgrp(task_pgrp(current), NULL); |
240 | read_unlock(&tasklist_lock); | 238 | read_unlock(&tasklist_lock); |
241 | 239 | ||
242 | return retval; | 240 | return retval; |
243 | } | 241 | } |
244 | 242 | ||
245 | static int has_stopped_jobs(int pgrp) | 243 | static int has_stopped_jobs(struct pid *pgrp) |
246 | { | 244 | { |
247 | int retval = 0; | 245 | int retval = 0; |
248 | struct task_struct *p; | 246 | struct task_struct *p; |
249 | 247 | ||
250 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { | 248 | do_each_pid_task(pgrp, PIDTYPE_PGID, p) { |
251 | if (p->state != TASK_STOPPED) | 249 | if (p->state != TASK_STOPPED) |
252 | continue; | 250 | continue; |
253 | retval = 1; | 251 | retval = 1; |
254 | break; | 252 | break; |
255 | } while_each_task_pid(pgrp, PIDTYPE_PGID, p); | 253 | } while_each_pid_task(pgrp, PIDTYPE_PGID, p); |
256 | return retval; | 254 | return retval; |
257 | } | 255 | } |
258 | 256 | ||
@@ -430,8 +428,10 @@ static void close_files(struct files_struct * files) | |||
430 | while (set) { | 428 | while (set) { |
431 | if (set & 1) { | 429 | if (set & 1) { |
432 | struct file * file = xchg(&fdt->fd[i], NULL); | 430 | struct file * file = xchg(&fdt->fd[i], NULL); |
433 | if (file) | 431 | if (file) { |
434 | filp_close(file, files); | 432 | filp_close(file, files); |
433 | cond_resched(); | ||
434 | } | ||
435 | } | 435 | } |
436 | i++; | 436 | i++; |
437 | set >>= 1; | 437 | set >>= 1; |
@@ -648,14 +648,14 @@ reparent_thread(struct task_struct *p, struct task_struct *father, int traced) | |||
648 | * than we are, and it was the only connection | 648 | * than we are, and it was the only connection |
649 | * outside, so the child pgrp is now orphaned. | 649 | * outside, so the child pgrp is now orphaned. |
650 | */ | 650 | */ |
651 | if ((process_group(p) != process_group(father)) && | 651 | if ((task_pgrp(p) != task_pgrp(father)) && |
652 | (process_session(p) == process_session(father))) { | 652 | (task_session(p) == task_session(father))) { |
653 | int pgrp = process_group(p); | 653 | struct pid *pgrp = task_pgrp(p); |
654 | 654 | ||
655 | if (will_become_orphaned_pgrp(pgrp, NULL) && | 655 | if (will_become_orphaned_pgrp(pgrp, NULL) && |
656 | has_stopped_jobs(pgrp)) { | 656 | has_stopped_jobs(pgrp)) { |
657 | __kill_pg_info(SIGHUP, SEND_SIG_PRIV, pgrp); | 657 | __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp); |
658 | __kill_pg_info(SIGCONT, SEND_SIG_PRIV, pgrp); | 658 | __kill_pgrp_info(SIGCONT, SEND_SIG_PRIV, pgrp); |
659 | } | 659 | } |
660 | } | 660 | } |
661 | } | 661 | } |
@@ -735,6 +735,7 @@ static void exit_notify(struct task_struct *tsk) | |||
735 | int state; | 735 | int state; |
736 | struct task_struct *t; | 736 | struct task_struct *t; |
737 | struct list_head ptrace_dead, *_p, *_n; | 737 | struct list_head ptrace_dead, *_p, *_n; |
738 | struct pid *pgrp; | ||
738 | 739 | ||
739 | if (signal_pending(tsk) && !(tsk->signal->flags & SIGNAL_GROUP_EXIT) | 740 | if (signal_pending(tsk) && !(tsk->signal->flags & SIGNAL_GROUP_EXIT) |
740 | && !thread_group_empty(tsk)) { | 741 | && !thread_group_empty(tsk)) { |
@@ -787,12 +788,13 @@ static void exit_notify(struct task_struct *tsk) | |||
787 | 788 | ||
788 | t = tsk->real_parent; | 789 | t = tsk->real_parent; |
789 | 790 | ||
790 | if ((process_group(t) != process_group(tsk)) && | 791 | pgrp = task_pgrp(tsk); |
791 | (process_session(t) == process_session(tsk)) && | 792 | if ((task_pgrp(t) != pgrp) && |
792 | will_become_orphaned_pgrp(process_group(tsk), tsk) && | 793 | (task_session(t) != task_session(tsk)) && |
793 | has_stopped_jobs(process_group(tsk))) { | 794 | will_become_orphaned_pgrp(pgrp, tsk) && |
794 | __kill_pg_info(SIGHUP, SEND_SIG_PRIV, process_group(tsk)); | 795 | has_stopped_jobs(pgrp)) { |
795 | __kill_pg_info(SIGCONT, SEND_SIG_PRIV, process_group(tsk)); | 796 | __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp); |
797 | __kill_pgrp_info(SIGCONT, SEND_SIG_PRIV, pgrp); | ||
796 | } | 798 | } |
797 | 799 | ||
798 | /* Let father know we died | 800 | /* Let father know we died |
diff --git a/kernel/fork.c b/kernel/fork.c index 80284eb488..0b6293d94d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -869,7 +869,7 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts | |||
869 | sig->it_prof_incr = cputime_zero; | 869 | sig->it_prof_incr = cputime_zero; |
870 | 870 | ||
871 | sig->leader = 0; /* session leadership doesn't inherit */ | 871 | sig->leader = 0; /* session leadership doesn't inherit */ |
872 | sig->tty_old_pgrp = 0; | 872 | sig->tty_old_pgrp = NULL; |
873 | 873 | ||
874 | sig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero; | 874 | sig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero; |
875 | sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0; | 875 | sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0; |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 8b961adc3b..7c85d69188 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -328,12 +328,14 @@ int setup_irq(unsigned int irq, struct irqaction *new) | |||
328 | return 0; | 328 | return 0; |
329 | 329 | ||
330 | mismatch: | 330 | mismatch: |
331 | #ifdef CONFIG_DEBUG_SHIRQ | ||
331 | if (!(new->flags & IRQF_PROBE_SHARED)) { | 332 | if (!(new->flags & IRQF_PROBE_SHARED)) { |
332 | printk(KERN_ERR "IRQ handler type mismatch for IRQ %d\n", irq); | 333 | printk(KERN_ERR "IRQ handler type mismatch for IRQ %d\n", irq); |
333 | if (old_name) | 334 | if (old_name) |
334 | printk(KERN_ERR "current handler: %s\n", old_name); | 335 | printk(KERN_ERR "current handler: %s\n", old_name); |
335 | dump_stack(); | 336 | dump_stack(); |
336 | } | 337 | } |
338 | #endif | ||
337 | spin_unlock_irqrestore(&desc->lock, flags); | 339 | spin_unlock_irqrestore(&desc->lock, flags); |
338 | return -EBUSY; | 340 | return -EBUSY; |
339 | } | 341 | } |
@@ -357,6 +359,7 @@ void free_irq(unsigned int irq, void *dev_id) | |||
357 | struct irq_desc *desc; | 359 | struct irq_desc *desc; |
358 | struct irqaction **p; | 360 | struct irqaction **p; |
359 | unsigned long flags; | 361 | unsigned long flags; |
362 | irqreturn_t (*handler)(int, void *) = NULL; | ||
360 | 363 | ||
361 | WARN_ON(in_interrupt()); | 364 | WARN_ON(in_interrupt()); |
362 | if (irq >= NR_IRQS) | 365 | if (irq >= NR_IRQS) |
@@ -396,6 +399,8 @@ void free_irq(unsigned int irq, void *dev_id) | |||
396 | 399 | ||
397 | /* Make sure it's not being used on another CPU */ | 400 | /* Make sure it's not being used on another CPU */ |
398 | synchronize_irq(irq); | 401 | synchronize_irq(irq); |
402 | if (action->flags & IRQF_SHARED) | ||
403 | handler = action->handler; | ||
399 | kfree(action); | 404 | kfree(action); |
400 | return; | 405 | return; |
401 | } | 406 | } |
@@ -403,6 +408,17 @@ void free_irq(unsigned int irq, void *dev_id) | |||
403 | spin_unlock_irqrestore(&desc->lock, flags); | 408 | spin_unlock_irqrestore(&desc->lock, flags); |
404 | return; | 409 | return; |
405 | } | 410 | } |
411 | #ifdef CONFIG_DEBUG_SHIRQ | ||
412 | if (handler) { | ||
413 | /* | ||
414 | * It's a shared IRQ -- the driver ought to be prepared for it | ||
415 | * to happen even now it's being freed, so let's make sure.... | ||
416 | * We do this after actually deregistering it, to make sure that | ||
417 | * a 'real' IRQ doesn't run in parallel with our fake | ||
418 | */ | ||
419 | handler(irq, dev_id); | ||
420 | } | ||
421 | #endif | ||
406 | } | 422 | } |
407 | EXPORT_SYMBOL(free_irq); | 423 | EXPORT_SYMBOL(free_irq); |
408 | 424 | ||
@@ -475,6 +491,25 @@ int request_irq(unsigned int irq, irq_handler_t handler, | |||
475 | 491 | ||
476 | select_smp_affinity(irq); | 492 | select_smp_affinity(irq); |
477 | 493 | ||
494 | #ifdef CONFIG_DEBUG_SHIRQ | ||
495 | if (irqflags & IRQF_SHARED) { | ||
496 | /* | ||
497 | * It's a shared IRQ -- the driver ought to be prepared for it | ||
498 | * to happen immediately, so let's make sure.... | ||
499 | * We do this before actually registering it, to make sure that | ||
500 | * a 'real' IRQ doesn't run in parallel with our fake | ||
501 | */ | ||
502 | if (irqflags & IRQF_DISABLED) { | ||
503 | unsigned long flags; | ||
504 | |||
505 | local_irq_save(flags); | ||
506 | handler(irq, dev_id); | ||
507 | local_irq_restore(flags); | ||
508 | } else | ||
509 | handler(irq, dev_id); | ||
510 | } | ||
511 | #endif | ||
512 | |||
478 | retval = setup_irq(irq, action); | 513 | retval = setup_irq(irq, action); |
479 | if (retval) | 514 | if (retval) |
480 | kfree(action); | 515 | kfree(action); |
diff --git a/kernel/sched.c b/kernel/sched.c index 1fd67e16cd..08f86178aa 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2897,14 +2897,16 @@ static void active_load_balance(struct rq *busiest_rq, int busiest_cpu) | |||
2897 | static void update_load(struct rq *this_rq) | 2897 | static void update_load(struct rq *this_rq) |
2898 | { | 2898 | { |
2899 | unsigned long this_load; | 2899 | unsigned long this_load; |
2900 | int i, scale; | 2900 | unsigned int i, scale; |
2901 | 2901 | ||
2902 | this_load = this_rq->raw_weighted_load; | 2902 | this_load = this_rq->raw_weighted_load; |
2903 | 2903 | ||
2904 | /* Update our load: */ | 2904 | /* Update our load: */ |
2905 | for (i = 0, scale = 1; i < 3; i++, scale <<= 1) { | 2905 | for (i = 0, scale = 1; i < 3; i++, scale += scale) { |
2906 | unsigned long old_load, new_load; | 2906 | unsigned long old_load, new_load; |
2907 | 2907 | ||
2908 | /* scale is effectively 1 << i now, and >> i divides by scale */ | ||
2909 | |||
2908 | old_load = this_rq->cpu_load[i]; | 2910 | old_load = this_rq->cpu_load[i]; |
2909 | new_load = this_load; | 2911 | new_load = this_load; |
2910 | /* | 2912 | /* |
@@ -2914,7 +2916,7 @@ static void update_load(struct rq *this_rq) | |||
2914 | */ | 2916 | */ |
2915 | if (new_load > old_load) | 2917 | if (new_load > old_load) |
2916 | new_load += scale-1; | 2918 | new_load += scale-1; |
2917 | this_rq->cpu_load[i] = (old_load*(scale-1) + new_load) / scale; | 2919 | this_rq->cpu_load[i] = (old_load*(scale-1) + new_load) >> i; |
2918 | } | 2920 | } |
2919 | } | 2921 | } |
2920 | 2922 | ||
diff --git a/kernel/signal.c b/kernel/signal.c index 228fdb5c01..8072e568bb 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -1096,26 +1096,6 @@ int kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp) | |||
1096 | return retval; | 1096 | return retval; |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp) | ||
1100 | { | ||
1101 | if (pgrp <= 0) | ||
1102 | return -EINVAL; | ||
1103 | |||
1104 | return __kill_pgrp_info(sig, info, find_pid(pgrp)); | ||
1105 | } | ||
1106 | |||
1107 | int | ||
1108 | kill_pg_info(int sig, struct siginfo *info, pid_t pgrp) | ||
1109 | { | ||
1110 | int retval; | ||
1111 | |||
1112 | read_lock(&tasklist_lock); | ||
1113 | retval = __kill_pg_info(sig, info, pgrp); | ||
1114 | read_unlock(&tasklist_lock); | ||
1115 | |||
1116 | return retval; | ||
1117 | } | ||
1118 | |||
1119 | int kill_pid_info(int sig, struct siginfo *info, struct pid *pid) | 1099 | int kill_pid_info(int sig, struct siginfo *info, struct pid *pid) |
1120 | { | 1100 | { |
1121 | int error; | 1101 | int error; |
@@ -1191,8 +1171,10 @@ EXPORT_SYMBOL_GPL(kill_pid_info_as_uid); | |||
1191 | 1171 | ||
1192 | static int kill_something_info(int sig, struct siginfo *info, int pid) | 1172 | static int kill_something_info(int sig, struct siginfo *info, int pid) |
1193 | { | 1173 | { |
1174 | int ret; | ||
1175 | rcu_read_lock(); | ||
1194 | if (!pid) { | 1176 | if (!pid) { |
1195 | return kill_pg_info(sig, info, process_group(current)); | 1177 | ret = kill_pgrp_info(sig, info, task_pgrp(current)); |
1196 | } else if (pid == -1) { | 1178 | } else if (pid == -1) { |
1197 | int retval = 0, count = 0; | 1179 | int retval = 0, count = 0; |
1198 | struct task_struct * p; | 1180 | struct task_struct * p; |
@@ -1207,12 +1189,14 @@ static int kill_something_info(int sig, struct siginfo *info, int pid) | |||
1207 | } | 1189 | } |
1208 | } | 1190 | } |
1209 | read_unlock(&tasklist_lock); | 1191 | read_unlock(&tasklist_lock); |
1210 | return count ? retval : -ESRCH; | 1192 | ret = count ? retval : -ESRCH; |
1211 | } else if (pid < 0) { | 1193 | } else if (pid < 0) { |
1212 | return kill_pg_info(sig, info, -pid); | 1194 | ret = kill_pgrp_info(sig, info, find_pid(-pid)); |
1213 | } else { | 1195 | } else { |
1214 | return kill_proc_info(sig, info, pid); | 1196 | ret = kill_pid_info(sig, info, find_pid(pid)); |
1215 | } | 1197 | } |
1198 | rcu_read_unlock(); | ||
1199 | return ret; | ||
1216 | } | 1200 | } |
1217 | 1201 | ||
1218 | /* | 1202 | /* |
@@ -1311,12 +1295,6 @@ int kill_pid(struct pid *pid, int sig, int priv) | |||
1311 | EXPORT_SYMBOL(kill_pid); | 1295 | EXPORT_SYMBOL(kill_pid); |
1312 | 1296 | ||
1313 | int | 1297 | int |
1314 | kill_pg(pid_t pgrp, int sig, int priv) | ||
1315 | { | ||
1316 | return kill_pg_info(sig, __si_special(priv), pgrp); | ||
1317 | } | ||
1318 | |||
1319 | int | ||
1320 | kill_proc(pid_t pid, int sig, int priv) | 1298 | kill_proc(pid_t pid, int sig, int priv) |
1321 | { | 1299 | { |
1322 | return kill_proc_info(sig, __si_special(priv), pid); | 1300 | return kill_proc_info(sig, __si_special(priv), pid); |
@@ -1905,7 +1883,7 @@ relock: | |||
1905 | 1883 | ||
1906 | /* signals can be posted during this window */ | 1884 | /* signals can be posted during this window */ |
1907 | 1885 | ||
1908 | if (is_orphaned_pgrp(process_group(current))) | 1886 | if (is_current_pgrp_orphaned()) |
1909 | goto relock; | 1887 | goto relock; |
1910 | 1888 | ||
1911 | spin_lock_irq(¤t->sighand->siglock); | 1889 | spin_lock_irq(¤t->sighand->siglock); |
@@ -1955,7 +1933,6 @@ EXPORT_SYMBOL(recalc_sigpending); | |||
1955 | EXPORT_SYMBOL_GPL(dequeue_signal); | 1933 | EXPORT_SYMBOL_GPL(dequeue_signal); |
1956 | EXPORT_SYMBOL(flush_signals); | 1934 | EXPORT_SYMBOL(flush_signals); |
1957 | EXPORT_SYMBOL(force_sig); | 1935 | EXPORT_SYMBOL(force_sig); |
1958 | EXPORT_SYMBOL(kill_pg); | ||
1959 | EXPORT_SYMBOL(kill_proc); | 1936 | EXPORT_SYMBOL(kill_proc); |
1960 | EXPORT_SYMBOL(ptrace_notify); | 1937 | EXPORT_SYMBOL(ptrace_notify); |
1961 | EXPORT_SYMBOL(send_sig); | 1938 | EXPORT_SYMBOL(send_sig); |
diff --git a/kernel/sys.c b/kernel/sys.c index e102438331..123b165080 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -596,6 +596,7 @@ asmlinkage long sys_setpriority(int which, int who, int niceval) | |||
596 | struct task_struct *g, *p; | 596 | struct task_struct *g, *p; |
597 | struct user_struct *user; | 597 | struct user_struct *user; |
598 | int error = -EINVAL; | 598 | int error = -EINVAL; |
599 | struct pid *pgrp; | ||
599 | 600 | ||
600 | if (which > 2 || which < 0) | 601 | if (which > 2 || which < 0) |
601 | goto out; | 602 | goto out; |
@@ -610,18 +611,21 @@ asmlinkage long sys_setpriority(int which, int who, int niceval) | |||
610 | read_lock(&tasklist_lock); | 611 | read_lock(&tasklist_lock); |
611 | switch (which) { | 612 | switch (which) { |
612 | case PRIO_PROCESS: | 613 | case PRIO_PROCESS: |
613 | if (!who) | 614 | if (who) |
614 | who = current->pid; | 615 | p = find_task_by_pid(who); |
615 | p = find_task_by_pid(who); | 616 | else |
617 | p = current; | ||
616 | if (p) | 618 | if (p) |
617 | error = set_one_prio(p, niceval, error); | 619 | error = set_one_prio(p, niceval, error); |
618 | break; | 620 | break; |
619 | case PRIO_PGRP: | 621 | case PRIO_PGRP: |
620 | if (!who) | 622 | if (who) |
621 | who = process_group(current); | 623 | pgrp = find_pid(who); |
622 | do_each_task_pid(who, PIDTYPE_PGID, p) { | 624 | else |
625 | pgrp = task_pgrp(current); | ||
626 | do_each_pid_task(pgrp, PIDTYPE_PGID, p) { | ||
623 | error = set_one_prio(p, niceval, error); | 627 | error = set_one_prio(p, niceval, error); |
624 | } while_each_task_pid(who, PIDTYPE_PGID, p); | 628 | } while_each_pid_task(pgrp, PIDTYPE_PGID, p); |
625 | break; | 629 | break; |
626 | case PRIO_USER: | 630 | case PRIO_USER: |
627 | user = current->user; | 631 | user = current->user; |
@@ -656,6 +660,7 @@ asmlinkage long sys_getpriority(int which, int who) | |||
656 | struct task_struct *g, *p; | 660 | struct task_struct *g, *p; |
657 | struct user_struct *user; | 661 | struct user_struct *user; |
658 | long niceval, retval = -ESRCH; | 662 | long niceval, retval = -ESRCH; |
663 | struct pid *pgrp; | ||
659 | 664 | ||
660 | if (which > 2 || which < 0) | 665 | if (which > 2 || which < 0) |
661 | return -EINVAL; | 666 | return -EINVAL; |
@@ -663,9 +668,10 @@ asmlinkage long sys_getpriority(int which, int who) | |||
663 | read_lock(&tasklist_lock); | 668 | read_lock(&tasklist_lock); |
664 | switch (which) { | 669 | switch (which) { |
665 | case PRIO_PROCESS: | 670 | case PRIO_PROCESS: |
666 | if (!who) | 671 | if (who) |
667 | who = current->pid; | 672 | p = find_task_by_pid(who); |
668 | p = find_task_by_pid(who); | 673 | else |
674 | p = current; | ||
669 | if (p) { | 675 | if (p) { |
670 | niceval = 20 - task_nice(p); | 676 | niceval = 20 - task_nice(p); |
671 | if (niceval > retval) | 677 | if (niceval > retval) |
@@ -673,13 +679,15 @@ asmlinkage long sys_getpriority(int which, int who) | |||
673 | } | 679 | } |
674 | break; | 680 | break; |
675 | case PRIO_PGRP: | 681 | case PRIO_PGRP: |
676 | if (!who) | 682 | if (who) |
677 | who = process_group(current); | 683 | pgrp = find_pid(who); |
678 | do_each_task_pid(who, PIDTYPE_PGID, p) { | 684 | else |
685 | pgrp = task_pgrp(current); | ||
686 | do_each_pid_task(pgrp, PIDTYPE_PGID, p) { | ||
679 | niceval = 20 - task_nice(p); | 687 | niceval = 20 - task_nice(p); |
680 | if (niceval > retval) | 688 | if (niceval > retval) |
681 | retval = niceval; | 689 | retval = niceval; |
682 | } while_each_task_pid(who, PIDTYPE_PGID, p); | 690 | } while_each_pid_task(pgrp, PIDTYPE_PGID, p); |
683 | break; | 691 | break; |
684 | case PRIO_USER: | 692 | case PRIO_USER: |
685 | user = current->user; | 693 | user = current->user; |
@@ -1388,7 +1396,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) | |||
1388 | 1396 | ||
1389 | if (p->real_parent == group_leader) { | 1397 | if (p->real_parent == group_leader) { |
1390 | err = -EPERM; | 1398 | err = -EPERM; |
1391 | if (process_session(p) != process_session(group_leader)) | 1399 | if (task_session(p) != task_session(group_leader)) |
1392 | goto out; | 1400 | goto out; |
1393 | err = -EACCES; | 1401 | err = -EACCES; |
1394 | if (p->did_exec) | 1402 | if (p->did_exec) |
@@ -1407,7 +1415,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid) | |||
1407 | struct task_struct *g = | 1415 | struct task_struct *g = |
1408 | find_task_by_pid_type(PIDTYPE_PGID, pgid); | 1416 | find_task_by_pid_type(PIDTYPE_PGID, pgid); |
1409 | 1417 | ||
1410 | if (!g || process_session(g) != process_session(group_leader)) | 1418 | if (!g || task_session(g) != task_session(group_leader)) |
1411 | goto out; | 1419 | goto out; |
1412 | } | 1420 | } |
1413 | 1421 | ||
@@ -1510,7 +1518,6 @@ asmlinkage long sys_setsid(void) | |||
1510 | 1518 | ||
1511 | spin_lock(&group_leader->sighand->siglock); | 1519 | spin_lock(&group_leader->sighand->siglock); |
1512 | group_leader->signal->tty = NULL; | 1520 | group_leader->signal->tty = NULL; |
1513 | group_leader->signal->tty_old_pgrp = 0; | ||
1514 | spin_unlock(&group_leader->sighand->siglock); | 1521 | spin_unlock(&group_leader->sighand->siglock); |
1515 | 1522 | ||
1516 | err = process_group(group_leader); | 1523 | err = process_group(group_leader); |