1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 12:57:35 +00:00

Add sigset_t helper functions to LibC.

This commit is contained in:
Andreas Kling 2018-11-06 12:02:58 +01:00
parent 153ea704af
commit 46f0c28a4a
2 changed files with 48 additions and 1 deletions

View file

@ -28,5 +28,47 @@ int sigaction(int signum, const struct sigaction* act, struct sigaction* old_act
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int sigemptyset(sigset_t* set)
{
*set = 0;
return 0;
}
int sigfillset(sigset_t* set)
{
*set = 0xffffffff;
return 0;
}
int sigaddset(sigset_t* set, int sig)
{
if (sig < 1 || sig > 32) {
errno = EINVAL;
return -1;
}
*set |= 1 << (sig - 1);
return 0;
}
int sigdelset(sigset_t* set, int sig)
{
if (sig < 1 || sig > 32) {
errno = EINVAL;
return -1;
}
*set &= ~(1 << (sig - 1));
return 0;
}
int sigismember(const sigset_t* set, int sig)
{
if (sig < 1 || sig > 32) {
errno = EINVAL;
return -1;
}
if (*set & (1 << (sig - 1)))
return 1;
return 0;
}
}