Use SIGRTMIN from kernel headers
* configure.ac (ASM_SIGRTMIN): Define to SIGRTMIN from <asm/signal.h>. * signal.c: Use ASM_SIGRTMIN instead of constants provided by libc. * tests/sigreturn.c: Use ASM_SIGRTMIN instead of hardcoded value. Use lower RT_* numbers to support pre-3.18 hppa kernels. * tests/sigreturn.test: Update regexp.
This commit is contained in:
parent
67dab706cf
commit
59f63d3106
19
configure.ac
19
configure.ac
@ -711,13 +711,22 @@ AC_CHECK_SIZEOF([long])
|
||||
AC_CHECK_SIZEOF([long long])
|
||||
AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
|
||||
|
||||
AC_CACHE_CHECK([for SA_RESTORER], [st_cv_sa_restorer],
|
||||
[st_cv_sa_restorer="$(echo SA_RESTORER |
|
||||
AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
|
||||
[[st_cv_SIGRTMIN="$(echo SIGRTMIN |
|
||||
$CPP $CPPFLAGS -P -imacros asm/signal.h - |
|
||||
grep '^[0-9]')"
|
||||
test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]])
|
||||
if test "x$st_cv_SIGRTMIN" != xno; then
|
||||
AC_DEFINE_UNQUOTED([ASM_SIGRTMIN], [$st_cv_SIGRTMIN],
|
||||
[SIGRTMIN defined in <asm/signal.h>])
|
||||
fi
|
||||
AC_CACHE_CHECK([for SA_RESTORER], [st_cv_SA_RESTORER],
|
||||
[st_cv_SA_RESTORER="$(echo SA_RESTORER |
|
||||
$CPP $CPPFLAGS -P -imacros asm/signal.h - |
|
||||
grep ^0x)"
|
||||
test -n "$st_cv_sa_restorer" || st_cv_sa_restorer=no])
|
||||
if test "x$st_cv_sa_restorer" != xno; then
|
||||
AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_sa_restorer],
|
||||
test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no])
|
||||
if test "x$st_cv_SA_RESTORER" != xno; then
|
||||
AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_SA_RESTORER],
|
||||
[SA_RESTORER defined in <asm/signal.h>])
|
||||
fi
|
||||
|
||||
|
32
signal.c
32
signal.c
@ -102,13 +102,21 @@ struct sigcontext {
|
||||
#include "xlat/sigprocmaskcmds.h"
|
||||
|
||||
/* Anonymous realtime signals. */
|
||||
/* Under glibc 2.1, SIGRTMIN et al are functions, but __SIGRTMIN is a
|
||||
constant. This is what we want. Otherwise, just use SIGRTMIN. */
|
||||
#ifdef SIGRTMIN
|
||||
#ifndef __SIGRTMIN
|
||||
#define __SIGRTMIN SIGRTMIN
|
||||
#define __SIGRTMAX SIGRTMAX /* likewise */
|
||||
#ifndef ASM_SIGRTMIN
|
||||
/* Linux kernel >= 3.18 defines SIGRTMIN to 32 on all architectures. */
|
||||
# define ASM_SIGRTMIN 32
|
||||
#endif
|
||||
#ifndef ASM_SIGRTMAX
|
||||
/* Under glibc 2.1, SIGRTMAX et al are functions, but __SIGRTMAX is a
|
||||
constant. This is what we want. Otherwise, just use SIGRTMAX. */
|
||||
# ifdef SIGRTMAX
|
||||
# ifndef __SIGRTMAX
|
||||
# define __SIGRTMAX SIGRTMAX
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __SIGRTMAX
|
||||
# define ASM_SIGRTMAX __SIGRTMAX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Note on the size of sigset_t:
|
||||
@ -143,9 +151,9 @@ signame(const int sig)
|
||||
|
||||
if (s < nsignals)
|
||||
return signalent[s];
|
||||
#ifdef SIGRTMIN
|
||||
if (s >= __SIGRTMIN && s <= __SIGRTMAX) {
|
||||
sprintf(buf, "SIGRT_%u", s - __SIGRTMIN);
|
||||
#ifdef ASM_SIGRTMAX
|
||||
if (s >= ASM_SIGRTMIN && s <= ASM_SIGRTMAX) {
|
||||
sprintf(buf, "SIGRT_%u", s - ASM_SIGRTMIN);
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
@ -214,9 +222,9 @@ sprintsigmask_n(const char *prefix, const void *sig_mask, unsigned int bytes)
|
||||
if ((unsigned) i < nsignals) {
|
||||
s = stpcpy(s, signalent[i] + 3);
|
||||
}
|
||||
#ifdef SIGRTMIN
|
||||
else if (i >= __SIGRTMIN && i <= __SIGRTMAX) {
|
||||
s += sprintf(s, "RT_%u", i - __SIGRTMIN);
|
||||
#ifdef ASM_SIGRTMAX
|
||||
else if (i >= ASM_SIGRTMIN && i <= ASM_SIGRTMAX) {
|
||||
s += sprintf(s, "RT_%u", i - ASM_SIGRTMIN);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
|
@ -1,12 +1,20 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef ASM_SIGRTMIN
|
||||
# define RT_0 ASM_SIGRTMIN
|
||||
#else
|
||||
/* Linux kernel >= 3.18 defines SIGRTMIN to 32 on all architectures. */
|
||||
# define RT_0 32
|
||||
#endif
|
||||
|
||||
static void handler(int sig)
|
||||
{
|
||||
}
|
||||
|
||||
#define RT_0 32
|
||||
|
||||
int main(void) {
|
||||
sigset_t set;
|
||||
sigemptyset(&set);
|
||||
@ -15,8 +23,8 @@ int main(void) {
|
||||
sigaddset(&set, RT_0 + 2);
|
||||
sigaddset(&set, RT_0 + 3);
|
||||
sigaddset(&set, RT_0 + 4);
|
||||
sigaddset(&set, RT_0 + 31);
|
||||
sigaddset(&set, RT_0 + 32);
|
||||
sigaddset(&set, RT_0 + 26);
|
||||
sigaddset(&set, RT_0 + 27);
|
||||
sigprocmask(SIG_SETMASK, &set, NULL);
|
||||
signal(SIGUSR1, handler);
|
||||
raise(SIGUSR1);
|
||||
|
@ -21,7 +21,7 @@ grep_log()
|
||||
}
|
||||
}
|
||||
|
||||
mask='\[(USR2 CHLD|CHLD USR2) RT_2 RT_3 RT_4 RT_31 RT_32\]'
|
||||
mask='\[(USR2 CHLD|CHLD USR2) RT_2 RT_3 RT_4 RT_26 RT_27\]'
|
||||
rt_sigprocmask='rt_sigprocmask\(SIG_SETMASK, '"$mask"', NULL, [[:digit:]]+\) += 0'
|
||||
osf_sigprocmask='osf_sigprocmask\(SIG_SETMASK, '"$mask"'\) += 0 +\(old mask \[[^]]*\]\)'
|
||||
grep_log "$rt_sigprocmask|$osf_sigprocmask"
|
||||
|
Loading…
Reference in New Issue
Block a user