signal: SIGKILL or SIGSTOP cannot be caught

pass ltp signal test cases, for posix spec, SIGKILL and SIGSTOP cannot be caught.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/signal.html
https://pubs.opengroup.org/onlinepubs/007904875/functions/sigset.html

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
This commit is contained in:
fangxinyong 2023-06-24 18:19:25 +08:00 committed by Xiang Xiao
parent 7462b199bb
commit ffa084f3d2
3 changed files with 6 additions and 4 deletions

View File

@ -39,7 +39,6 @@
#define MIN_SIGNO 1 /* Lowest valid signal number */
#define MAX_SIGNO 63 /* Highest valid signal number */
#define GOOD_SIGNO(s) ((((unsigned)(s)) <= MAX_SIGNO))
/* Definitions for "standard" signals */
@ -236,6 +235,9 @@
# define SIG_HOLD ((_sa_handler_t)1) /* Used only with sigset() */
#endif
#define GOOD_SIGNO(s) (((unsigned)(s)) <= MAX_SIGNO)
#define UNCAUGHT_SIGNO(s) ((s) == SIGKILL || (s) == SIGSTOP)
#define tkill(tid, signo) tgkill((pid_t)-1, tid, signo)
/****************************************************************************

View File

@ -101,7 +101,7 @@ _sa_handler_t sigset(int signo, _sa_handler_t func)
sigset_t set;
int ret = -EINVAL;
if (signo == SIGKILL || signo == SIGSTOP || !GOOD_SIGNO(signo))
if (!GOOD_SIGNO(signo) || UNCAUGHT_SIGNO(signo))
{
goto err;
}

View File

@ -62,7 +62,7 @@ _sa_handler_t signal(int signo, _sa_handler_t func)
struct sigaction oact;
int ret = -EINVAL;
if (!GOOD_SIGNO(signo))
if (!GOOD_SIGNO(signo) || UNCAUGHT_SIGNO(signo))
{
goto err;
}