diff options
| author | Jeff Garzik <jeff@garzik.org> | 2006-09-30 23:45:41 -0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-09-30 23:45:41 -0400 |
| commit | 1c7da74c4aab595a994beb5fe728ebf0d0b41f59 (patch) | |
| tree | 64128abdf9550ebb51d8f3ee6732d7350b9c62f2 /kernel/exit.c | |
| parent | aebb1153ac54ddbbd3d3f0481a193f4bf0ead53b (diff) | |
| parent | 1bdfd554be94def718323659173517c5d4a69d25 (diff) | |
Merge branch 'master' into upstream
Diffstat (limited to 'kernel/exit.c')
| -rw-r--r-- | kernel/exit.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index d891883420f7..c189de2927ab 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #include <linux/pipe_fs_i.h> | 38 | #include <linux/pipe_fs_i.h> |
| 39 | #include <linux/audit.h> /* for audit_free() */ | 39 | #include <linux/audit.h> /* for audit_free() */ |
| 40 | #include <linux/resource.h> | 40 | #include <linux/resource.h> |
| 41 | #include <linux/blkdev.h> | ||
| 41 | 42 | ||
| 42 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
| 43 | #include <asm/unistd.h> | 44 | #include <asm/unistd.h> |
| @@ -219,7 +220,7 @@ static int will_become_orphaned_pgrp(int pgrp, struct task_struct *ignored_task) | |||
| 219 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { | 220 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { |
| 220 | if (p == ignored_task | 221 | if (p == ignored_task |
| 221 | || p->exit_state | 222 | || p->exit_state |
| 222 | || p->real_parent->pid == 1) | 223 | || is_init(p->real_parent)) |
| 223 | continue; | 224 | continue; |
| 224 | if (process_group(p->real_parent) != pgrp | 225 | if (process_group(p->real_parent) != pgrp |
| 225 | && p->real_parent->signal->session == p->signal->session) { | 226 | && p->real_parent->signal->session == p->signal->session) { |
| @@ -249,17 +250,6 @@ static int has_stopped_jobs(int pgrp) | |||
| 249 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { | 250 | do_each_task_pid(pgrp, PIDTYPE_PGID, p) { |
| 250 | if (p->state != TASK_STOPPED) | 251 | if (p->state != TASK_STOPPED) |
| 251 | continue; | 252 | continue; |
| 252 | |||
| 253 | /* If p is stopped by a debugger on a signal that won't | ||
| 254 | stop it, then don't count p as stopped. This isn't | ||
| 255 | perfect but it's a good approximation. */ | ||
| 256 | if (unlikely (p->ptrace) | ||
| 257 | && p->exit_code != SIGSTOP | ||
| 258 | && p->exit_code != SIGTSTP | ||
| 259 | && p->exit_code != SIGTTOU | ||
| 260 | && p->exit_code != SIGTTIN) | ||
| 261 | continue; | ||
| 262 | |||
| 263 | retval = 1; | 253 | retval = 1; |
| 264 | break; | 254 | break; |
| 265 | } while_each_task_pid(pgrp, PIDTYPE_PGID, p); | 255 | } while_each_task_pid(pgrp, PIDTYPE_PGID, p); |
| @@ -292,9 +282,7 @@ static void reparent_to_init(void) | |||
| 292 | /* Set the exit signal to SIGCHLD so we signal init on exit */ | 282 | /* Set the exit signal to SIGCHLD so we signal init on exit */ |
| 293 | current->exit_signal = SIGCHLD; | 283 | current->exit_signal = SIGCHLD; |
| 294 | 284 | ||
| 295 | if ((current->policy == SCHED_NORMAL || | 285 | if (!has_rt_policy(current) && (task_nice(current) < 0)) |
| 296 | current->policy == SCHED_BATCH) | ||
| 297 | && (task_nice(current) < 0)) | ||
| 298 | set_user_nice(current, 0); | 286 | set_user_nice(current, 0); |
| 299 | /* cpus_allowed? */ | 287 | /* cpus_allowed? */ |
| 300 | /* rt_priority? */ | 288 | /* rt_priority? */ |
| @@ -487,6 +475,18 @@ void fastcall put_files_struct(struct files_struct *files) | |||
| 487 | 475 | ||
| 488 | EXPORT_SYMBOL(put_files_struct); | 476 | EXPORT_SYMBOL(put_files_struct); |
| 489 | 477 | ||
| 478 | void reset_files_struct(struct task_struct *tsk, struct files_struct *files) | ||
| 479 | { | ||
| 480 | struct files_struct *old; | ||
| 481 | |||
| 482 | old = tsk->files; | ||
| 483 | task_lock(tsk); | ||
| 484 | tsk->files = files; | ||
| 485 | task_unlock(tsk); | ||
| 486 | put_files_struct(old); | ||
| 487 | } | ||
| 488 | EXPORT_SYMBOL(reset_files_struct); | ||
| 489 | |||
| 490 | static inline void __exit_files(struct task_struct *tsk) | 490 | static inline void __exit_files(struct task_struct *tsk) |
| 491 | { | 491 | { |
| 492 | struct files_struct * files = tsk->files; | 492 | struct files_struct * files = tsk->files; |
| @@ -954,15 +954,15 @@ fastcall NORET_TYPE void do_exit(long code) | |||
| 954 | if (tsk->splice_pipe) | 954 | if (tsk->splice_pipe) |
| 955 | __free_pipe_info(tsk->splice_pipe); | 955 | __free_pipe_info(tsk->splice_pipe); |
| 956 | 956 | ||
| 957 | /* PF_DEAD causes final put_task_struct after we schedule. */ | ||
| 958 | preempt_disable(); | 957 | preempt_disable(); |
| 959 | BUG_ON(tsk->flags & PF_DEAD); | 958 | /* causes final put_task_struct in finish_task_switch(). */ |
| 960 | tsk->flags |= PF_DEAD; | 959 | tsk->state = TASK_DEAD; |
| 961 | 960 | ||
| 962 | schedule(); | 961 | schedule(); |
| 963 | BUG(); | 962 | BUG(); |
| 964 | /* Avoid "noreturn function does return". */ | 963 | /* Avoid "noreturn function does return". */ |
| 965 | for (;;) ; | 964 | for (;;) |
| 965 | cpu_relax(); /* For when BUG is null */ | ||
| 966 | } | 966 | } |
| 967 | 967 | ||
| 968 | EXPORT_SYMBOL_GPL(do_exit); | 968 | EXPORT_SYMBOL_GPL(do_exit); |
| @@ -971,7 +971,7 @@ NORET_TYPE void complete_and_exit(struct completion *comp, long code) | |||
| 971 | { | 971 | { |
| 972 | if (comp) | 972 | if (comp) |
| 973 | complete(comp); | 973 | complete(comp); |
| 974 | 974 | ||
| 975 | do_exit(code); | 975 | do_exit(code); |
| 976 | } | 976 | } |
| 977 | 977 | ||
