Files
RedBear-OS/recipes/tests/signals/sigprocmask-5.c
T
vasilito b9874d0941 feat: USB storage read/write proof + full Red Bear OS tree sync
Add redbear-usb-storage-check in-guest binary that validates USB mass
storage read and write I/O: discovers /scheme/disk/ devices, writes a
test pattern to sector 2048, reads it back, verifies match, restores
original content. Updates test-usb-storage-qemu.sh with write-proof
verification step.

Includes all accumulated Red Bear OS work: kernel patches, relibc
patches, driver infrastructure, DRM/GPU, KDE recipes, firmware,
validation tooling, build system hardening, and documentation.
2026-05-03 23:03:24 +01:00

49 lines
1.1 KiB
C

#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
// The value of the argument how is not significant and the process's signal mask shall be unchanged, and
// thus the call can be used to enquire about currently blocked signals, if the argument set is a null
// pointer.
#define NUMSIGNALS 25
int is_changed(sigset_t set, int sig) {
int i;
int siglist[] = {SIGABRT, SIGALRM, SIGBUS, SIGCHLD,
SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT,
SIGPIPE, SIGQUIT, SIGSEGV,
SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU,
SIGUSR1, SIGUSR2, SIGPROF, SIGSYS,
SIGTRAP, SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ };
if (sigismember(&set, sig) != 1) {
return 1;
}
for (i=0; i<NUMSIGNALS; i++) {
if ((siglist[i] != sig)) {
if (sigismember(&set, siglist[i]) != 0) {
return 1;
}
}
}
return 0;
}
int main() {
sigset_t actl, oactl;
sigemptyset(&actl);
sigemptyset(&oactl);
sigaddset(&actl, SIGABRT);
sigprocmask(SIG_SETMASK, &actl, NULL);
sigprocmask(SIG_BLOCK, NULL, &oactl);
if (is_changed(oactl, SIGABRT)) {
exit(EXIT_FAILURE);
}
return EXIT_SUCCESS;
}