Bug 680903 - incorrect real time signals
Summary: incorrect real time signals
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: strace
Version: 14
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Roland McGrath
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-28 12:24 UTC by Karel Zak
Modified: 2011-02-28 13:34 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-02-28 13:34:18 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Karel Zak 2011-02-28 12:24:10 UTC
Description of problem:

strace(1) incorrectly translates the second kill(2) argument from signal number to SIGRT_<N> if the argument is real-time signal.

For example the following code uses SIGRTMIN+10, but strace(1) prints SIGRT_12:

---
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>

int main(int argc, char **argv)
{
        return kill(atoi(argv[1]), SIGRTMIN + 10);
}
---

$ sleep 1000 &                                                                               [1] 9192

$ strace -e kill ./a  9192 
kill(9192, SIGRT_12)                    = 0
           ^^^^^^^^

[1]+  Real-time signal 10     sleep 1000

Comment 1 Dmitry V. Levin 2011-02-28 13:34:18 UTC
$ cat s.c
#include <stdio.h>
#include <unistd.h>
#include <signal.h>

int main(void)
{
	printf("SIGRTMIN=%d, __SIGRTMIN=%d\n", SIGRTMIN, __SIGRTMIN);
        return kill(getpid(), SIGRTMIN + 10);
}

$ strace -ekill ./s
SIGRTMIN=34, __SIGRTMIN=32
kill(13589, SIGRT_12)                   = 0
--- SIGRT_12 (Real-time signal 10) @ 0 (0) ---
+++ killed by SIGRT_12 +++
Real-time signal 10

Note that SIGRTMIN != __SIGRTMIN.
The first is defined by glibc, the latter is defined by kernel headers.
This difference is documented in signal(7).

There should be no surprise that strace prints kernel constants while strsignal(3) prints glibc constants.


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