Fix "struct sigaction" structure for rt_sigaction.

* include/signal.h (sigset_t): Increase size.
* lib/linux/signal.c (signal): Use new sigset_t.
This commit is contained in:
Danny Milosavljevic 2019-07-04 02:21:24 +02:00 committed by Jan Nieuwenhuizen
parent 181d1e11ea
commit 3f1ba73fc7
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
2 changed files with 12 additions and 3 deletions

View File

@ -25,8 +25,13 @@
#include_next <signal.h>
#else //! SYSTEM_LIBC
#define _NSIG 64
typedef long sigset_t;
#define _SIGSET_NITEMS (_NSIG / (8 * sizeof(unsigned long)))
typedef struct {
unsigned long items[_SIGSET_NITEMS];
} sigset_t;
typedef long stack_t;
#include <sys/types.h>

View File

@ -41,12 +41,16 @@ signal (int signum, sighandler_t action)
#if __i386__
return _sys_call2 (SYS_signal, signum, action);
#else
static struct sigaction setup_action = { -1 };
static struct sigaction setup_action = { 0 };
static struct sigaction old = { 0 };
unsigned short bitindex;
unsigned short itembitcount;
setup_action.sa_handler = action;
setup_action.sa_restorer = _restorer;
setup_action.sa_mask = __sigmask (signum);
bitindex = signum - 1;
itembitcount = 8 * sizeof(setup_action.sa_mask.items[0]);
setup_action.sa_mask.items[bitindex / itembitcount] = 1 << (bitindex % itembitcount);
old.sa_handler = SIG_DFL;
setup_action.sa_flags = SA_RESTORER | SA_RESTART;
int r = _sys_call4 (SYS_rt_sigaction, signum, &setup_action, &old, sizeof (sigset_t));