From d46a010c43680f56495b4d8afaf3f7d357f9c5ac Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 28 May 2008 15:28:49 +0000 Subject: [PATCH] Patch by Vasilis Kaoutsis: Added sigpause(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25682 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/signal.h | 1 + src/system/libroot/posix/signal/Jamfile | 1 + src/system/libroot/posix/signal/sigpause.cpp | 22 ++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 src/system/libroot/posix/signal/sigpause.cpp diff --git a/headers/posix/signal.h b/headers/posix/signal.h index d516cd9e2d..bea760e2bf 100644 --- a/headers/posix/signal.h +++ b/headers/posix/signal.h @@ -171,6 +171,7 @@ int sigismember(const sigset_t *set, int signo); int sigignore(int signo); int sighold(int signo); int sigrelse(int signo); +int sigpause(int signo); const char *strsignal(int sig); diff --git a/src/system/libroot/posix/signal/Jamfile b/src/system/libroot/posix/signal/Jamfile index 2adefcc2e3..ff6916c2a7 100644 --- a/src/system/libroot/posix/signal/Jamfile +++ b/src/system/libroot/posix/signal/Jamfile @@ -14,6 +14,7 @@ MergeObject posix_signal.o : sighold.cpp sigignore.cpp signal.c + sigpause.cpp sigpending.c sigprocmask.c sigrelse.cpp diff --git a/src/system/libroot/posix/signal/sigpause.cpp b/src/system/libroot/posix/signal/sigpause.cpp new file mode 100644 index 0000000000..17489e650c --- /dev/null +++ b/src/system/libroot/posix/signal/sigpause.cpp @@ -0,0 +1,22 @@ +/* + * Copyright 2008, Vasilis Kaoutsis, kaoutsis@sch.gr + * Distributed under the terms of the MIT License. + */ + + +#include + + +int +sigpause(int signal) +{ + sigset_t processSignalSet; + + if (sigprocmask(SIG_SETMASK, NULL, &processSignalSet) == -1) + return -1; + + if (sigdelset(&processSignalSet, signal) == -1) + return -1; + + return sigsuspend(&processSignalSet); +}