Confused by kill vs. tgkill

redhatter <[email protected]>
Newsgroups gmane.linux.redhat.general
Message-ID <[email protected]>
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??

Best regards,

-- David Tonhofer


-- 
redhat-list mailing list
unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.