Messages in this thread | | | From | (Robey Pointer) | Subject | Re: Kill system call | Date | Thu, 21 Mar 1996 16:28:15 -0800 (PST) |
| |
Theodore Ts'o said this, and I just had to respond: > > POSIX.1 states: > > 3.2.2.2 Description of kill() > > "...If sig is zero (the null signal), error checking is performed, but no > signal is actually sent. The null signal can be used to check the > validity of pid...." > [...] > > So technically, what we're doing is allowed by POSIX.1, and POSIX is > somewhat ambiguous about whether or not the OS must return an error when > sig is 0 and you don't have permission to send a signal to the process.
I have never understood 3.2.2.2 to mean that a null signal can be sent to detect the validity of a pid *as long as you have signal priveledges on that pid*. It seems at least that the INTENT of the null signal is to allow any process to determine if a pid exists.
Most programs use this, for example, to see if other instances of them- selves are running. They check for a pid file, and if it exists, they read it. Then they send a null signal to the pid to see if such a process really exists. While this isn't foolproof, it does provide one extra layer of assurance.
Since 3.2.2.2 implies that this is acceptable, many people are assuming it works, and these programs will break on Linux. In fact, Linux is the only OS I've heard of that treats the null signal this way. We should probably consider this broken -- and fix it.
Robey
| |