Bug 846790 - missing information about threads in kill(2) man page
Summary: missing information about threads in kill(2) man page
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: util-linux-ng
Version: 6.3
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Karel Zak
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-08 17:54 UTC by David Tonhofer
Modified: 2013-11-21 20:43 UTC (History)
4 users (show)

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):
Clone Of:
Environment:
Last Closed: 2013-11-21 20:43:37 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1648 normal SHIPPED_LIVE util-linux-ng bug fix and enhancement update 2013-11-20 21:53:24 UTC

Description David Tonhofer 2012-08-08 17:54:16 UTC
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 20:43:37 UTC
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.