diff -urN linux-2.1.56/CREDITS linux/CREDITS --- linux-2.1.56/CREDITS Sat Sep 20 18:18:19 1997 +++ linux/CREDITS Mon Sep 22 20:32:33 1997 @@ -483,6 +483,15 @@ N: Philip Gladstone E: philip@raptor.com D: Kernel / timekeeping stuff + +N: Richard E. Gooch +E: rgooch@atnf.csiro.au +D: parent process death signal to children +D: prctl() syscall +S: CSIRO Australia Telescope National Facility +S: P.O. Box 76, Epping +S: N.S.W., 2121 +S: Australia N: Dmitry S. Gorodchanin E: begemot@bgm.rosprint.net diff -urN linux-2.1.56/arch/alpha/kernel/entry.S linux/arch/alpha/kernel/entry.S --- linux-2.1.56/arch/alpha/kernel/entry.S Thu Sep 4 14:47:32 1997 +++ linux/arch/alpha/kernel/entry.S Mon Sep 22 20:27:13 1997 @@ -771,4 +771,5 @@ .quad sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, do_entSys /* sys_afs_syscall */, sys_newuname .quad sys_nanosleep, sys_mremap, sys_nfsservctl, sys_setresuid, sys_getresuid .quad sys_pciconfig_read, sys_pciconfig_write, sys_query_module + .quad sys_prctl .quad do_entSys, do_entSys diff -urN linux-2.1.56/arch/i386/kernel/entry.S linux/arch/i386/kernel/entry.S --- linux-2.1.56/arch/i386/kernel/entry.S Thu Sep 11 09:05:03 1997 +++ linux/arch/i386/kernel/entry.S Mon Sep 22 20:27:13 1997 @@ -528,6 +528,7 @@ .long SYMBOL_NAME(sys_nfsservctl) .long SYMBOL_NAME(sys_setresgid) /* 170 */ .long SYMBOL_NAME(sys_getresgid) - .rept NR_syscalls-171 + .long SYMBOL_NAME(sys_prctl) + .rept NR_syscalls-172 .long SYMBOL_NAME(sys_ni_syscall) .endr diff -urN linux-2.1.56/arch/m68k/kernel/entry.S linux/arch/m68k/kernel/entry.S --- linux-2.1.56/arch/m68k/kernel/entry.S Fri Aug 1 06:09:16 1997 +++ linux/arch/m68k/kernel/entry.S Mon Sep 22 20:27:13 1997 @@ -568,6 +568,7 @@ .long SYMBOL_NAME(sys_query_module) .long SYMBOL_NAME(sys_poll) .long SYMBOL_NAME(sys_nfsservctl) + .long SYMBOL_NAME(sys_prctl) .rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4 .long SYMBOL_NAME(sys_ni_syscall) .endr diff -urN linux-2.1.56/arch/mips/kernel/syscalls.h linux/arch/mips/kernel/syscalls.h --- linux-2.1.56/arch/mips/kernel/syscalls.h Thu Sep 4 14:47:24 1997 +++ linux/arch/mips/kernel/syscalls.h Mon Sep 22 20:27:13 1997 @@ -212,3 +212,4 @@ SYS(sys_getresgid, 3) SYS(sys_setresgid, 3) /* 4190 */ SYS(sys_getresgid, 3) +SYS(sys_prctl, 5) diff -urN linux-2.1.56/arch/ppc/kernel/misc.S linux/arch/ppc/kernel/misc.S --- linux-2.1.56/arch/ppc/kernel/misc.S Thu Sep 4 14:47:24 1997 +++ linux/arch/ppc/kernel/misc.S Mon Sep 22 20:27:13 1997 @@ -539,6 +539,7 @@ .long sys_query_module .long sys_poll .long sys_nfsservctl + .long sys_prctl .long sys_debug - .space (NR_syscalls-170)*4 + .space (NR_syscalls-171)*4 diff -urN linux-2.1.56/arch/sparc/kernel/systbls.S linux/arch/sparc/kernel/systbls.S --- linux-2.1.56/arch/sparc/kernel/systbls.S Wed May 14 15:41:03 1997 +++ linux/arch/sparc/kernel/systbls.S Mon Sep 22 20:27:13 1997 @@ -125,6 +125,7 @@ .long C_LABEL(sys_fdatasync) .long C_LABEL(sys_nfsservctl) /*255*/ .long C_LABEL(sys_aplib) + .long C_LABEL(sys_prctl) .long C_LABEL(sys_nis_syscall) /* Now the SunOS syscall table. */ @@ -219,3 +220,4 @@ .long C_LABEL(sunos_nosys), C_LABEL(sunos_nosys) /*250*/ .long C_LABEL(sunos_nosys), C_LABEL(sunos_nosys), C_LABEL(sunos_nosys) .long C_LABEL(sunos_nosys), C_LABEL(sunos_nosys), C_LABEL(sys_aplib) + .long C_LABEL(sunos_nosys) diff -urN linux-2.1.56/arch/sparc64/kernel/systbls.S linux/arch/sparc64/kernel/systbls.S --- linux-2.1.56/arch/sparc64/kernel/systbls.S Sun Sep 7 10:16:37 1997 +++ linux/arch/sparc64/kernel/systbls.S Mon Sep 22 20:27:13 1997 @@ -68,7 +68,7 @@ /*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys_nis_syscall, sys_nis_syscall .word sys_nis_syscall, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, sys32_nanosleep /*250*/ .word sys32_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys32_nfsservctl - .word sys_aplib + .word sys_aplib, sys_prctl /* Now the 64-bit native Linux syscall table. */ @@ -127,7 +127,7 @@ /*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_nis_syscall, sys_nis_syscall .word sys_nis_syscall, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep /*250*/ .word sys_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl - .word sys_aplib + .word sys_aplib, sys_prctl /* Now the 32-bit SunOS syscall table. */ @@ -221,3 +221,4 @@ .word sunos_nosys, sunos_nosys /*250*/ .word sunos_nosys, sunos_nosys, sunos_nosys .word sunos_nosys, sunos_nosys, sys_aplib + .word sunos_nosys diff -urN linux-2.1.56/include/asm-alpha/unistd.h linux/include/asm-alpha/unistd.h --- linux-2.1.56/include/asm-alpha/unistd.h Fri May 30 14:53:08 1997 +++ linux/include/asm-alpha/unistd.h Mon Sep 22 20:27:13 1997 @@ -285,6 +285,7 @@ #define __NR_pciconfig_read 345 #define __NR_pciconfig_write 346 #define __NR_query_module 347 +#define __NR_prctl 348 #if defined(__LIBRARY__) && defined(__GNUC__) diff -urN linux-2.1.56/include/asm-i386/unistd.h linux/include/asm-i386/unistd.h --- linux-2.1.56/include/asm-i386/unistd.h Fri Jun 27 05:33:39 1997 +++ linux/include/asm-i386/unistd.h Mon Sep 22 20:27:13 1997 @@ -177,6 +177,7 @@ #define __NR_nfsservctl 169 #define __NR_setresgid 170 #define __NR_getresgid 171 +#define __NR_prctl 172 /* user-visible error numbers are in the range -1 - -122: see */ diff -urN linux-2.1.56/include/asm-m68k/unistd.h linux/include/asm-m68k/unistd.h --- linux-2.1.56/include/asm-m68k/unistd.h Fri May 30 14:53:08 1997 +++ linux/include/asm-m68k/unistd.h Mon Sep 22 20:27:13 1997 @@ -174,6 +174,7 @@ #define __NR_query_module 167 #define __NR_poll 168 #define __NR_nfsservctl 169 +#define __NR_prctl 170 /* user-visible error numbers are in the range -1 - -122: see */ diff -urN linux-2.1.56/include/asm-mips/unistd.h linux/include/asm-mips/unistd.h --- linux-2.1.56/include/asm-mips/unistd.h Fri Aug 1 06:09:18 1997 +++ linux/include/asm-mips/unistd.h Mon Sep 22 20:27:13 1997 @@ -1179,11 +1179,12 @@ #define __NR_nfsservctl (__NR_Linux + 189) #define __NR_setresgid (__NR_Linux + 190) #define __NR_getresgid (__NR_Linux + 191) +#define __NR_prctl (__NR_Linux + 192) /* * Offset of the last Linux flavoured syscall */ -#define __NR_Linux_syscalls 191 +#define __NR_Linux_syscalls 192 #ifndef __LANGUAGE_ASSEMBLY__ diff -urN linux-2.1.56/include/asm-ppc/unistd.h linux/include/asm-ppc/unistd.h --- linux-2.1.56/include/asm-ppc/unistd.h Fri Aug 1 06:09:18 1997 +++ linux/include/asm-ppc/unistd.h Mon Sep 22 20:27:13 1997 @@ -174,6 +174,7 @@ #define __NR_query_module 166 #define __NR_poll 167 #define __NR_nfsservctl 168 +#define __NR_prctl 169 #define __NR(n) #n #define __do_syscall(n) \ diff -urN linux-2.1.56/include/asm-sparc/unistd.h linux/include/asm-sparc/unistd.h --- linux-2.1.56/include/asm-sparc/unistd.h Fri May 30 14:53:09 1997 +++ linux/include/asm-sparc/unistd.h Mon Sep 22 20:27:13 1997 @@ -272,6 +272,7 @@ #define __NR_fdatasync 253 #define __NR_nfsservctl 254 #define __NR_aplib 255 +#define __NR_prctl 256 #define _syscall0(type,name) \ type name(void) \ diff -urN linux-2.1.56/include/asm-sparc64/unistd.h linux/include/asm-sparc64/unistd.h --- linux-2.1.56/include/asm-sparc64/unistd.h Fri Jun 27 05:33:40 1997 +++ linux/include/asm-sparc64/unistd.h Mon Sep 22 20:27:13 1997 @@ -272,6 +272,7 @@ #define __NR_fdatasync 253 #define __NR_nfsservctl 254 #define __NR_aplib 255 +#define __NR_prctl 256 #define _syscall0(type,name) \ type name(void) \ diff -urN linux-2.1.56/include/linux/prctl.h linux/include/linux/prctl.h --- linux-2.1.56/include/linux/prctl.h Thu Jan 1 10:00:00 1970 +++ linux/include/linux/prctl.h Mon Sep 22 20:27:13 1997 @@ -0,0 +1,9 @@ +#ifndef _LINUX_PRCTL_H +#define _LINUX_PRCTL_H + +/* Values to pass as first argument to prctl() */ + +#define PR_SET_PDEATHSIG 1 /* Second arg is a signal */ + + +#endif /* _LINUX_PRCTL_H */ diff -urN linux-2.1.56/include/linux/sched.h linux/include/linux/sched.h --- linux-2.1.56/include/linux/sched.h Sat Sep 20 19:02:35 1997 +++ linux/include/linux/sched.h Mon Sep 22 20:27:13 1997 @@ -191,6 +191,7 @@ struct task_struct *next_task, *prev_task; struct task_struct *next_run, *prev_run; int exit_code, exit_signal; + int pdeath_signal; /* The signal sent when the parent dies */ /* ??? */ unsigned long personality; int dumpable:1; @@ -312,7 +313,7 @@ /* exec domain */&default_exec_domain, \ /* binfmt */ NULL, \ /* schedlink */ &init_task,&init_task, &init_task, &init_task, \ -/* ec,brk... */ 0,0,0,0,0, \ +/* ec,brk... */ 0,0,0,0,0,0, \ /* pid etc.. */ 0,0,0,0,0, \ /* suppl grps*/ 0, {0,}, \ /* proc links*/ &init_task,&init_task,NULL,NULL,NULL, \ diff -urN linux-2.1.56/kernel/exit.c linux/kernel/exit.c --- linux-2.1.56/kernel/exit.c Sat Sep 20 18:18:21 1997 +++ linux/kernel/exit.c Mon Sep 22 20:27:13 1997 @@ -349,7 +349,8 @@ for_each_task(p) { if (p->p_opptr == father) { p->exit_signal = SIGCHLD; - p->p_opptr = task[smp_num_cpus] ? : task[0]; /* init */ + p->p_opptr = task[smp_num_cpus] ? : task[0]; /* init */ + if (p->pdeath_signal) send_sig(p->pdeath_signal, p, 0); } } read_unlock(&tasklist_lock); diff -urN linux-2.1.56/kernel/fork.c linux/kernel/fork.c --- linux-2.1.56/kernel/fork.c Thu Sep 4 14:47:34 1997 +++ linux/kernel/fork.c Mon Sep 22 20:27:13 1997 @@ -497,6 +497,7 @@ /* ok, now we should be set up.. */ p->swappable = 1; p->exit_signal = clone_flags & CSIGNAL; + p->pdeath_signal = 0; /* * "share" dynamic priority between parent and child, thus the diff -urN linux-2.1.56/kernel/sys.c linux/kernel/sys.c --- linux-2.1.56/kernel/sys.c Thu Sep 11 09:05:05 1997 +++ linux/kernel/sys.c Mon Sep 22 20:27:13 1997 @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -1004,4 +1005,26 @@ { mask = xchg(¤t->fs->umask, mask & S_IRWXUGO); return mask; +} + +asmlinkage int sys_prctl(int option, unsigned long arg2, unsigned long arg3, + unsigned long arg4, unsigned long arg5) +{ + int error = 0; + int sig; + + switch (option) { + case PR_SET_PDEATHSIG: + sig = arg2; + if (sig > _NSIG) { + error = -EINVAL; + break; + } + current->pdeath_signal = sig; + break; + default: + error = -EINVAL; + break; + } + return error; }