diff -urN linux-2.4.18-rc1/arch/i386/kernel/entry.S linux-2.4.18-rc1-ctx7/arch/i386/kernel/entry.S --- linux-2.4.18-rc1/arch/i386/kernel/entry.S Sat Feb 16 15:10:11 2002 +++ linux-2.4.18-rc1-ctx7/arch/i386/kernel/entry.S Sat Feb 16 23:22:10 2002 @@ -634,6 +634,8 @@ .long SYMBOL_NAME(sys_ni_syscall) /* 235 reserved for removexattr */ .long SYMBOL_NAME(sys_ni_syscall) /* reserved for lremovexattr */ .long SYMBOL_NAME(sys_ni_syscall) /* reserved for fremovexattr */ + .long SYMBOL_NAME(sys_new_s_context) + .long SYMBOL_NAME(sys_set_ipv4root) .rept NR_syscalls-(.-sys_call_table)/4 .long SYMBOL_NAME(sys_ni_syscall) diff -urN linux-2.4.18-rc1/include/asm-i386/unistd.h linux-2.4.18-rc1-ctx7/include/asm-i386/unistd.h --- linux-2.4.18-rc1/include/asm-i386/unistd.h Sat Feb 16 15:10:16 2002 +++ linux-2.4.18-rc1-ctx7/include/asm-i386/unistd.h Sat Feb 16 23:22:10 2002 @@ -242,6 +242,8 @@ #define __NR_removexattr 235 #define __NR_lremovexattr 236 #define __NR_fremovexattr 237 +#define __NR_new_s_context 238 +#define __NR_set_ipv4root 239 /* user-visible error numbers are in the range -1 - -124: see */ diff -urN linux-2.4.18-rc1/kernel/exit.c linux-2.4.18-rc1-ctx7/kernel/exit.c --- linux-2.4.18-rc1/kernel/exit.c Sat Feb 16 15:10:17 2002 +++ linux-2.4.18-rc1-ctx7/kernel/exit.c Sat Feb 16 23:22:10 2002 @@ -163,8 +163,16 @@ /* Next in our thread group */ reaper = next_thread(father); - if (reaper == father) + if (reaper == father) { reaper = child_reaper; + if (father->s_info != NULL){ + pid_t initpid = father->s_info->initpid; + if (initpid != 0 && father->pid != initpid) { + struct task_struct *r = find_task_by_pid(initpid); + if (r != NULL) reaper = r; + } + } + } for_each_task(p) { if (p->p_opptr == father) { diff -urN linux-2.4.18-rc1/kernel/fork.c linux-2.4.18-rc1-ctx7/kernel/fork.c --- linux-2.4.18-rc1/kernel/fork.c Sat Feb 16 15:10:17 2002 +++ linux-2.4.18-rc1-ctx7/kernel/fork.c Sat Feb 16 23:22:10 2002 @@ -586,6 +586,10 @@ *p = *current; retval = -EAGAIN; + if (p->s_info != NULL && (p->s_info->flags & S_CTX_INFO_NPROC)!=0) { + if (p->s_info->refcount >= p->rlim[RLIMIT_NPROC].rlim_max) + goto bad_fork_free; + } /* * Check if we are over our maximum process limit, but be sure to * exclude root. This is needed to make it possible for login and @@ -595,6 +599,8 @@ if (atomic_read(&p->user->processes) >= p->rlim[RLIMIT_NPROC].rlim_cur && !capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE)) goto bad_fork_free; + + sys_assign_s_info (p); atomic_inc(&p->user->__count); atomic_inc(&p->user->processes);