From b0b60fc2f1e1c9a778ce9142771945a9d9f0c705 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 4 Apr 1997 15:34:33 +0000 Subject: Add sigisempty, sigorset, and sigandset --- signal/Makefile | 3 ++- signal/sigandset.c | 36 ++++++++++++++++++++++++++++++++++++ signal/sigisempty.c | 34 ++++++++++++++++++++++++++++++++++ signal/signal.h | 13 +++++++++++++ signal/sigorset.c | 36 ++++++++++++++++++++++++++++++++++++ 5 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 signal/sigandset.c create mode 100644 signal/sigisempty.c create mode 100644 signal/sigorset.c (limited to 'signal') diff --git a/signal/Makefile b/signal/Makefile index 2d99437208..a8e26ed239 100644 --- a/signal/Makefile +++ b/signal/Makefile @@ -30,7 +30,8 @@ routines := signal raise killpg \ sigstack sigaltstack sigintr \ sigsetops sigempty sigfillset sigaddset sigdelset sigismem \ sigreturn \ - siggetmask sysv_signal + siggetmask sysv_signal \ + sigisempty sigandset sigorset tests := tst-signal diff --git a/signal/sigandset.c b/signal/sigandset.c new file mode 100644 index 0000000000..bb3747c19d --- /dev/null +++ b/signal/sigandset.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Combine sets LEFT and RIGHT by logical AND and place result in DEST. */ +int +sigandset (dest, left, right) + sigset_t *dest; + const sigset_t *left; + const sigset_t *right; +{ + if (dest == NULL || left == NULL || right == NULL) + { + __set_errno (EINVAL); + return -1; + } + + return __sigandset (dest, left, right); +} diff --git a/signal/sigisempty.c b/signal/sigisempty.c new file mode 100644 index 0000000000..50dc343491 --- /dev/null +++ b/signal/sigisempty.c @@ -0,0 +1,34 @@ +/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Test whether SET is empty. */ +int +sigisemptyset (set) + const sigset_t *set; +{ + if (set == NULL) + { + __set_errno (EINVAL); + return -1; + } + + return __sigisemptyset (set); +} diff --git a/signal/signal.h b/signal/signal.h index b1953e5133..df54e7940d 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -183,6 +183,19 @@ extern int sigdelset __P ((sigset_t *__set, int __signo)); /* Return 1 if SIGNO is in SET, 0 if not. */ extern int sigismember __P ((__const sigset_t *__set, int __signo)); +#ifdef __USE_GNU +/* Return non-empty value is SET is not empty. */ +extern int sigisemptyset __P ((__const sigset_t *__set)); + +/* Build new signal set by combining the two inputs set using logical AND. */ +extern int sigandset __P ((sigset_t *__set, __const sigset_t *__left, + __const sigset_t *__right)); + +/* Build new signal set by combining the two inputs set using logical OR. */ +extern int sigorset __P ((sigset_t *__set, __const sigset_t *__left, + __const sigset_t *__right)); +#endif /* GNU */ + /* Get the system-specific definitions of `struct sigaction' and the `SA_*' and `SIG_*'. constants. */ #include diff --git a/signal/sigorset.c b/signal/sigorset.c new file mode 100644 index 0000000000..e8ae22fd5a --- /dev/null +++ b/signal/sigorset.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +#include + +/* Combine sets LEFT and RIGHT by logical OR and place result in DEST. */ +int +sigorset (dest, left, right) + sigset_t *dest; + const sigset_t *left; + const sigset_t *right; +{ + if (dest == NULL || left == NULL || right == NULL) + { + __set_errno (EINVAL); + return -1; + } + + return __sigorset (dest, left, right); +} -- cgit v1.2.3