Confused by kill vs. tgkill
A little question on the usage of kill(2) I have run into:
I have scripts that check whether a process is alive by getting a known pidfile,
then issuing a "kill -o PID" to the PID contained in that pidfile.
However, it seems that nowadays "kill -o PID" also sends signals to threads, i.e.
if there is no PID, the value is assumed to be a TID and the thread is signalled
(or maybe the process to which the TID belongs, not sure)
This makes it rather more likely that a process PID is found to be erroneously alive
as a thread may have taken its (now defunct) PID.
There are ways around that, but now for the specification. Consider /bin/kill:
- An strace of /bin/kill shows a call to "kill" but:
- The kill(2) manpage doesn't mention threads at all.
- There is a specially designed tgkill(2) to signal threads.
- The manpage of tgkill says; "By contrast, kill(2) can only be used to send a
signal to a process (i.e., thread group) as a whole, and the signal will be
delivered to an arbitrary thread within that process.)"
So either the kill(2) manpage and the tgkill(2) are wrong / need to be
completed or there is an implementation problem with the kill syscall.
Any thoughts on this? Should I open a bug to complete the manpage??
-- David Tonhofer
redhat-list mailing list
|All times are GMT. The time now is 01:12 AM.|
VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.