Changes to signal to better support thread groups
Subsystems (11)
PATCH 1/1 Changes to signal to better support thread groups
Given the recent discussion, I'm not sure who I should submit this patch to. Alan Cox and Ted T'so have reviewed it, and have suggested it should be submitted for 2.5, so I'm sending it to Dave and Linus. If there's a maintainer more suitable to send it to, please let me know.
During the course of developing our pthread library (the NGPT pthread library) it became clear we needed some kernel support for handling signals. This patch helps the library by redirecting all signals sent to tasks in a
thread group to the thread group leader. It also defines the tkill() system call so the library can signal a specific task if necessary.
Given that as far as I know NGPT is the only user of thread groups, and that this change would benefit any other user of thread groups, I'm submitting this for inclusion in the 2.5 kernel.
Note that this patch also adds support for sys_gettid() for the architectures that don't have it. While this could have been split into a spearate patch, it would create conflicts since this patch also adds sys_tkill(), so I felt it was cleaner to leave them together.
Dave McCracken
======================================================================
Dave McCracken IBM Linux Base Kernel Team 1-512-838-3059
[email protected] T/L 678-3059
---------------------
./kernel/fork.c +2 -2
@@ -724,10 +724,10 @@/* Need tasklist lock for parent etc handling! */ write_lock_irq (&tasklist_lock); -/* CLONE_PARENT and CLONE_THREAD re-use the old parent */ +/* CLONE_PARENT re-uses the old parent */ p->p_opptr = current->p_opptr; p->p_pptr = current->p_pptr; -if (!(clone_flags & (CLONE_PARENT |CLONE_THREAD ))) { +if (!(clone_flags &CLONE_PARENT )) { p->p_opptr = current;if (!(p->ptrace &PT_PTRACED )) p->p_pptr = current;
./kernel/signal.c +40 -3
68 lines not on this page · raw message
./include/linux/sched.h +2 -0
@@ -839,8 +839,13 @@#define for_each_task (p) \ for (p = &init_task ; (p = p->next_task) != &init_task ; ) +#define for_each_thread (task) \ + for (task = next_thread(current) ; task != current ; task =
next_thread(task))
+
#define next_thread(p) \
list_entry((p)->thread_group.next, struct task_struct, thread_group)
+
+#define thread_group_leader(p) (p->pid == p->tgid)
static inline void unhash_process(struct task_struct *p) {
./include/asm-i386/unistd.h +1 -0
@@ -242,6 +242,7 @@#define __NR_removexattr 235#define __NR_lremovexattr 236#define __NR_fremovexattr 237 +#define __NR_tkill 238/* user-visible error numbers are in the range -1 - -124: see
<asm-i386/errno.h> */
./include/asm-i386/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-mips/unistd.h +2 -0
@@ -233,6 +233,8 @@#define __NR_madvise (__NR_Linux + 218)#define __NR_getdents64 (__NR_Linux + 219)#define __NR_fcntl64 (__NR_Linux + 220) +#define __NR_gettid (__NR_Linux + 221) +#define __NR_tkill (__NR_Linux + 222)/* * Offset of the last Linux flavoured syscall
./include/asm-mips/siginfo.h +1 -0
@@ -127,6 +127,7 @@#define SI_TIMER __SI_CODE(__SI_TIMER,-3)/* sent by timer expiration */ #define SI_MESGQ -4/* sent by real time mesq state change */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-alpha/unistd.h +1 -0
@@ -318,6 +318,7 @@#define __NR_gettid 378#define __NR_readahead 379#define __NR_security 380/* syscall for security modules */ +#define __NR_tkill 381#if defined(__GNUC__)
./include/asm-alpha/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-m68k/unistd.h +2 -0
@@ -222,6 +222,8 @@#define __NR_setfsuid32 215#define __NR_setfsgid32 216#define __NR_getdents64 220 +#define __NR_gettid 221 +#define __NR_tkill 222/* user-visible error numbers are in the range -1 - -122: see <asm-m68k/errno.h> */
./include/asm-m68k/siginfo.h +1 -0
@@ -117,6 +117,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-sparc/unistd.h +1 -0
@@ -271,6 +271,7 @@#define __NR_fdatasync 253#define __NR_nfsservctl 254#define __NR_aplib 255 +#define __NR_tkill 257#define _syscall0 (type,name) \ type name(void) \
./include/asm-sparc/siginfo.h +1 -0
@@ -112,6 +112,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-ppc/unistd.h +1 -0
@@ -215,6 +215,7 @@#define __NR_madvise 205#define __NR_mincore 206#define __NR_gettid 207 +#define __NR_tkill 208#define __NR (n) #n
./include/asm-ppc/siginfo.h +1 -0
@@ -108,6 +108,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-sparc64/unistd.h +1 -0
@@ -273,6 +273,7 @@#define __NR_fdatasync 253#define __NR_nfsservctl 254#define __NR_aplib 255 +#define __NR_tkill 256#define _syscall0 (type,name) \ type name(void) \
--- linux-2.5.3/./include/asm-sparc64/siginfo.h Wed May 24 20:38:26 2000
+++ linux-2.5.3-ngpt/./include/asm-sparc64/siginfo.h Fri Feb 1 13:12:29
2002
@@ -172,6 +172,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-arm/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-sh/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-sh/unistd.h +2 -0
@@ -231,6 +231,8 @@#define __NR_madvise 219#define __NR_getdents64 220#define __NR_fcntl64 221 +#define __NR_gettid 222 +#define __NR_tkill 223/* user-visible error numbers are in the range -1 - -125: see
<asm-sh/errno.h> */
./include/asm-ia64/siginfo.h +1 -0
@@ -124,6 +124,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-ia64/unistd.h +1 -0
@@ -206,6 +206,7 @@#define __NR_getdents64 1214#define __NR_getunwind 1215#define __NR_readahead 1216 +#define __NR_tkill 1217#if !defined(__ASSEMBLY__) && !defined(ASSEMBLER )
./include/asm-mips64/siginfo.h +1 -0
@@ -127,6 +127,7 @@#define SI_TIMER __SI_CODE(__SI_TIMER,-3)/* sent by timer expiration */ #define SI_MESGQ -4/* sent by real time mesq state change */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-mips64/unistd.h +3 -1
@@ -461,11 +461,13 @@#define __NR_mincore (__NR_Linux + 211)#define __NR_madvise (__NR_Linux + 212)#define __NR_getdents64 (__NR_Linux + 213) +#define __NR_gettid (__NR_Linux + 214) +#define __NR_tkill (__NR_Linux + 215)/* * Offset of the last Linux flavoured syscall */ -#define __NR_Linux_syscalls 213 +#define __NR_Linux_syscalls 215#ifndef _LANGUAGE_ASSEMBLY
./include/asm-s390/siginfo.h +1 -0
@@ -115,6 +115,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-s390/unistd.h +2 -0
@@ -211,6 +211,8 @@#define __NR_mincore 218#define __NR_madvise 219#define __NR_getdents64 220 +#define __NR_gettid 226 +#define __NR_tkill 227/* user-visible error numbers are in the range -1 - -122: see
<asm-s390/errno.h> */
./include/asm-parisc/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-parisc/unistd.h +0 -0
@@ -689,8 +689,10 @@#define __NR_getpmsg (__NR_Linux + 196)/* some people
actually want streams */
#define __NR_putpmsg (__NR_Linux + 197) /* some people
actually want streams */
+#define __NR_gettid (__NR_Linux + 198)
+#define __NR_tkill (__NR_Linux + 199)
-#define __NR_Linux_syscalls 197
+#define __NR_Linux_syscalls 199
#define HPUX_GATEWAY_ADDR 0xC0000004
#define LINUX_GATEWAY_ADDR 0x100
./include/asm-cris/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-cris/unistd.h +1 -0
@@ -230,6 +230,7 @@#define __NR_security 223/* syscall for security modules */ #define __NR_gettid 224#define __NR_readahead 225 +#define __NR_tkill 226/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */ #define _syscall0 (type,name) \
./include/asm-s390x/unistd.h +2 -0
@@ -181,6 +181,8 @@#define __NR_mincore 218#define __NR_madvise 219#define __NR_getdents64 220 +#define __NR_gettid 226 +#define __NR_tkill 227/* user-visible error numbers are in the range -1 - -122: see
<asm-s390/errno.h> */
./include/asm-s390x/siginfo.h +1 -0
@@ -115,6 +115,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./arch/i386/kernel/entry.S +1 -0
@@ -667,6 +667,7 @@ .long SYMBOL_NAME(sys_removexattr) /* 235 */ .long SYMBOL_NAME(sys_lremovexattr) .long SYMBOL_NAME(sys_fremovexattr) + .long SYMBOL_NAME(sys_tkill) .rept NR_syscalls-(.-sys_call_table)/4 .long SYMBOL_NAME(sys_ni_syscall)
./arch/i386/kernel/signal.c +3 -0
@@ -686,6 +686,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group, make
sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr, &info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
./arch/alpha/kernel/entry.S +1 -0
@@ -1148,3 +1148,4 @@ .quad sys_gettid .quad sys_readahead .quad sys_ni_syscall /* 380, sys_security */ + .quad sys_tkill
./arch/alpha/kernel/signal.c +3 -0
@@ -719,6 +719,19 @@lock_kernel ();sigaddset (¤t->pending.signal, signr); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
./arch/sparc/kernel/signal.c +3 -0
@@ -1283,6 +1283,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOT REACHED */
}
./arch/sparc/kernel/systbls.S +0 -0
@@ -70,7 +70,7 @@ /*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam,
sys_sched_setscheduler, sys_sched_getscheduler
/*245*/ .long sys_sched_yield, sys_sched_get_priority_max,sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep
/*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync,sys_nfsservctl
-/*255*/ .long sys_nis_syscall, sys_nis_syscall
+/*255*/ .long sys_nis_syscall, sys_nis_syscall, sys_tkill
#ifdef CONFIG_SUNOS_EMUL
/* Now the SunOS syscall table. */
./arch/mips/kernel/signal.c +3 -0
@@ -664,6 +664,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
./arch/mips/kernel/syscalls.h +2 -0
@@ -235,3 +235,5 @@ SYS(sys_madvise, 3) SYS(sys_getdents64, 3) SYS(sys_fcntl64, 3) /* 4220 */ +SYS(sys_gettid, 0) +SYS (sys_tkill,2 )
./arch/ppc/kernel/misc.S +1 -0
@@ -1121,6 +1121,7 @@ .long sys_madvise /* 205 */ .long sys_mincore .long sys_gettid + .long sys_tkill .rept NR_syscalls-(.-sys_call_table)/4 .long sys_ni_syscall .endr
./arch/ppc/kernel/signal.c +3 -0
@@ -644,6 +644,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
./arch/m68k/kernel/entry.S +2 -0
@@ -646,6 +646,8 @@ .long SYMBOL_NAME(sys_ni_syscall) .long SYMBOL_NAME(sys_ni_syscall) .long SYMBOL_NAME(sys_getdents64) /* 220 */ + .long SYMBOL_NAME(sys_gettid) + .long SYMBOL_NAME(sys_tkill) .rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4 .long SYMBOL_NAME(sys_ni_syscall)
./arch/m68k/kernel/signal.c +3 -0
@@ -1138,6 +1138,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code);
/* NOTREACHED */
}
--- linux-2.5.3/./arch/sparc64/kernel/signal32.c Mon Jan 14 12:10:44 2002
+++ linux-2.5.3-ngpt/./arch/sparc64/kernel/signal32.c Fri Feb 1 13:12:28
2002
@@ -1482,6 +1482,19 @@
sigaddset(¤t->pending.signal, signr); recalc_sigpending(current); current->flags |= PF_SIGNALED;
+
+ /*
+ * If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code);
/* NOT REACHED */
}
--- linux-2.5.3/./arch/sparc64/kernel/systbls.S Sun Oct 21 12:36:54 2001
+++ linux-2.5.3-ngpt/./arch/sparc64/kernel/systbls.S Fri Feb 1 13:12:28
2002
@@ -70,7 +70,7 @@
/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam,sys_sched_setscheduler, sys_sched_getscheduler
.word sys_sched_yield, sys_sched_get_priority_max,sys_sched_get_priority_min, sys32_sched_rr_get_interval, sys32_nanosleep
/*250*/ .word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync,sys32_nfsservctl
- .word sys_aplib
+ .word sys_aplib, sys_tkill
/* Now the 64-bit native Linux syscall table. */
@@ -129,7 +129,7 @@
/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam,sys_sched_setscheduler, sys_sched_getscheduler
.word sys_sched_yield, sys_sched_get_priority_max,sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep
/*250*/ .word sys64_mremap, sys_sysctl, sys_getsid, sys_fdatasync,sys_nfsservctl
- .word sys_aplib
+ .word sys_aplib, sys_tkill
#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
defined(CONFIG_SOLARIS_EMUL_MODULE)
./arch/sparc64/kernel/signal.c +3 -0
@@ -810,6 +810,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOT REACHED */
}
./arch/arm/kernel/calls.S +2 -0
@@ -236,6 +236,8 @@ .long SYMBOL_NAME(sys_mincore) /* 220 */ .long SYMBOL_NAME(sys_madvise) .long SYMBOL_NAME(sys_fcntl64) + .long SYMBOL_NAME(sys_gettid) + .long SYMBOL_NAME(sys_tkill) __syscall_end: .rept NR_syscalls - (__syscall_end - __syscall_start) / 4
./arch/arm/kernel/signal.c +3 -0
@@ -640,6 +640,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
./arch/sh/kernel/entry.S +2 -0
@@ -1195,6 +1195,8 @@ .long SYMBOL_NAME(sys_madvise) .long SYMBOL_NAME(sys_getdents64) /* 220 */ .long SYMBOL_NAME(sys_fcntl64) + .long SYMBOL_NAME(sys_gettid) + .long SYMBOL_NAME(sys_tkill) /* * NOTE!! This doesn't have to be exact - we just have
./arch/sh/kernel/signal.c +3 -0
@@ -676,6 +676,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
./arch/ia64/kernel/entry.S +1 -0
@@ -1130,6 +1130,7 @@ data8 sys_getdents64 data8 sys_getunwind // 1215 data8 sys_readahead + data8 sys_tkill data8 ia64_ni_syscall data8 ia64_ni_syscall data8 ia64_ni_syscall
./arch/ia64/kernel/signal.c +3 -0
@@ -581,6 +581,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
--- linux-2.5.3/./arch/mips64/kernel/scall_64.S Mon Jan 28 17:14:22 2002
+++ linux-2.5.3-ngpt/./arch/mips64/kernel/scall_64.S Fri Feb 1 13:12:28
2002
@@ -347,3 +347,5 @@
PTR sys_mincore
PTR sys_madvise
PTR sys_getdents64
+ PTR sys_gettid
+ PTR sys_tkill
--- linux-2.5.3/./arch/mips64/kernel/scall_o32.S Mon Jan 28 17:14:23 2002
+++ linux-2.5.3-ngpt/./arch/mips64/kernel/scall_o32.S Fri Feb 1 13:12:28
2002
@@ -454,6 +454,8 @@
sys sys_madvise 3
sys sys_getdents64 3
sys sys32_fcntl64 3 /* 4220 */
+ sys sys32_gettid 0
+ sys sys32_tkill 2
.endm
.macro sys function, nargs
./arch/mips64/kernel/signal.c +3 -0
@@ -688,6 +688,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code);
/* NOTREACHED */
}
--- linux-2.5.3/./arch/mips64/kernel/signal32.c Sun Sep 9 12:43:01 2001
+++ linux-2.5.3-ngpt/./arch/mips64/kernel/signal32.c Fri Feb 1 13:12:28
2002
@@ -760,6 +760,19 @@
sigaddset(¤t->pending.signal, signr); recalc_sigpending(current); current->flags |= PF_SIGNALED;
+
+ /*
+ * If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code);
/* NOTREACHED */
}
./arch/s390/kernel/entry.S +2 -0
@@ -602,6 +602,8 @@ .long sys_ni_syscall /* 224 - reserved for posix_acl */ .rept 255-224 .long sys_ni_syscall + .long sys_gettid /* 226 */ + .long sys_tkill /* 227 */ .endr /*
./arch/s390/kernel/signal.c +3 -0
@@ -566,6 +566,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
./arch/parisc/kernel/signal.c +3 -0
@@ -585,6 +585,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
./arch/parisc/kernel/syscall.S +2 -0
@@ -552,6 +552,8 @@ ENTRY_UHOH(shmctl) /* 195 */ ENTRY_SAME(ni_syscall) /* streams1 */ ENTRY_SAME(ni_syscall) /* streams2 */ + ENTRY_SAME(gettid) + ENTRY_SAME(tkill) .end
./arch/cris/kernel/entry.S +1 -0
@@ -1015,6 +1015,7 @@ .long SYMBOL_NAME(sys_ni_syscall) /* Reserved for Security */ .long SYMBOL_NAME(sys_gettid) .long SYMBOL_NAME(sys_readahead) /* 225 */ + .long SYMBOL_NAME(sys_tkill) /* * NOTE!! This doesn't have to be exact - we just have
./arch/cris/kernel/signal.c +3 -0
@@ -682,6 +682,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
./arch/s390x/kernel/entry.S +0 -0
@@ -635,6 +635,8 @@ .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* 224 - reserved for
posix_acl */
.rept 255-224 .long SYSCALL(sys_ni_syscall,sys_ni_syscall) + .long SYSCALL(sys_gettid,sys_gettid) + .long SYSCALL(sys_tkill,sys_tkill)
.endr
/*
./arch/s390x/kernel/signal.c +3 -0
@@ -572,6 +572,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
./arch/s390x/kernel/signal32.c +3 -0
@@ -702,6 +702,19 @@sigaddset (¤t->pending.signal, signr);recalc_sigpending (current); current->flags |=PF_SIGNALED ; + +/* +* If this task is in a thread group,
make sure
+ * this signal kills all tasks in the
group.
+ */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr,
&info, task);
+ }
+ }
+
do_exit(exit_code); /* NOTREACHED */
}
Your mailer does horrible things to whitespace (word wrap etc). Please fix it, the patch itself looks ok.
Linus
Oh, btw - another thing:
when you re-send with a non-broken mailer, could you please also change
all the duplication of the
+ /*
+ * If this task is in a thread group, make sure + * this signal kills all tasks in the group. + */
+ if (info.si_code != SI_TKILL) {
+ struct task_struct *task;
+
+ for_each_thread(task) {
+ force_sig_info(signr, &info, task);
+ }
+ }
+
do_exit(exit_code);
to use some common routine instead of being duplicated for each architecture. It should be easy enough to do all of this in a
do_signal_exit(signr, &info, exit_code);
and not have the same logic duplicated N times.
Linus
PATCH 1/1 Second version of signal changes for thread groups
Quoted 2 lines · --On Tuesday, February 05, 2002 17:26:22 -0800 Linus Torvalds…
Your mailer does horrible things to whitespace (word wrap etc). Please fix it, the patch itself looks ok.
My apologies. It's not my mailer that was broken, it was my brain. I accidentally set a config option wrong.
Quoted 5 lines
Oh, btw - another thing:
when you re-send with a non-broken mailer, could you please also change
all the duplication of the
(... code...)
and not have the same logic duplicated N times.
Done. Here's the corrected patch.
Dave McCracken
======================================================================
Dave McCracken IBM Linux Base Kernel Team 1-512-838-3059
[email protected] T/L 678-3059
-------------------
./kernel/fork.c +0 -0
@@ -724,10 +724,10 @@
/* Need tasklist lock for parent etc handling! */ write_lock_irq(&tasklist_lock);
- /* CLONE_PARENT and CLONE_THREAD re-use the old parent */
+ /* CLONE_PARENT re-uses the old parent */
p->p_opptr = current->p_opptr;
p->p_pptr = current->p_pptr;
- if (!(clone_flags & (CLONE_PARENT | CLONE_THREAD))) {
+ if (!(clone_flags & CLONE_PARENT)) {
p->p_opptr = current;
if (!(p->ptrace & PT_PTRACED))
p->p_pptr = current;./kernel/signal.c +0 -0
@@ -142,6 +142,35 @@
} }
+/*
+ * sig_exit - cause the current task to exit due to a signal.
+ */
+
+void
+sig_exit(int sig, int exit_code, struct siginfo *info)
+{
+ struct task_struct *t;
+
+ sigaddset(¤t->pending.signal, sig);
+ recalc_sigpending(current);
+ current->flags |= PF_SIGNALED;
+
+ /* Propagate the signal to all the tasks in
+ * our thread group
+ */
+ if (info && (unsigned long)info != 1
+ && info->si_code != SI_TKILL) {
+ read_lock(&tasklist_lock);
+ for_each_thread(t) {
+ force_sig_info(sig, info, t);
+ }
+ read_unlock(&tasklist_lock);
+ }
+
+ do_exit(exit_code);
+ /* NOTREACHED */
+}
+
/* Notify the system that a driver wants to block all signals for this
* process, and wants to be notified if any signals at all were to be
* sent/acted upon. If the notifier routine returns non-zero, then the
@@ -589,7 +618,7 @@
retval = -ESRCH;
read_lock(&tasklist_lock);
for_each_task(p) {
- if (p->pgrp == pgrp) {
+ if (p->pgrp == pgrp && thread_group_leader(p)) {
int err = send_sig_info(sig, info, p);
if (retval)
retval = err;
@@ -636,8 +665,15 @@
read_lock(&tasklist_lock);
p = find_task_by_pid(pid);
error = -ESRCH;
- if (p)
+ if (p) {
+ if (!thread_group_leader(p)) {
+ struct task_struct *tg;
+ tg = find_task_by_pid(p->tgid);
+ if (tg)
+ p = tg;
+ }
error = send_sig_info(sig, info, p);
+ }
read_unlock(&tasklist_lock);
return error;
}@@ -660,7 +696,7 @@
read_lock(&tasklist_lock);
for_each_task(p) {
- if (p->pid > 1 && p != current) {
+ if (p->pid > 1 && p != current && thread_group_leader(p)) {
int err = send_sig_info(sig, info, p);
++count;
if (err != -EPERM)
@@ -983,6 +1019,36 @@
info.si_uid = current->uid;
return kill_something_info(sig, &info, pid);+}
+
+/*
+ * Kill only one task, even if it's a CLONE_THREAD task.
+ */
+asmlinkage long
+sys_tkill(int pid, int sig)
+{
+ struct siginfo info; + int error; + struct task_struct *p;
+
+ /* This is only valid for single tasks */
+ if (pid <= 0)
+ return -EINVAL;
+
+ info.si_signo = sig;
+ info.si_errno = 0;
+ info.si_code = SI_TKILL;
+ info.si_pid = current->pid;
+ info.si_uid = current->uid;
+
+ read_lock(&tasklist_lock);
+ p = find_task_by_pid(pid);
+ error = -ESRCH;
+ if (p) {
+ error = send_sig_info(sig, &info, p);
+ }
+ read_unlock(&tasklist_lock);
+ return error;}
asmlinkage long
./include/linux/sched.h +0 -0
@@ -564,6 +564,7 @@
extern void proc_caches_init(void);
extern void flush_signals(struct task_struct *);
extern void flush_signal_handlers(struct task_struct *); +extern void sig_exit(int, int, struct siginfo *);
extern int dequeue_signal(sigset_t *, siginfo_t *);
extern void block_all_signals(int (*notifier)(void *priv), void *priv,
sigset_t *mask); @@ -839,8 +840,13 @@ #define for_each_task(p) \ for (p = &init_task ; (p = p->next_task) != &init_task ; )
+#define for_each_thread(task) \
+ for (task = next_thread(current) ; task != current ; task = next_thread(task))
+
#define next_thread(p) \ list_entry((p)->thread_group.next, struct task_struct, thread_group)
+
+#define thread_group_leader(p) (p->pid == p->tgid)
static inline void unhash_process(struct task_struct *p) {
./include/asm-i386/unistd.h +0 -0
@@ -242,6 +242,7 @@
#define __NR_removexattr 235
#define __NR_lremovexattr 236
#define __NR_fremovexattr 237
+#define __NR_tkill 238
/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
./include/asm-i386/siginfo.h +0 -0
@@ -107,6 +107,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-mips/unistd.h +0 -0
@@ -233,6 +233,8 @@
#define __NR_madvise (__NR_Linux + 218)
#define __NR_getdents64 (__NR_Linux + 219)
#define __NR_fcntl64 (__NR_Linux + 220)
+#define __NR_gettid (__NR_Linux + 221)
+#define __NR_tkill (__NR_Linux + 222)
/*
* Offset of the last Linux flavoured syscall
./include/asm-mips/siginfo.h +0 -0
@@ -127,6 +127,7 @@
#define SI_TIMER __SI_CODE(__SI_TIMER,-3) /* sent by timer expiration */
#define SI_MESGQ -4 /* sent by real time mesq state change */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-alpha/unistd.h +0 -0
@@ -318,6 +318,7 @@
#define __NR_gettid 378
#define __NR_readahead 379
#define __NR_security 380 /* syscall for security modules */
+#define __NR_tkill 381
#if defined(__GNUC__)
./include/asm-alpha/siginfo.h +0 -0
@@ -107,6 +107,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-m68k/unistd.h +0 -0
@@ -222,6 +222,8 @@
#define __NR_setfsuid32 215
#define __NR_setfsgid32 216
#define __NR_getdents64 220
+#define __NR_gettid 221
+#define __NR_tkill 222
/* user-visible error numbers are in the range -1 - -122: see
<asm-m68k/errno.h> */
./include/asm-m68k/siginfo.h +0 -0
@@ -117,6 +117,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-sparc/unistd.h +0 -0
@@ -271,6 +271,7 @@
#define __NR_fdatasync 253 #define __NR_nfsservctl 254 #define __NR_aplib 255
+#define __NR_tkill 257
#define _syscall0(type,name) \
type name(void) \
./include/asm-sparc/siginfo.h +0 -0
@@ -112,6 +112,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-ppc/unistd.h +0 -0
@@ -215,6 +215,7 @@
#define __NR_madvise 205
#define __NR_mincore 206
#define __NR_gettid 207
+#define __NR_tkill 208
#define __NR(n) #n
./include/asm-ppc/siginfo.h +0 -0
@@ -108,6 +108,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-sparc64/unistd.h +0 -0
@@ -273,6 +273,7 @@
#define __NR_fdatasync 253 #define __NR_nfsservctl 254 #define __NR_aplib 255
+#define __NR_tkill 256
#define _syscall0(type,name) \
type name(void) \
./include/asm-sparc64/siginfo.h +0 -0
@@ -172,6 +172,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-arm/siginfo.h +0 -0
@@ -107,6 +107,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-sh/siginfo.h +0 -0
@@ -107,6 +107,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-sh/unistd.h +0 -0
@@ -231,6 +231,8 @@
#define __NR_madvise 219
#define __NR_getdents64 220
#define __NR_fcntl64 221
+#define __NR_gettid 222
+#define __NR_tkill 223
/* user-visible error numbers are in the range -1 - -125: see <asm-sh/errno.h> */
./include/asm-ia64/siginfo.h +0 -0
@@ -124,6 +124,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-ia64/unistd.h +0 -0
@@ -206,6 +206,7 @@
#define __NR_getdents64 1214
#define __NR_getunwind 1215
#define __NR_readahead 1216
+#define __NR_tkill 1217
#if !defined(__ASSEMBLY__) && !defined(ASSEMBLER)
./include/asm-mips64/siginfo.h +0 -0
@@ -127,6 +127,7 @@
#define SI_TIMER __SI_CODE(__SI_TIMER,-3) /* sent by timer expiration */
#define SI_MESGQ -4 /* sent by real time mesq state change */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-mips64/unistd.h +0 -0
@@ -461,11 +461,13 @@
#define __NR_mincore (__NR_Linux + 211)
#define __NR_madvise (__NR_Linux + 212)
#define __NR_getdents64 (__NR_Linux + 213)
+#define __NR_gettid (__NR_Linux + 214)
+#define __NR_tkill (__NR_Linux + 215)
/*
* Offset of the last Linux flavoured syscall
*/
-#define __NR_Linux_syscalls 213
+#define __NR_Linux_syscalls 215
#ifndef _LANGUAGE_ASSEMBLY
./include/asm-s390/siginfo.h +0 -0
@@ -115,6 +115,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-s390/unistd.h +0 -0
@@ -211,6 +211,8 @@
#define __NR_mincore 218
#define __NR_madvise 219
#define __NR_getdents64 220
+#define __NR_gettid 226
+#define __NR_tkill 227
/* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
./include/asm-parisc/siginfo.h +0 -0
@@ -107,6 +107,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-parisc/unistd.h +0 -0
@@ -689,8 +689,10 @@
#define __NR_getpmsg (__NR_Linux + 196) /* some people actually want streams */ #define __NR_putpmsg (__NR_Linux + 197) /* some people actually want streams */
+#define __NR_gettid (__NR_Linux + 198)
+#define __NR_tkill (__NR_Linux + 199)
-#define __NR_Linux_syscalls 197
+#define __NR_Linux_syscalls 199
#define HPUX_GATEWAY_ADDR 0xC0000004
#define LINUX_GATEWAY_ADDR 0x100
./include/asm-cris/siginfo.h +0 -0
@@ -107,6 +107,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./include/asm-cris/unistd.h +0 -0
@@ -230,6 +230,7 @@
#define __NR_security 223 /* syscall for security modules */ #define __NR_gettid 224 #define __NR_readahead 225
+#define __NR_tkill 226
/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */ #define _syscall0(type,name) \
./include/asm-s390x/unistd.h +0 -0
@@ -181,6 +181,8 @@
#define __NR_mincore 218 #define __NR_madvise 219 #define __NR_getdents64 220
+#define __NR_gettid 226
+#define __NR_tkill 227
/* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
./include/asm-s390x/siginfo.h +0 -0
@@ -115,6 +115,7 @@
#define SI_MESGQ -3 /* sent by real time mesq state change */
#define SI_ASYNCIO -4 /* sent by AIO completion */
#define SI_SIGIO -5 /* sent by queued SIGIO */
+#define SI_TKILL -6 /* sent by tkill system call */
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
./arch/i386/kernel/entry.S +0 -0
@@ -667,6 +667,7 @@
.long SYMBOL_NAME(sys_removexattr) /* 235 */ .long SYMBOL_NAME(sys_lremovexattr) .long SYMBOL_NAME(sys_fremovexattr)
+ .long SYMBOL_NAME(sys_tkill)
.rept NR_syscalls-(.-sys_call_table)/4 .long SYMBOL_NAME(sys_ni_syscall)
./arch/i386/kernel/signal.c +0 -0
@@ -683,10 +683,7 @@
/* FALLTHRU */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/alpha/kernel/entry.S +0 -0
@@ -1148,3 +1148,4 @@
.quad sys_gettid .quad sys_readahead .quad sys_ni_syscall /* 380, sys_security */
+ .quad sys_tkill
./arch/alpha/kernel/signal.c +0 -0
@@ -717,9 +717,7 @@
default: lock_kernel(); - sigaddset(¤t->pending.signal, signr); - current->flags |= PF_SIGNALED; - do_exit(exit_code); + sig_exit(signr, exit_code, &info); /* NOTREACHED */ } continue;
./arch/sparc/kernel/signal.c +0 -0
@@ -1280,10 +1280,7 @@
#endif /* fall through */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOT REACHED */ } }
./arch/sparc/kernel/systbls.S +0 -0
@@ -70,7 +70,7 @@
/*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
/*245*/ .long sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep
/*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
-/*255*/ .long sys_nis_syscall, sys_nis_syscall
+/*255*/ .long sys_nis_syscall, sys_nis_syscall, sys_tkill
#ifdef CONFIG_SUNOS_EMUL /* Now the SunOS syscall table. */
./arch/mips/kernel/signal.c +0 -0
@@ -661,10 +661,7 @@
/* FALLTHRU */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/mips/kernel/syscalls.h +0 -0
@@ -235,3 +235,5 @@
SYS(sys_madvise, 3)SYS(sys_getdents64, 3)SYS(sys_fcntl64, 3) /* 4220 */
+SYS(sys_gettid, 0)
+SYS(sys_tkill, 2)
./arch/ppc/kernel/misc.S +0 -0
@@ -1121,6 +1121,7 @@
.long sys_madvise /* 205 */ .long sys_mincore .long sys_gettid + .long sys_tkill .rept NR_syscalls-(.-sys_call_table)/4 .long sys_ni_syscall .endr
./arch/ppc/kernel/signal.c +0 -0
@@ -641,10 +641,7 @@
/* FALLTHRU */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/m68k/kernel/entry.S +0 -0
@@ -646,6 +646,8 @@
.long SYMBOL_NAME(sys_ni_syscall) .long SYMBOL_NAME(sys_ni_syscall) .long SYMBOL_NAME(sys_getdents64) /* 220 */
+ .long SYMBOL_NAME(sys_gettid)
+ .long SYMBOL_NAME(sys_tkill)
.rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4 .long SYMBOL_NAME(sys_ni_syscall)
./arch/m68k/kernel/signal.c +0 -0
@@ -1135,10 +1135,7 @@
/* FALLTHRU */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/sparc64/kernel/signal32.c +0 -0
@@ -1479,10 +1479,7 @@
#endif /* fall through */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOT REACHED */ } }
./arch/sparc64/kernel/systbls.S +0 -0
@@ -70,7 +70,7 @@
/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
.word sys_sched_yield, sys_sched_get_priority_max,sys_sched_get_priority_min, sys32_sched_rr_get_interval, sys32_nanosleep
/*250*/ .word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, sys32_nfsservctl
- .word sys_aplib
+ .word sys_aplib, sys_tkill
/* Now the 64-bit native Linux syscall table. */
@@ -129,7 +129,7 @@
/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
.word sys_sched_yield, sys_sched_get_priority_max,sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep
/*250*/ .word sys64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
- .word sys_aplib
+ .word sys_aplib, sys_tkill
#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
defined(CONFIG_SOLARIS_EMUL_MODULE)
./arch/sparc64/kernel/signal.c +0 -0
@@ -807,10 +807,7 @@
#endif /* fall through */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOT REACHED */ } }
./arch/arm/kernel/calls.S +0 -0
@@ -236,6 +236,8 @@
.long SYMBOL_NAME(sys_mincore)
/* 220 */ .long SYMBOL_NAME(sys_madvise)
.long SYMBOL_NAME(sys_fcntl64)
+ .long SYMBOL_NAME(sys_gettid)
+ .long SYMBOL_NAME(sys_tkill)__syscall_end:
.rept NR_syscalls - (__syscall_end - __syscall_start) / 4
./arch/arm/kernel/signal.c +0 -0
@@ -637,10 +637,7 @@
/* FALLTHRU */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/sh/kernel/entry.S +0 -0
@@ -1195,6 +1195,8 @@
.long SYMBOL_NAME(sys_madvise) .long SYMBOL_NAME(sys_getdents64) /* 220 */ .long SYMBOL_NAME(sys_fcntl64)
+ .long SYMBOL_NAME(sys_gettid)
+ .long SYMBOL_NAME(sys_tkill)
/* * NOTE!! This doesn't have to be exact - we just have
./arch/sh/kernel/signal.c +0 -0
@@ -673,10 +673,7 @@
/* FALLTHRU */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/ia64/kernel/entry.S +0 -0
@@ -1130,6 +1130,7 @@
data8 sys_getdents64 data8 sys_getunwind // 1215 data8 sys_readahead
+ data8 sys_tkill
data8 ia64_ni_syscall
data8 ia64_ni_syscall
data8 ia64_ni_syscall
./arch/ia64/kernel/signal.c +0 -0
@@ -578,10 +578,7 @@
/* FALLTHRU */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/mips64/kernel/scall_64.S +0 -0
@@ -347,3 +347,5 @@
PTR sys_mincore
PTR sys_madvise
PTR sys_getdents64
+ PTR sys_gettid
+ PTR sys_tkill
./arch/mips64/kernel/scall_o32.S +0 -0
@@ -454,6 +454,8 @@
sys sys_madvise 3 sys sys_getdents64 3 sys sys32_fcntl64 3 /* 4220 */
+ sys sys32_gettid 0
+ sys sys32_tkill 2
.endm
.macro sys function, nargs
./arch/mips64/kernel/signal.c +0 -0
@@ -685,10 +685,7 @@
/* FALLTHRU */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/mips64/kernel/signal32.c +0 -0
@@ -757,10 +757,7 @@
/* FALLTHRU */ default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/s390/kernel/entry.S +0 -0
@@ -602,6 +602,8 @@
.long sys_ni_syscall /* 224 - reserved for posix_acl */ .rept 255-224 .long sys_ni_syscall
+ .long sys_gettid /* 226 */
+ .long sys_tkill /* 227 */
.endr
/*
./arch/s390/kernel/signal.c +0 -0
@@ -563,10 +563,7 @@/* FALLTHRU */
default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/parisc/kernel/signal.c +0 -0
@@ -581,11 +581,7 @@
/* FALLTHRU */ default:
- lock_kernel();
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/parisc/kernel/syscall.S +0 -0
@@ -552,6 +552,8 @@
ENTRY_UHOH(shmctl) /* 195 */ ENTRY_SAME(ni_syscall) /* streams1 */ ENTRY_SAME(ni_syscall) /* streams2 */
+ ENTRY_SAME(gettid)
+ ENTRY_SAME(tkill)
.end
./arch/cris/kernel/entry.S +1 -0
@@ -1015,6 +1015,7 @@ .long SYMBOL_NAME(sys_ni_syscall) /* Reserved for Security */ .long SYMBOL_NAME(sys_gettid) .long SYMBOL_NAME(sys_readahead) /* 225 */ + .long SYMBOL_NAME(sys_tkill) /* * NOTE!! This doesn't have to be exact - we just have
./arch/cris/kernel/signal.c +0 -0
@@ -679,10 +679,7 @@
default: lock_kernel();
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/s390x/kernel/entry.S +0 -0
@@ -635,6 +635,8 @@
.long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* 224 - reserved forposix_acl */
.rept 255-224 .long SYSCALL(sys_ni_syscall,sys_ni_syscall)
+ .long SYSCALL(sys_gettid,sys_gettid)
+ .long SYSCALL(sys_tkill,sys_tkill)
.endr
/*
./arch/s390x/kernel/signal.c +0 -0
@@ -569,10 +569,7 @@/* FALLTHRU */
default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
./arch/s390x/kernel/signal32.c +0 -0
@@ -699,10 +699,7 @@/* FALLTHRU */
default:
- sigaddset(¤t->pending.signal, signr);
- recalc_sigpending(current);
- current->flags |= PF_SIGNALED;
- do_exit(exit_code);
+ sig_exit(signr, exit_code, &info); /* NOTREACHED */ } }
Re: [PATCH 2.5.3] Second version of signal changes for thread groups
Quoted 9 lines · Dave McCracken
--On Tuesday, February 05, 2002 17:26:22 -0800 Linus Torvalds
Quoted 2 lines · <[email protected]> wrote:
Your mailer does horrible things to whitespace (word wrap etc). Please fix it, the patch itself looks ok.
My apologies. It's not my mailer that was broken, it was my brain. I accidentally set a config option wrong.
This one was broken too, I get whitespace removed at end of lines, and lines wrapped. I think it's the "format=flowed" part of
Content-Type: text/plain; charset=us-ascii; format=flowed
and I'm fairly sure it's from your end (ie I have other emails in my folder that do not have these problems).
You seem to be using Mulberry, I'm sure there must be some way to fix it, but I don't know mb myself.
(I can edit and hand-apply patches like these, but I hate to do it, and I really really hate to have developers with broken mail configurations, so I'd rather go through this several times to get it fixed than to work around it)
Linus
PATCH 1/1 Third version of signal changes for thread groups
Quoted 2 lines · --On Wednesday, February 06, 2002 09:40:05 -0800 Linus Torvalds…
You seem to be using Mulberry, I'm sure there must be some way to fix it, but I don't know mb myself.
Yes, and I was under the mistaken belief that it worked reasonably. I think I've found a workaround now, with the help of other Mulberry users here. Here's my latest attempt.
Quoted 4 lines
(I can edit and hand-apply patches like these, but I hate to do it, and I really really hate to have developers with broken mail configurations, so I'd rather go through this several times to get it fixed than to work around it)
I absolutely agree. I'm also anxious to get this nailed down. Thanks for putting up with my attempts.
Dave McCracken
======================================================================
Dave McCracken IBM Linux Base Kernel Team 1-512-838-3059
[email protected] T/L 678-3059
-----------------------
./kernel/fork.c +2 -2
@@ -724,10 +724,10 @@/* Need tasklist lock for parent etc handling! */ write_lock_irq (&tasklist_lock); -/* CLONE_PARENT and CLONE_THREAD re-use the old parent */ +/* CLONE_PARENT re-uses the old parent */ p->p_opptr = current->p_opptr; p->p_pptr = current->p_pptr; -if (!(clone_flags & (CLONE_PARENT |CLONE_THREAD ))) { +if (!(clone_flags &CLONE_PARENT )) { p->p_opptr = current;if (!(p->ptrace &PT_PTRACED )) p->p_pptr = current;
./kernel/signal.c +69 -3
103 lines not on this page · raw message
./include/linux/sched.h +6 -0
@@ -564,6 +564,7 @@extern void proc_caches_init (void );extern void flush_signals (struct task_struct *);extern void flush_signal_handlers (struct task_struct *); +extern void sig_exit (int ,int ,struct siginfo *);extern int dequeue_signal (sigset_t *,siginfo_t *);extern void block_all_signals (int (*notifier)(void *priv),void *priv,sigset_t *mask);
@@ -839,8 +840,13 @@#define for_each_task (p) \ for (p = &init_task ; (p = p->next_task) != &init_task ; ) +#define for_each_thread (task) \ + for (task = next_thread(current) ; task != current ; task = next_thread(task)) +#define next_thread (p) \ list_entry((p)->thread_group.next, struct task_struct, thread_group) + +#define thread_group_leader (p) (p->pid == p->tgid)static inline void unhash_process (struct task_struct *p) {
./include/asm-i386/unistd.h +1 -0
@@ -242,6 +242,7 @@#define __NR_removexattr 235#define __NR_lremovexattr 236#define __NR_fremovexattr 237 +#define __NR_tkill 238/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
./include/asm-i386/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-mips/unistd.h +2 -0
@@ -233,6 +233,8 @@#define __NR_madvise (__NR_Linux + 218)#define __NR_getdents64 (__NR_Linux + 219)#define __NR_fcntl64 (__NR_Linux + 220) +#define __NR_gettid (__NR_Linux + 221) +#define __NR_tkill (__NR_Linux + 222)/* * Offset of the last Linux flavoured syscall
./include/asm-mips/siginfo.h +1 -0
@@ -127,6 +127,7 @@#define SI_TIMER __SI_CODE(__SI_TIMER,-3)/* sent by timer expiration */ #define SI_MESGQ -4/* sent by real time mesq state change */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-alpha/unistd.h +1 -0
@@ -318,6 +318,7 @@#define __NR_gettid 378#define __NR_readahead 379#define __NR_security 380/* syscall for security modules */ +#define __NR_tkill 381#if defined(__GNUC__)
./include/asm-alpha/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-m68k/unistd.h +2 -0
@@ -222,6 +222,8 @@#define __NR_setfsuid32 215#define __NR_setfsgid32 216#define __NR_getdents64 220 +#define __NR_gettid 221 +#define __NR_tkill 222/* user-visible error numbers are in the range -1 - -122: see <asm-m68k/errno.h> */
./include/asm-m68k/siginfo.h +1 -0
@@ -117,6 +117,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-sparc/unistd.h +1 -0
@@ -271,6 +271,7 @@#define __NR_fdatasync 253#define __NR_nfsservctl 254#define __NR_aplib 255 +#define __NR_tkill 257#define _syscall0 (type,name) \ type name(void) \
./include/asm-sparc/siginfo.h +1 -0
@@ -112,6 +112,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-ppc/unistd.h +1 -0
@@ -215,6 +215,7 @@#define __NR_madvise 205#define __NR_mincore 206#define __NR_gettid 207 +#define __NR_tkill 208#define __NR (n) #n
./include/asm-ppc/siginfo.h +1 -0
@@ -108,6 +108,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-sparc64/unistd.h +1 -0
@@ -273,6 +273,7 @@#define __NR_fdatasync 253#define __NR_nfsservctl 254#define __NR_aplib 255 +#define __NR_tkill 256#define _syscall0 (type,name) \ type name(void) \
./include/asm-sparc64/siginfo.h +1 -0
@@ -172,6 +172,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-arm/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-sh/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-sh/unistd.h +2 -0
@@ -231,6 +231,8 @@#define __NR_madvise 219#define __NR_getdents64 220#define __NR_fcntl64 221 +#define __NR_gettid 222 +#define __NR_tkill 223/* user-visible error numbers are in the range -1 - -125: see <asm-sh/errno.h> */
./include/asm-ia64/siginfo.h +1 -0
@@ -124,6 +124,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-ia64/unistd.h +1 -0
@@ -206,6 +206,7 @@#define __NR_getdents64 1214#define __NR_getunwind 1215#define __NR_readahead 1216 +#define __NR_tkill 1217#if !defined(__ASSEMBLY__) && !defined(ASSEMBLER )
./include/asm-mips64/siginfo.h +1 -0
@@ -127,6 +127,7 @@#define SI_TIMER __SI_CODE(__SI_TIMER,-3)/* sent by timer expiration */ #define SI_MESGQ -4/* sent by real time mesq state change */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-mips64/unistd.h +3 -1
@@ -461,11 +461,13 @@#define __NR_mincore (__NR_Linux + 211)#define __NR_madvise (__NR_Linux + 212)#define __NR_getdents64 (__NR_Linux + 213) +#define __NR_gettid (__NR_Linux + 214) +#define __NR_tkill (__NR_Linux + 215)/* * Offset of the last Linux flavoured syscall */ -#define __NR_Linux_syscalls 213 +#define __NR_Linux_syscalls 215#ifndef _LANGUAGE_ASSEMBLY
./include/asm-s390/siginfo.h +1 -0
@@ -115,6 +115,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-s390/unistd.h +2 -0
@@ -211,6 +211,8 @@#define __NR_mincore 218#define __NR_madvise 219#define __NR_getdents64 220 +#define __NR_gettid 226 +#define __NR_tkill 227/* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
./include/asm-parisc/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-parisc/unistd.h +3 -1
@@ -689,8 +689,10 @@#define __NR_getpmsg (__NR_Linux + 196)/* some people actually want streams */ #define __NR_putpmsg (__NR_Linux + 197)/* some people actually want streams */ +#define __NR_gettid (__NR_Linux + 198) +#define __NR_tkill (__NR_Linux + 199) -#define __NR_Linux_syscalls 197 +#define __NR_Linux_syscalls 199#define HPUX_GATEWAY_ADDR 0xC0000004#define LINUX_GATEWAY_ADDR 0x100
./include/asm-cris/siginfo.h +1 -0
@@ -107,6 +107,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./include/asm-cris/unistd.h +1 -0
@@ -230,6 +230,7 @@#define __NR_security 223/* syscall for security modules */ #define __NR_gettid 224#define __NR_readahead 225 +#define __NR_tkill 226/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */ #define _syscall0 (type,name) \
./include/asm-s390x/unistd.h +2 -0
@@ -181,6 +181,8 @@#define __NR_mincore 218#define __NR_madvise 219#define __NR_getdents64 220 +#define __NR_gettid 226 +#define __NR_tkill 227/* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
./include/asm-s390x/siginfo.h +1 -0
@@ -115,6 +115,7 @@#define SI_MESGQ -3/* sent by real time mesq state change */ #define SI_ASYNCIO -4/* sent by AIO completion */ #define SI_SIGIO -5/* sent by queued SIGIO */ +#define SI_TKILL -6/* sent by tkill system call */ #define SI_FROMUSER (siptr) ((siptr)->si_code <= 0)#define SI_FROMKERNEL (siptr) ((siptr)->si_code > 0)
./arch/i386/kernel/entry.S +1 -0
@@ -667,6 +667,7 @@ .long SYMBOL_NAME(sys_removexattr) /* 235 */ .long SYMBOL_NAME(sys_lremovexattr) .long SYMBOL_NAME(sys_fremovexattr) + .long SYMBOL_NAME(sys_tkill) .rept NR_syscalls-(.-sys_call_table)/4 .long SYMBOL_NAME(sys_ni_syscall)
./arch/i386/kernel/signal.c +1 -4
@@ -683,10 +683,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/alpha/kernel/entry.S +1 -0
@@ -1148,3 +1148,4 @@ .quad sys_gettid .quad sys_readahead .quad sys_ni_syscall /* 380, sys_security */ + .quad sys_tkill
./arch/alpha/kernel/signal.c +1 -3
@@ -717,9 +717,7 @@default :lock_kernel (); -sigaddset (¤t->pending.signal, signr); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ }continue ;
./arch/sparc/kernel/signal.c +1 -4
@@ -1280,10 +1280,7 @@#endif /* fall through */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOT REACHED */ } }
./arch/sparc/kernel/systbls.S +1 -1
@@ -70,7 +70,7 @@ /*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler /*245*/ .long sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep /*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl -/*255*/ .long sys_nis_syscall, sys_nis_syscall +/*255*/ .long sys_nis_syscall, sys_nis_syscall, sys_tkill #ifdef CONFIG_SUNOS_EMUL /* Now the SunOS syscall table. */
./arch/mips/kernel/signal.c +1 -4
@@ -661,10 +661,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/mips/kernel/syscalls.h +2 -0
@@ -235,3 +235,5 @@ SYS(sys_madvise, 3) SYS(sys_getdents64, 3) SYS(sys_fcntl64, 3) /* 4220 */ +SYS(sys_gettid, 0) +SYS (sys_tkill,2 )
./arch/ppc/kernel/misc.S +1 -0
@@ -1121,6 +1121,7 @@ .long sys_madvise /* 205 */ .long sys_mincore .long sys_gettid + .long sys_tkill .rept NR_syscalls-(.-sys_call_table)/4 .long sys_ni_syscall .endr
./arch/ppc/kernel/signal.c +1 -4
@@ -641,10 +641,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/m68k/kernel/entry.S +2 -0
@@ -646,6 +646,8 @@ .long SYMBOL_NAME(sys_ni_syscall) .long SYMBOL_NAME(sys_ni_syscall) .long SYMBOL_NAME(sys_getdents64) /* 220 */ + .long SYMBOL_NAME(sys_gettid) + .long SYMBOL_NAME(sys_tkill) .rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4 .long SYMBOL_NAME(sys_ni_syscall)
./arch/m68k/kernel/signal.c +1 -4
@@ -1135,10 +1135,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/sparc64/kernel/signal32.c +1 -4
@@ -1479,10 +1479,7 @@#endif /* fall through */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOT REACHED */ } }
./arch/sparc64/kernel/systbls.S +2 -2
@@ -70,7 +70,7 @@ /*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler .word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, sys32_nanosleep /*250*/ .word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, sys32_nfsservctl - .word sys_aplib + .word sys_aplib, sys_tkill /* Now the 64-bit native Linux syscall table. */
@@ -129,7 +129,7 @@ /*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler .word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep /*250*/ .word sys64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl - .word sys_aplib + .word sys_aplib, sys_tkill #if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ defined(CONFIG_SOLARIS_EMUL_MODULE)
./arch/sparc64/kernel/signal.c +1 -4
@@ -807,10 +807,7 @@#endif /* fall through */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOT REACHED */ } }
./arch/arm/kernel/calls.S +2 -0
@@ -236,6 +236,8 @@ .long SYMBOL_NAME(sys_mincore) /* 220 */ .long SYMBOL_NAME(sys_madvise) .long SYMBOL_NAME(sys_fcntl64) + .long SYMBOL_NAME(sys_gettid) + .long SYMBOL_NAME(sys_tkill) __syscall_end: .rept NR_syscalls - (__syscall_end - __syscall_start) / 4
./arch/arm/kernel/signal.c +1 -4
@@ -637,10 +637,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/sh/kernel/entry.S +2 -0
@@ -1195,6 +1195,8 @@ .long SYMBOL_NAME(sys_madvise) .long SYMBOL_NAME(sys_getdents64) /* 220 */ .long SYMBOL_NAME(sys_fcntl64) + .long SYMBOL_NAME(sys_gettid) + .long SYMBOL_NAME(sys_tkill) /* * NOTE!! This doesn't have to be exact - we just have
./arch/sh/kernel/signal.c +1 -4
@@ -673,10 +673,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/ia64/kernel/entry.S +1 -0
@@ -1130,6 +1130,7 @@ data8 sys_getdents64 data8 sys_getunwind // 1215 data8 sys_readahead + data8 sys_tkill data8 ia64_ni_syscall data8 ia64_ni_syscall data8 ia64_ni_syscall
./arch/ia64/kernel/signal.c +1 -4
@@ -578,10 +578,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/mips64/kernel/scall_64.S +2 -0
@@ -347,3 +347,5 @@ PTR sys_mincore PTR sys_madvise PTR sys_getdents64 + PTR sys_gettid + PTR sys_tkill
./arch/mips64/kernel/scall_o32.S +2 -0
@@ -454,6 +454,8 @@ sys sys_madvise 3 sys sys_getdents64 3 sys sys32_fcntl64 3 /* 4220 */ + sys sys32_gettid 0 + sys sys32_tkill 2 .endm .macro sys function, nargs
./arch/mips64/kernel/signal.c +1 -4
@@ -685,10 +685,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/mips64/kernel/signal32.c +1 -4
@@ -757,10 +757,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/s390/kernel/entry.S +2 -0
@@ -602,6 +602,8 @@ .long sys_ni_syscall /* 224 - reserved for posix_acl */ .rept 255-224 .long sys_ni_syscall + .long sys_gettid /* 226 */ + .long sys_tkill /* 227 */ .endr /*
./arch/s390/kernel/signal.c +1 -4
@@ -563,10 +563,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/parisc/kernel/signal.c +1 -5
@@ -581,11 +581,7 @@/* FALLTHRU */ default : -lock_kernel (); -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/parisc/kernel/syscall.S +2 -0
@@ -552,6 +552,8 @@ ENTRY_UHOH(shmctl) /* 195 */ ENTRY_SAME(ni_syscall) /* streams1 */ ENTRY_SAME(ni_syscall) /* streams2 */ + ENTRY_SAME(gettid) + ENTRY_SAME(tkill) .end
./arch/cris/kernel/entry.S +1 -0
@@ -1015,6 +1015,7 @@ .long SYMBOL_NAME(sys_ni_syscall) /* Reserved for Security */ .long SYMBOL_NAME(sys_gettid) .long SYMBOL_NAME(sys_readahead) /* 225 */ + .long SYMBOL_NAME(sys_tkill) /* * NOTE!! This doesn't have to be exact - we just have
./arch/cris/kernel/signal.c +1 -4
@@ -679,10 +679,7 @@default :lock_kernel (); -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/s390x/kernel/entry.S +2 -0
@@ -635,6 +635,8 @@ .long SYSCALL(sys_ni_syscall,sys_ni_syscall) /* 224 - reserved for posix_acl */ .rept 255-224 .long SYSCALL(sys_ni_syscall,sys_ni_syscall) + .long SYSCALL(sys_gettid,sys_gettid) + .long SYSCALL(sys_tkill,sys_tkill) .endr /*
./arch/s390x/kernel/signal.c +1 -4
@@ -569,10 +569,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
./arch/s390x/kernel/signal32.c +1 -4
@@ -699,10 +699,7 @@/* FALLTHRU */ default : -sigaddset (¤t->pending.signal, signr); -recalc_sigpending (current); - current->flags |=PF_SIGNALED ; -do_exit (exit_code); +sig_exit (signr, exit_code, &info);/* NOTREACHED */ } }
Re: [PATCH 2.5.3] Third version of signal changes for thread groups
Quoted 4 lines · Dave McCracken
Yes, and I was under the mistaken belief that it worked reasonably. I think I've found a workaround now, with the help of other Mulberry users here. Here's my latest attempt.
Yup, that fixed it. Thanks.
Linus