Bug 680903

Summary: incorrect real time signals
Product: [Fedora] Fedora Reporter: Karel Zak <kzak>
Component: straceAssignee: Roland McGrath <roland>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14CC: dvlasenk, ldv, roland, schwab
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-28 13:34:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.