linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kill(-1,sig)
@ 2001-12-14 17:34 Andries.Brouwer
  2001-12-14 20:25 ` Linus Torvalds
  2001-12-14 20:36 ` Simon Kirby
  0 siblings, 2 replies; 26+ messages in thread
From: Andries.Brouwer @ 2001-12-14 17:34 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

The new POSIX 1003.1-2001 is explicit about what kill(-1,sig)
is supposed to do. Maybe we should follow it.

Andries

--- signal.c~	Thu Nov 22 01:26:27 2001
+++ signal.c	Fri Dec 14 18:27:34 2001
@@ -649,8 +649,10 @@
 /*
  * kill_something_info() interprets pid in interesting ways just like kill(2).
  *
- * POSIX specifies that kill(-1,sig) is unspecified, but what we have
- * is probably wrong.  Should make it like BSD or SYSV.
+ * POSIX (2001) specifies "If pid is -1, sig shall be sent to all processes
+ * (excluding an unspecified set of system processes) for which the process
+ * has permission to send that signal."
+ * So, probably the process should also signal itself.
  */
 
 static int kill_something_info(int sig, struct siginfo *info, int pid)
@@ -663,7 +665,7 @@
 
 		read_lock(&tasklist_lock);
 		for_each_task(p) {
-			if (p->pid > 1 && p != current) {
+			if (p->pid > 1) {
 				int err = send_sig_info(sig, info, p);
 				++count;
 				if (err != -EPERM)

^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [PATCH] kill(-1,sig)
@ 2001-12-14 21:22 Andries.Brouwer
  0 siblings, 0 replies; 26+ messages in thread
From: Andries.Brouwer @ 2001-12-14 21:22 UTC (permalink / raw)
  To: sim, torvalds; +Cc: Andries.Brouwer, linux-kernel

> Of course, a language lawyer will call "self" a "system process"

No, the standard very explicitly allow signalling oneself.
(And Linux also allowed that, e.g. in kill(0,sig), only until now
not in kill(-1,sig).)

>> Argh, I hate this.  I fail to see what progress a process could make
>> if it kills everything _and_ itself.

Note that kill() is just a function that sends a signal.
The signal may well be SIGWINCH or SIGSTOP or so.

Andries

^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [PATCH] kill(-1,sig)
@ 2001-12-17  7:01 Richard Gooch
  2001-12-17 11:41 ` vda
  2001-12-17 16:41 ` Richard Gooch
  0 siblings, 2 replies; 26+ messages in thread
From: Richard Gooch @ 2001-12-17  7:01 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

  Hi, all. To followup on the change in 2.5.1 which sends a signal to
the signalling process when send_pid==-1, I have a definate case where
the new behaviour is highly undesirable, and I would say broken.

shutdown(8) from util-linux (*not* the version that comes with the
bloated monstrosity known as SysVInit) uses the sequence:
	kill (-1, SIGTERM);
	sleep (2);
	kill (-1, SIGKILL);

to ensure that all processes not stuck in 'D' state are killed.

With the new behaviour, shutdown(8) ends up killing itself. This is no
good, because the shutdown process doesn't complete (i.e. unmounting
of filesystems, calling sync(2) and good stuff like that).

If this change remains, it will break all users of
simpleinit(8)/shutdown(8). I'm not happy about moving logic for
shutdown(8) into simpleinit(8), since it will just end up bloating it
without good reason.

				Regards,

					Richard....
Permanent: rgooch@atnf.csiro.au
Current:   rgooch@ras.ucalgary.ca

^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [PATCH] kill(-1,sig)
@ 2001-12-17 23:38 Andries.Brouwer
  0 siblings, 0 replies; 26+ messages in thread
From: Andries.Brouwer @ 2001-12-17 23:38 UTC (permalink / raw)
  To: torvalds; +Cc: Andries.Brouwer, acahalan, gandalf, linux-kernel, reality, sim

Andries:

  The new POSIX 1003.1-2001 is explicit about what kill(-1,sig)
  is supposed to do. Maybe we should follow it.

Linus:

  Note that I've reverted the kill(-1...) thing in my personal tree: so far
  I've gotten a lot of negative feedback, and the change doesn't seem to
  actually buy us anything except for conformance to a unclearly weasel-
  worded standards sentence where we could be even more weasely and just say
  that "self" is a special process from the systems perspective.


Well, maybe you are too pessimistic, but I do not disagree
with your action (since I cannot easily see a better one).

There have been two discussion fragments: firstly people that muttered
that it is a pity when "kill -9 -1" kills their shell.
I do not care, especially since we got the reports that that also
happens on Digital UNIX and on Solaris.

And secondly people that complain that now their shutdown sequence
is broken. That is more serious: it became difficult for a program
other than init to handle the shutdown.

"self" is a nice and clean concept; I do not see anything clean
it could be replaced with.  I wonder what other systems do.

Andries


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2001-12-18 18:36 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-14 17:34 [PATCH] kill(-1,sig) Andries.Brouwer
2001-12-14 20:25 ` Linus Torvalds
2001-12-17  9:34   ` Chris Wright
2001-12-17 14:41     ` vda
2001-12-17 11:53       ` Sean Hunter
2001-12-17 12:06         ` Matthew Kirkwood
2001-12-17 12:30           ` Sean Hunter
2001-12-17 12:16         ` Miquel van Smoorenburg
2001-12-17 16:06         ` vda
2001-12-14 20:36 ` Simon Kirby
2001-12-14 20:40   ` Linus Torvalds
2001-12-14 20:49     ` Simon Kirby
2001-12-15 10:19     ` Albert D. Cahalan
2001-12-15 14:03       ` Martin Josefsson
2001-12-15 23:09       ` Simon Kirby
2001-12-16  8:26         ` Albert D. Cahalan
2001-12-17  8:50     ` Helge Hafting
2001-12-17 20:51     ` Udo A. Steinberg
2001-12-17 21:13       ` Linus Torvalds
2001-12-17 22:06         ` Richard B. Johnson
2001-12-18 17:27   ` Alan Cox
2001-12-14 21:22 Andries.Brouwer
2001-12-17  7:01 Richard Gooch
2001-12-17 11:41 ` vda
2001-12-17 16:41 ` Richard Gooch
2001-12-17 23:38 Andries.Brouwer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).