X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=kernel%2Fexit.c;h=37faf083e6f6e5b5d1d80f17839866ced5be8f5b;hb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;hp=9b652d8628da5a9899c38d7a6091a0c96a8f060f;hpb=a8e794ca871505c8ea96cc102f4ad555c5231d7f;p=linux-2.6.git diff --git a/kernel/exit.c b/kernel/exit.c index 9b652d862..37faf083e 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -22,15 +22,18 @@ #include #include #include +#include +#include #include +#include #include #include extern void sem_exit (void); extern struct task_struct *child_reaper; -int getrusage(struct task_struct *, int, struct rusage *); +int getrusage(struct task_struct *, int, struct rusage __user *); static void __unhash_process(struct task_struct *p) { @@ -38,7 +41,8 @@ static void __unhash_process(struct task_struct *p) /* tasklist_lock is held, is this sufficient? */ if (p->vx_info) { atomic_dec(&p->vx_info->cacct.nr_threads); - atomic_dec(&p->vx_info->limit.res[RLIMIT_NPROC]); + vx_nproc_dec(p->vx_info); + // atomic_dec(&p->vx_info->limit.res[RLIMIT_NPROC]); } detach_pid(p, PIDTYPE_PID); detach_pid(p, PIDTYPE_TGID); @@ -384,7 +388,7 @@ static inline void close_files(struct files_struct * files) struct file * file = xchg(&files->fd[i], NULL); if (file) filp_close(file, files); - vx_openfd_dec(fd); + vx_openfd_dec(i); } i++; set >>= 1; @@ -742,6 +746,14 @@ static void exit_notify(struct task_struct *tsk) tsk->state = state; tsk->flags |= PF_DEAD; + /* + * Clear these here so that update_process_times() won't try to deliver + * itimer, profile or rlimit signals to this task while it is in late exit. + */ + tsk->it_virt_value = 0; + tsk->it_prof_value = 0; + tsk->rlim[RLIMIT_CPU].rlim_cur = RLIM_INFINITY; + /* * In the preemption case it must be impossible for the task * to get runnable again, so use "_raw_" unlock to keep @@ -798,6 +810,9 @@ asmlinkage NORET_TYPE void do_exit(long code) __exit_fs(tsk); exit_namespace(tsk); exit_thread(); +#ifdef CONFIG_NUMA + mpol_free(tsk->mempolicy); +#endif if (tsk->signal->leader) disassociate_ctty(1); @@ -939,7 +954,7 @@ static int eligible_child(pid_t pid, int options, task_t *p) * the lock and this task is uninteresting. If we return nonzero, we have * released the lock and the system call should return. */ -static int wait_task_zombie(task_t *p, unsigned int *stat_addr, struct rusage *ru) +static int wait_task_zombie(task_t *p, unsigned int __user *stat_addr, struct rusage __user *ru) { unsigned long state; int retval; @@ -1012,7 +1027,8 @@ static int wait_task_zombie(task_t *p, unsigned int *stat_addr, struct rusage *r * released the lock and the system call should return. */ static int wait_task_stopped(task_t *p, int delayed_group_leader, - unsigned int *stat_addr, struct rusage *ru) + unsigned int __user *stat_addr, + struct rusage __user *ru) { int retval, exit_code; @@ -1082,7 +1098,7 @@ static int wait_task_stopped(task_t *p, int delayed_group_leader, return retval; } -asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struct rusage * ru) +asmlinkage long sys_wait4(pid_t pid,unsigned int __user *stat_addr, int options, struct rusage __user *ru) { DECLARE_WAITQUEUE(wait, current); struct task_struct *tsk; @@ -1165,14 +1181,13 @@ end_wait4: return retval; } -#if !defined(__alpha__) && !defined(__ia64__) && \ - !defined(__arm__) && !defined(__s390__) +#ifdef __ARCH_WANT_SYS_WAITPID /* * sys_waitpid() remains for compatibility. waitpid() should be * implemented by calling sys_wait4() from libc.a. */ -asmlinkage long sys_waitpid(pid_t pid,unsigned int * stat_addr, int options) +asmlinkage long sys_waitpid(pid_t pid, unsigned __user *stat_addr, int options) { return sys_wait4(pid, stat_addr, options, NULL); }