Misc improvements.

This commit is contained in:
4lDO2
2025-04-17 12:49:31 +02:00
parent d1081b278c
commit 799a9ef8d5
3 changed files with 9 additions and 3 deletions
+4 -1
View File
@@ -7,7 +7,7 @@
// The resulting set shall be the union of the current set and the signal
// set pointed to by set, if the value of the argument how is SIG_BLOCK.
int handler_called = 0;
volatile sig_atomic_t handler_called = 0;
void sig_handler(int signo)
{
@@ -45,12 +45,14 @@ int sigprocmask_block(int signum)
status = sigprocmask(SIG_UNBLOCK, &set2, NULL);
ERROR_IF(sigprocmask, status, == -1);
printf("Raising %s\n", strsignal(signum));
status = raise(signum);
ERROR_IF(raise, status, == -1);
ERROR_IF(raise, handler_called, != 1);
handler_called = 0;
printf("Raising %s\n", strsignal(defaultsig));
status = raise(defaultsig);
ERROR_IF(raise, defaultsig, == -1);
@@ -78,6 +80,7 @@ int main(){
if (i == SIGKILL || i == SIGSTOP){
continue;
}
printf("Testing signal %s (%d)\n", strsignal(i), i);
sigprocmask_block(i);
}
return 0;
+1
View File
@@ -56,6 +56,7 @@ int main(){
if (sig == SIGKILL || sig == SIGSTOP){
continue;
}
printf("Testing signal %s (%d)\n", strsignal(i), i);
sigprocmask_block(sig);
}
return EXIT_SUCCESS;
+4 -2
View File
@@ -1,5 +1,6 @@
// The sigrelse() function shall remove sig from the signal mask of the calling process.
#include <assert.h>
#include <sys/types.h>
#include <signal.h>
#include <stdio.h>
@@ -10,7 +11,7 @@
#define _XOPEN_SOURCE 700
int handler_called = 0;
volatile sig_atomic_t handler_called = 0;
void sig_handler(int signo)
{
@@ -35,7 +36,7 @@ int sigrelse_test(int signum)
status = raise(signum);
ERROR_IF(raise, status, == -1);
ERROR_IF(raise, handler_called, == 1);
assert(handler_called == 0);
// if (handler_called) {
// printf("UNRESOLVED. possible problem in sigrelse\n");
// exit(EXIT_FAILURE);
@@ -62,6 +63,7 @@ int main(){
if (i == SIGKILL || i == SIGSTOP){
continue;
}
printf("For signal %s\n", strsignal(i));
sigrelse_test(i);
}
return 0;