Bug 846790 - missing information about threads in kill(2) man page
missing information about threads in kill(2) man page
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: util-linux-ng (Show other bugs)
6.3
Unspecified Unspecified
low Severity low
: rc
: ---
Assigned To: Karel Zak
qe-baseos-daemons
: ManPageChange
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-08 13:54 EDT by David Tonhofer
Modified: 2013-11-21 15:43 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Feature: The kill(1) man page has been improved to explicitly explain interaction between kill syscall and threads. Reason: It wasn't obvious to users how kill(1) works with threads. Result (if any):
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-21 15:43:37 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Tonhofer 2012-08-08 13:54:16 EDT
Description of problem:
=======================

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. This is a standard trick of course.

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 (I suppose, it probably just signals whatever is in the process table at the given ID)

This does not conform to the specification. Consider /bin/kill:

- An strace of kill(1) shows a call to the kill(2) syscall but:
- The kill(2) manpage doesn't mention threads at all.
- Indeed, 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.)"

Now: 

Should kill(1) not check whether the pid it is given belongs to a thread or a process and, in case of a thread id, simply refuse to send a signal ("kill can only be used to send a signal to a process")

Shouldn't there be a tgkill(1) ?

Or else, shouldn't the manpage be changed?





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.
Comment 11 errata-xmlrpc 2013-11-21 15:43:37 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1648.html

Note You need to log in before you can comment on or make changes to this bug.