LibC: Implement siginterrupt()

This is just a simple wrapper around the more-modern sigaction.
This commit is contained in:
Idan Horowitz 2023-12-25 15:43:56 +02:00 committed by Andreas Kling
parent 5e2fc52b25
commit 8bb423daf7
Notes: sideshowbarker 2024-07-16 23:57:20 +09:00
2 changed files with 15 additions and 0 deletions

View file

@ -102,6 +102,20 @@ int sigdelset(sigset_t* set, int sig)
return 0;
}
// https://pubs.opengroup.org/onlinepubs/009696699/functions/siginterrupt.html
int siginterrupt(int sig, int flag)
{
struct sigaction act;
int rc = sigaction(sig, nullptr, &act);
if (rc < 0)
return rc;
if (flag)
act.sa_flags &= ~SA_RESTART;
else
act.sa_flags |= SA_RESTART;
return sigaction(sig, &act, nullptr);
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigismember.html
int sigismember(sigset_t const* set, int sig)
{

View file

@ -28,6 +28,7 @@ int sigfillset(sigset_t*);
int sigaddset(sigset_t*, int sig);
int sigaltstack(stack_t const* ss, stack_t* old_ss);
int sigdelset(sigset_t*, int sig);
int siginterrupt(int sig, int flag);
int sigismember(sigset_t const*, int sig);
int sigprocmask(int how, sigset_t const* set, sigset_t* old_set);
int sigpending(sigset_t*);