summaryrefslogtreecommitdiff
path: root/libc/signal
diff options
context:
space:
mode:
authorgcc <gcc@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2006-08-17 01:18:26 +0000
committergcc <gcc@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2006-08-17 01:18:26 +0000
commit15f34685e7a9b5caf761af2ebf6afa20438d440b (patch)
treedc04ce3cdf040f198743c15b64557824de174680 /libc/signal
parent1e848e0e775a36f6359161f5deb890942ef42ff3 (diff)
Import glibc-mainline for 2006-08-16
git-svn-id: svn://svn.eglibc.org/fsf/trunk@4 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/signal')
-rw-r--r--libc/signal/.cvsignore6
-rw-r--r--libc/signal/Makefile51
-rw-r--r--libc/signal/Versions52
-rw-r--r--libc/signal/allocrtsig.c96
-rw-r--r--libc/signal/kill.c37
-rw-r--r--libc/signal/killpg.c36
-rw-r--r--libc/signal/raise.c34
-rw-r--r--libc/signal/sigaction.c44
-rw-r--r--libc/signal/sigaddset.c35
-rw-r--r--libc/signal/sigaltstack.c34
-rw-r--r--libc/signal/sigandset.c38
-rw-r--r--libc/signal/sigblock.c33
-rw-r--r--libc/signal/sigdelset.c35
-rw-r--r--libc/signal/sigempty.c38
-rw-r--r--libc/signal/sigfillset.c47
-rw-r--r--libc/signal/siggetmask.c29
-rw-r--r--libc/signal/sighold.c41
-rw-r--r--libc/signal/sigignore.c33
-rw-r--r--libc/signal/sigintr.c35
-rw-r--r--libc/signal/sigisempty.c36
-rw-r--r--libc/signal/sigismem.c35
-rw-r--r--libc/signal/signal.c38
-rw-r--r--libc/signal/signal.h402
-rw-r--r--libc/signal/sigorset.c38
-rw-r--r--libc/signal/sigpause.c53
-rw-r--r--libc/signal/sigpending.c40
-rw-r--r--libc/signal/sigprocmask.c51
-rw-r--r--libc/signal/sigqueue.c33
-rw-r--r--libc/signal/sigrelse.c41
-rw-r--r--libc/signal/sigreturn.c32
-rw-r--r--libc/signal/sigset.c34
-rw-r--r--libc/signal/sigsetmask.c32
-rw-r--r--libc/signal/sigsetops.c11
-rw-r--r--libc/signal/sigsetops.h33
-rw-r--r--libc/signal/sigstack.c34
-rw-r--r--libc/signal/sigsuspend.c37
-rw-r--r--libc/signal/sigtimedwait.c34
-rw-r--r--libc/signal/sigvec.c39
-rw-r--r--libc/signal/sigwait.c32
-rw-r--r--libc/signal/sigwaitinfo.c33
-rw-r--r--libc/signal/sys/signal.h1
-rw-r--r--libc/signal/sysv_signal.c43
-rw-r--r--libc/signal/tst-raise.c62
-rw-r--r--libc/signal/tst-signal.c44
-rw-r--r--libc/signal/tst-sigset.c43
-rw-r--r--libc/signal/tst-sigset2.c184
-rw-r--r--libc/signal/tst-sigsimple.c57
47 files changed, 2306 insertions, 0 deletions
diff --git a/libc/signal/.cvsignore b/libc/signal/.cvsignore
new file mode 100644
index 000000000..3fc9f4cdf
--- /dev/null
+++ b/libc/signal/.cvsignore
@@ -0,0 +1,6 @@
+*.d *.o *.so *.po *.go stamp.* *.stamp *.ustamp *.udeps
+*.gz *.Z *.tar *.tgz
+=*
+TODO COPYING* AUTHORS copyr-* copying.*
+glibc-*
+distinfo
diff --git a/libc/signal/Makefile b/libc/signal/Makefile
new file mode 100644
index 000000000..fa8d098da
--- /dev/null
+++ b/libc/signal/Makefile
@@ -0,0 +1,51 @@
+# Copyright (C) 1991-1998,2003,2006 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 Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 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
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+
+#
+# Makefile for signal routines.
+#
+subdir := signal
+
+headers := signal.h sys/signal.h bits/signum.h bits/sigcontext.h \
+ bits/sigaction.h bits/sigset.h bits/siginfo.h bits/sigstack.h \
+ bits/sigthread.h
+
+routines := signal raise killpg \
+ sigaction sigprocmask kill \
+ sigpending sigsuspend sigwait \
+ sigblock sigsetmask sigpause sigvec \
+ sigstack sigaltstack sigintr \
+ sigsetops sigempty sigfillset sigaddset sigdelset sigismem \
+ sigreturn \
+ siggetmask sysv_signal \
+ sigisempty sigandset sigorset \
+ allocrtsig sigtimedwait sigwaitinfo sigqueue \
+ sighold sigrelse sigignore sigset
+
+tests := tst-signal tst-sigset tst-sigsimple tst-raise tst-sigset2
+
+distribute := sigsetops.h testrtsig.h sigset-cvt-mask.h
+
+
+include ../Rules
+
+CFLAGS-sigpause.c = -fexceptions
+CFLAGS-sigsuspend.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sigtimedwait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sigwait.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-sigwaitinfo.c = -fexceptions -fasynchronous-unwind-tables
diff --git a/libc/signal/Versions b/libc/signal/Versions
new file mode 100644
index 000000000..0217a4089
--- /dev/null
+++ b/libc/signal/Versions
@@ -0,0 +1,52 @@
+libc {
+ GLIBC_2.0 {
+ # functions with special/multiple interfaces
+ __sigaddset; __sigdelset; __sigismember; __sysv_signal;
+
+ # functions used in inline functions or macros
+ __sigpause;
+
+ # functions used in other libraries
+ __sigaction;
+
+ # b*
+ bsd_signal;
+
+ # g*
+ gsignal;
+
+ # k*
+ kill; killpg;
+
+ # p*
+ psignal;
+
+ # r*
+ raise;
+
+ # s*
+ sigaction; sigaddset; sigaltstack; sigandset; sigblock; sigdelset;
+ sigemptyset; sigfillset; siggetmask; siginterrupt; sigisemptyset;
+ sigismember; siglongjmp; signal; sigorset; sigpause; sigpending;
+ sigprocmask; sigreturn; sigsetmask; sigstack; sigsuspend; sigvec;
+ sigwait; ssignal;
+ }
+ GLIBC_2.1 {
+ # helper functions
+ __libc_current_sigrtmin; __libc_current_sigrtmax; __libc_allocate_rtsig;
+
+ # s*
+ sighold; sigrelse; sigignore; sigset; sysv_signal;
+
+ # New RT signal functions.
+ sigqueue; sigtimedwait; sigwaitinfo;
+ }
+ GLIBC_2.1.3 {
+ # LinuxThreads needs this entry point.
+ __sigsuspend;
+ }
+ GLIBC_2.2 {
+ # Needed to provide a pointer to the XPG sigpause function.
+ __xpg_sigpause;
+ }
+}
diff --git a/libc/signal/allocrtsig.c b/libc/signal/allocrtsig.c
new file mode 100644
index 000000000..ac8d2b6bf
--- /dev/null
+++ b/libc/signal/allocrtsig.c
@@ -0,0 +1,96 @@
+/* Handle real-time signal allocation.
+ Copyright (C) 1997,98,99,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+
+/* In these variables we keep track of the used variables. If the
+ platform does not support any real-time signals we will define the
+ values to some unreasonable value which will signal failing of all
+ the functions below. */
+#ifndef __SIGRTMIN
+static int current_rtmin = -1;
+static int current_rtmax = -1;
+#else
+static int current_rtmin;
+static int current_rtmax;
+
+static int initialized;
+
+#include <testrtsig.h>
+
+static void
+init (void)
+{
+ if (!kernel_has_rtsig ())
+ {
+ current_rtmin = -1;
+ current_rtmax = -1;
+ }
+ else
+ {
+ current_rtmin = __SIGRTMIN;
+ current_rtmax = __SIGRTMAX;
+ }
+ initialized = 1;
+}
+#endif
+
+/* Return number of available real-time signal with highest priority. */
+int
+__libc_current_sigrtmin (void)
+{
+#ifdef __SIGRTMIN
+ if (!initialized)
+ init ();
+#endif
+ return current_rtmin;
+}
+libc_hidden_def (__libc_current_sigrtmin)
+
+/* Return number of available real-time signal with lowest priority. */
+int
+__libc_current_sigrtmax (void)
+{
+#ifdef __SIGRTMIN
+ if (!initialized)
+ init ();
+#endif
+ return current_rtmax;
+}
+libc_hidden_def (__libc_current_sigrtmax)
+
+/* Allocate real-time signal with highest/lowest available
+ priority. Please note that we don't use a lock since we assume
+ this function to be called at program start. */
+int
+__libc_allocate_rtsig (int high)
+{
+#ifndef __SIGRTMIN
+ return -1;
+#else
+ if (!initialized)
+ init ();
+ if (current_rtmin == -1 || current_rtmin > current_rtmax)
+ /* We don't have anymore signal available. */
+ return -1;
+
+ return high ? current_rtmin++ : current_rtmax--;
+#endif
+}
diff --git a/libc/signal/kill.c b/libc/signal/kill.c
new file mode 100644
index 000000000..1d81e45dd
--- /dev/null
+++ b/libc/signal/kill.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1995, 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Send signal SIG to process number PID. If PID is zero,
+ send SIG to all processes in the current process's process group.
+ If PID is < -1, send SIG to all processes in process group - PID. */
+int
+__kill (pid, sig)
+ int pid;
+ int sig;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (kill)
+
+weak_alias (__kill, kill)
+#include <stub-tag.h>
diff --git a/libc/signal/killpg.c b/libc/signal/killpg.c
new file mode 100644
index 000000000..ad9258dff
--- /dev/null
+++ b/libc/signal/killpg.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1993, 1995, 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Send SIG to all processes in process group PGRP.
+ If PGRP is zero, send SIG to all processes in
+ the current process's process group. */
+int
+killpg (pgrp, sig)
+ __pid_t pgrp;
+ int sig;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (killpg)
+#include <stub-tag.h>
diff --git a/libc/signal/raise.c b/libc/signal/raise.c
new file mode 100644
index 000000000..c5a449f7b
--- /dev/null
+++ b/libc/signal/raise.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991,95,96,2002 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+#include <errno.h>
+
+/* Raise the signal SIG. */
+int
+raise (sig)
+ int sig;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (raise, gsignal)
+
+stub_warning (raise)
+stub_warning (gsignal)
+#include <stub-tag.h>
diff --git a/libc/signal/sigaction.c b/libc/signal/sigaction.c
new file mode 100644
index 000000000..bf0a15bac
--- /dev/null
+++ b/libc/signal/sigaction.c
@@ -0,0 +1,44 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2002 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* If ACT is not NULL, change the action for SIG to *ACT.
+ If OACT is not NULL, put the old action for SIG in *OACT. */
+int
+__sigaction (sig, act, oact)
+ int sig;
+ const struct sigaction *act;
+ struct sigaction *oact;
+{
+ if (sig <= 0 || sig >= NSIG)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__sigaction)
+stub_warning (sigaction)
+
+weak_alias (__sigaction, sigaction)
+#include <stub-tag.h>
diff --git a/libc/signal/sigaddset.c b/libc/signal/sigaddset.c
new file mode 100644
index 000000000..d8344f9b1
--- /dev/null
+++ b/libc/signal/sigaddset.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1996, 2003 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "sigsetops.h"
+
+/* Add SIGNO to SET. */
+int
+sigaddset (set, signo)
+ sigset_t *set;
+ int signo;
+{
+ if (set == NULL || signo <= 0 || signo >= NSIG)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __sigaddset (set, signo);
+}
+libc_hidden_def (sigaddset)
diff --git a/libc/signal/sigaltstack.c b/libc/signal/sigaltstack.c
new file mode 100644
index 000000000..17c7e06b3
--- /dev/null
+++ b/libc/signal/sigaltstack.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1992, 1995, 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+/* Run signals handlers on the stack specified by SS (if not NULL).
+ If OSS is not NULL, it is filled in with the old signal stack status. */
+int
+sigaltstack (ss, oss)
+ const struct sigaltstack *ss;
+ struct sigaltstack *oss;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigaltstack)
+#include <stub-tag.h>
diff --git a/libc/signal/sigandset.c b/libc/signal/sigandset.c
new file mode 100644
index 000000000..a25225bad
--- /dev/null
+++ b/libc/signal/sigandset.c
@@ -0,0 +1,38 @@
+/* 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+
+/* 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/libc/signal/sigblock.c b/libc/signal/sigblock.c
new file mode 100644
index 000000000..81a4ff144
--- /dev/null
+++ b/libc/signal/sigblock.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+/* Block signals in MASK, returning the old mask. */
+int
+__sigblock (mask)
+ int mask;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sigblock)
+
+weak_alias (__sigblock, sigblock)
+#include <stub-tag.h>
diff --git a/libc/signal/sigdelset.c b/libc/signal/sigdelset.c
new file mode 100644
index 000000000..177e9ee47
--- /dev/null
+++ b/libc/signal/sigdelset.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991, 1996, 2003 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "sigsetops.h"
+
+/* Add SIGNO to SET. */
+int
+sigdelset (set, signo)
+ sigset_t *set;
+ int signo;
+{
+ if (set == NULL || signo <= 0 || signo >= NSIG)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __sigdelset (set, signo);
+}
+libc_hidden_def (sigdelset)
diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c
new file mode 100644
index 000000000..dda035d19
--- /dev/null
+++ b/libc/signal/sigempty.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991,96,97,2002 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+
+/* Clear all signals from SET. */
+int
+sigemptyset (set)
+ sigset_t *set;
+{
+ if (set == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ memset (set, 0, sizeof (sigset_t));
+
+ return 0;
+}
+libc_hidden_def (sigemptyset)
diff --git a/libc/signal/sigfillset.c b/libc/signal/sigfillset.c
new file mode 100644
index 000000000..95d52cf0c
--- /dev/null
+++ b/libc/signal/sigfillset.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 1991,96,97,2002,2003,2004 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+
+/* Set all signals in SET. */
+int
+sigfillset (set)
+ sigset_t *set;
+{
+ if (set == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ memset (set, 0xff, sizeof (sigset_t));
+
+ /* If the implementation uses a cancellation signal don't set the bit. */
+#ifdef SIGCANCEL
+ __sigdelset (set, SIGCANCEL);
+#endif
+ /* Likewise for the signal to implement setxid. */
+#ifdef SIGSETXID
+ __sigdelset (set, SIGSETXID);
+#endif
+
+ return 0;
+}
+libc_hidden_def (sigfillset)
diff --git a/libc/signal/siggetmask.c b/libc/signal/siggetmask.c
new file mode 100644
index 000000000..c80cd55ba
--- /dev/null
+++ b/libc/signal/siggetmask.c
@@ -0,0 +1,29 @@
+/* siggetmask -- useless alias for `sigblock (0)' for old Linux compatibility.
+ Copyright (C) 1996 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+
+int
+siggetmask (void)
+{
+ return __sigblock (0);
+}
+
+link_warning (siggetmask,
+ "warning: `siggetmask' is obsolete; `sigprocmask' is best")
diff --git a/libc/signal/sighold.c b/libc/signal/sighold.c
new file mode 100644
index 000000000..687b7fc58
--- /dev/null
+++ b/libc/signal/sighold.c
@@ -0,0 +1,41 @@
+/* Add SIG to the calling process' signal mask.
+ Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define __need_NULL
+#include <stddef.h>
+#include <signal.h>
+
+int
+sighold (sig)
+ int sig;
+{
+ sigset_t set;
+
+ /* Retrieve current signal set. */
+ if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0)
+ return -1;
+
+ /* Add the specified signal. */
+ if (sigaddset (&set, sig) < 0)
+ return -1;
+
+ /* Set the new mask. */
+ return __sigprocmask (SIG_SETMASK, &set, NULL);
+}
diff --git a/libc/signal/sigignore.c b/libc/signal/sigignore.c
new file mode 100644
index 000000000..734422dd8
--- /dev/null
+++ b/libc/signal/sigignore.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1998 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Set the disposition for SIG to SIG_IGN. */
+int
+sigignore (sig)
+ int sig;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigignore)
+#include <stub-tag.h>
diff --git a/libc/signal/sigintr.c b/libc/signal/sigintr.c
new file mode 100644
index 000000000..9d4c2c8f5
--- /dev/null
+++ b/libc/signal/sigintr.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1992, 1995, 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
+ (causing them to fail with EINTR); if INTERRUPT is zero, make system
+ calls be restarted after signal SIG. */
+int
+siginterrupt (sig, interrupt)
+ int sig;
+ int interrupt;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (siginterrupt)
+#include <stub-tag.h>
diff --git a/libc/signal/sigisempty.c b/libc/signal/sigisempty.c
new file mode 100644
index 000000000..22baa0038
--- /dev/null
+++ b/libc/signal/sigisempty.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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+
+/* 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/libc/signal/sigismem.c b/libc/signal/sigismem.c
new file mode 100644
index 000000000..e18a3b14b
--- /dev/null
+++ b/libc/signal/sigismem.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991,96,2002 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include "sigsetops.h"
+
+/* Return 1 if SIGNO is in SET, 0 if not. */
+int
+sigismember (set, signo)
+ const sigset_t *set;
+ int signo;
+{
+ if (set == NULL || signo <= 0 || signo >= NSIG)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ return __sigismember (set, signo);
+}
+libc_hidden_def (sigismember)
diff --git a/libc/signal/signal.c b/libc/signal/signal.c
new file mode 100644
index 000000000..6c1808bb1
--- /dev/null
+++ b/libc/signal/signal.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991, 1995, 1996 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Set the handler for the signal SIG to HANDLER,
+ returning the old handler, or SIG_ERR on error. */
+__sighandler_t
+signal (sig, handler)
+ int sig;
+ __sighandler_t handler;
+{
+ __set_errno (ENOSYS);
+ return SIG_ERR;
+}
+
+weak_alias (signal, ssignal)
+
+stub_warning (signal)
+stub_warning (ssignal)
+#include <stub-tag.h>
diff --git a/libc/signal/signal.h b/libc/signal/signal.h
new file mode 100644
index 000000000..ed39328ef
--- /dev/null
+++ b/libc/signal/signal.h
@@ -0,0 +1,402 @@
+/* Copyright (C) 1991-2003, 2004 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/*
+ * ISO C99 Standard: 7.14 Signal handling <signal.h>
+ */
+
+#ifndef _SIGNAL_H
+
+#if !defined __need_sig_atomic_t && !defined __need_sigset_t
+# define _SIGNAL_H
+#endif
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+#include <bits/sigset.h> /* __sigset_t, __sig_atomic_t. */
+
+/* An integral type that can be modified atomically, without the
+ possibility of a signal arriving in the middle of the operation. */
+#if defined __need_sig_atomic_t || defined _SIGNAL_H
+# ifndef __sig_atomic_t_defined
+# define __sig_atomic_t_defined
+__BEGIN_NAMESPACE_STD
+typedef __sig_atomic_t sig_atomic_t;
+__END_NAMESPACE_STD
+# endif
+# undef __need_sig_atomic_t
+#endif
+
+#if defined __need_sigset_t || (defined _SIGNAL_H && defined __USE_POSIX)
+# ifndef __sigset_t_defined
+# define __sigset_t_defined
+typedef __sigset_t sigset_t;
+# endif
+# undef __need_sigset_t
+#endif
+
+#ifdef _SIGNAL_H
+
+#include <bits/types.h>
+#include <bits/signum.h>
+
+#if defined __USE_XOPEN || defined __USE_XOPEN2K
+# ifndef __pid_t_defined
+typedef __pid_t pid_t;
+# define __pid_t_defined
+#endif
+#ifdef __USE_XOPEN
+# endif
+# ifndef __uid_t_defined
+typedef __uid_t uid_t;
+# define __uid_t_defined
+# endif
+#endif /* Unix98 */
+
+
+/* Type of a signal handler. */
+typedef void (*__sighandler_t) (int);
+
+/* The X/Open definition of `signal' specifies the SVID semantic. Use
+ the additional function `sysv_signal' when X/Open compatibility is
+ requested. */
+extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler)
+ __THROW;
+#ifdef __USE_GNU
+extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler)
+ __THROW;
+#endif
+
+/* Set the handler for the signal SIG to HANDLER, returning the old
+ handler, or SIG_ERR on error.
+ By default `signal' has the BSD semantic. */
+__BEGIN_NAMESPACE_STD
+#ifdef __USE_BSD
+extern __sighandler_t signal (int __sig, __sighandler_t __handler)
+ __THROW;
+#else
+/* Make sure the used `signal' implementation is the SVID version. */
+# ifdef __REDIRECT_NTH
+extern __sighandler_t __REDIRECT_NTH (signal,
+ (int __sig, __sighandler_t __handler),
+ __sysv_signal);
+# else
+# define signal __sysv_signal
+# endif
+#endif
+__END_NAMESPACE_STD
+
+#ifdef __USE_XOPEN
+/* The X/Open definition of `signal' conflicts with the BSD version.
+ So they defined another function `bsd_signal'. */
+extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler)
+ __THROW;
+#endif
+
+/* Send signal SIG to process number PID. If PID is zero,
+ send SIG to all processes in the current process's process group.
+ If PID is < -1, send SIG to all processes in process group - PID. */
+#ifdef __USE_POSIX
+extern int kill (__pid_t __pid, int __sig) __THROW;
+#endif /* Use POSIX. */
+
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+/* Send SIG to all processes in process group PGRP.
+ If PGRP is zero, send SIG to all processes in
+ the current process's process group. */
+extern int killpg (__pid_t __pgrp, int __sig) __THROW;
+#endif /* Use BSD || X/Open Unix. */
+
+__BEGIN_NAMESPACE_STD
+/* Raise signal SIG, i.e., send SIG to yourself. */
+extern int raise (int __sig) __THROW;
+__END_NAMESPACE_STD
+
+#ifdef __USE_SVID
+/* SVID names for the same things. */
+extern __sighandler_t ssignal (int __sig, __sighandler_t __handler)
+ __THROW;
+extern int gsignal (int __sig) __THROW;
+#endif /* Use SVID. */
+
+#ifdef __USE_MISC
+/* Print a message describing the meaning of the given signal number. */
+extern void psignal (int __sig, __const char *__s);
+#endif /* Use misc. */
+
+
+/* The `sigpause' function has two different interfaces. The original
+ BSD definition defines the argument as a mask of the signal, while
+ the more modern interface in X/Open defines it as the signal
+ number. We go with the BSD version unless the user explicitly
+ selects the X/Open version.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int __sigpause (int __sig_or_mask, int __is_sig);
+
+#ifdef __FAVOR_BSD
+/* Set the mask of blocked signals to MASK,
+ wait for a signal to arrive, and then restore the mask. */
+extern int sigpause (int __mask) __THROW __attribute_deprecated__;
+#else
+# ifdef __USE_XOPEN
+# ifdef __GNUC__
+extern int sigpause (int __sig) __asm__ ("__xpg_sigpause");
+# else
+/* Remove a signal from the signal mask and suspend the process. */
+# define sigpause(sig) __sigpause ((sig), 1)
+# endif
+# endif
+#endif
+
+
+#ifdef __USE_BSD
+/* None of the following functions should be used anymore. They are here
+ only for compatibility. A single word (`int') is not guaranteed to be
+ enough to hold a complete signal mask and therefore these functions
+ simply do not work in many situations. Use `sigprocmask' instead. */
+
+/* Compute mask for signal SIG. */
+# define sigmask(sig) __sigmask(sig)
+
+/* Block signals in MASK, returning the old mask. */
+extern int sigblock (int __mask) __THROW __attribute_deprecated__;
+
+/* Set the mask of blocked signals to MASK, returning the old mask. */
+extern int sigsetmask (int __mask) __THROW __attribute_deprecated__;
+
+/* Return currently selected signal mask. */
+extern int siggetmask (void) __THROW __attribute_deprecated__;
+#endif /* Use BSD. */
+
+
+#ifdef __USE_MISC
+# define NSIG _NSIG
+#endif
+
+#ifdef __USE_GNU
+typedef __sighandler_t sighandler_t;
+#endif
+
+/* 4.4 BSD uses the name `sig_t' for this. */
+#ifdef __USE_BSD
+typedef __sighandler_t sig_t;
+#endif
+
+#ifdef __USE_POSIX
+
+# ifdef __USE_POSIX199309
+/* We need `struct timespec' later on. */
+# define __need_timespec
+# include <time.h>
+
+/* Get the `siginfo_t' type plus the needed symbols. */
+# include <bits/siginfo.h>
+# endif
+
+/* Clear all signals from SET. */
+extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1));
+
+/* Set all signals in SET. */
+extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1));
+
+/* Add SIGNO to SET. */
+extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
+
+/* Remove SIGNO from SET. */
+extern int sigdelset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
+
+/* Return 1 if SIGNO is in SET, 0 if not. */
+extern int sigismember (__const sigset_t *__set, int __signo)
+ __THROW __nonnull ((1));
+
+# ifdef __USE_GNU
+/* Return non-empty value is SET is not empty. */
+extern int sigisemptyset (__const sigset_t *__set) __THROW __nonnull ((1));
+
+/* Build new signal set by combining the two inputs set using logical AND. */
+extern int sigandset (sigset_t *__set, __const sigset_t *__left,
+ __const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
+
+/* Build new signal set by combining the two inputs set using logical OR. */
+extern int sigorset (sigset_t *__set, __const sigset_t *__left,
+ __const sigset_t *__right) __THROW __nonnull ((1, 2, 3));
+# endif /* GNU */
+
+/* Get the system-specific definitions of `struct sigaction'
+ and the `SA_*' and `SIG_*'. constants. */
+# include <bits/sigaction.h>
+
+/* Get and/or change the set of blocked signals. */
+extern int sigprocmask (int __how, __const sigset_t *__restrict __set,
+ sigset_t *__restrict __oset) __THROW;
+
+/* Change the set of blocked signals to SET,
+ wait until a signal arrives, and restore the set of blocked signals.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int sigsuspend (__const sigset_t *__set) __nonnull ((1));
+
+/* Get and/or set the action for signal SIG. */
+extern int sigaction (int __sig, __const struct sigaction *__restrict __act,
+ struct sigaction *__restrict __oact) __THROW;
+
+/* Put in SET all signals that are blocked and waiting to be delivered. */
+extern int sigpending (sigset_t *__set) __THROW __nonnull ((1));
+
+
+/* Select any of pending signals from SET or wait for any to arrive.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig)
+ __nonnull ((1, 2));
+
+# ifdef __USE_POSIX199309
+/* Select any of pending signals from SET and place information in INFO.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int sigwaitinfo (__const sigset_t *__restrict __set,
+ siginfo_t *__restrict __info) __nonnull ((1));
+
+/* Select any of pending signals from SET and place information in INFO.
+ Wait the time specified by TIMEOUT if no signal is pending.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int sigtimedwait (__const sigset_t *__restrict __set,
+ siginfo_t *__restrict __info,
+ __const struct timespec *__restrict __timeout)
+ __nonnull ((1));
+
+/* Send signal SIG to the process PID. Associate data in VAL with the
+ signal. */
+extern int sigqueue (__pid_t __pid, int __sig, __const union sigval __val)
+ __THROW;
+# endif /* Use POSIX 199306. */
+
+#endif /* Use POSIX. */
+
+#ifdef __USE_BSD
+
+/* Names of the signals. This variable exists only for compatibility.
+ Use `strsignal' instead (see <string.h>). */
+extern __const char *__const _sys_siglist[_NSIG];
+extern __const char *__const sys_siglist[_NSIG];
+
+/* Structure passed to `sigvec'. */
+struct sigvec
+ {
+ __sighandler_t sv_handler; /* Signal handler. */
+ int sv_mask; /* Mask of signals to be blocked. */
+
+ int sv_flags; /* Flags (see below). */
+# define sv_onstack sv_flags /* 4.2 BSD compatibility. */
+ };
+
+/* Bits in `sv_flags'. */
+# define SV_ONSTACK (1 << 0)/* Take the signal on the signal stack. */
+# define SV_INTERRUPT (1 << 1)/* Do not restart system calls. */
+# define SV_RESETHAND (1 << 2)/* Reset handler to SIG_DFL on receipt. */
+
+
+/* If VEC is non-NULL, set the handler for SIG to the `sv_handler' member
+ of VEC. The signals in `sv_mask' will be blocked while the handler runs.
+ If the SV_RESETHAND bit is set in `sv_flags', the handler for SIG will be
+ reset to SIG_DFL before `sv_handler' is entered. If OVEC is non-NULL,
+ it is filled in with the old information for SIG. */
+extern int sigvec (int __sig, __const struct sigvec *__vec,
+ struct sigvec *__ovec) __THROW;
+
+
+/* Get machine-dependent `struct sigcontext' and signal subcodes. */
+# include <bits/sigcontext.h>
+
+/* Restore the state saved in SCP. */
+extern int sigreturn (struct sigcontext *__scp) __THROW;
+
+#endif /* use BSD. */
+
+
+#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
+
+/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
+ (causing them to fail with EINTR); if INTERRUPT is zero, make system
+ calls be restarted after signal SIG. */
+extern int siginterrupt (int __sig, int __interrupt) __THROW;
+
+# include <bits/sigstack.h>
+# ifdef __USE_XOPEN
+/* This will define `ucontext_t' and `mcontext_t'. */
+# include <sys/ucontext.h>
+# endif
+
+/* Run signals handlers on the stack specified by SS (if not NULL).
+ If OSS is not NULL, it is filled in with the old signal stack status.
+ This interface is obsolete and on many platform not implemented. */
+extern int sigstack (struct sigstack *__ss, struct sigstack *__oss)
+ __THROW __attribute_deprecated__;
+
+/* Alternate signal handler stack interface.
+ This interface should always be preferred over `sigstack'. */
+extern int sigaltstack (__const struct sigaltstack *__restrict __ss,
+ struct sigaltstack *__restrict __oss) __THROW;
+
+#endif /* use BSD or X/Open Unix. */
+
+#ifdef __USE_XOPEN_EXTENDED
+/* Simplified interface for signal management. */
+
+/* Add SIG to the calling process' signal mask. */
+extern int sighold (int __sig) __THROW;
+
+/* Remove SIG from the calling process' signal mask. */
+extern int sigrelse (int __sig) __THROW;
+
+/* Set the disposition of SIG to SIG_IGN. */
+extern int sigignore (int __sig) __THROW;
+
+/* Set the disposition of SIG. */
+extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW;
+#endif
+
+#if defined __USE_POSIX199506 || defined __USE_UNIX98
+/* Some of the functions for handling signals in threaded programs must
+ be defined here. */
+# include <bits/pthreadtypes.h>
+# include <bits/sigthread.h>
+#endif /* use Unix98 */
+
+/* The following functions are used internally in the C library and in
+ other code which need deep insights. */
+
+/* Return number of available real-time signal with highest priority. */
+extern int __libc_current_sigrtmin (void) __THROW;
+/* Return number of available real-time signal with lowest priority. */
+extern int __libc_current_sigrtmax (void) __THROW;
+
+#endif /* signal.h */
+
+__END_DECLS
+
+#endif /* not signal.h */
diff --git a/libc/signal/sigorset.c b/libc/signal/sigorset.c
new file mode 100644
index 000000000..7d7bf863d
--- /dev/null
+++ b/libc/signal/sigorset.c
@@ -0,0 +1,38 @@
+/* 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#define __need_NULL
+#include <stddef.h>
+
+/* 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);
+}
diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c
new file mode 100644
index 000000000..bc598d070
--- /dev/null
+++ b/libc/signal/sigpause.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1991,95,96,2000,02,2004 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define sigpause __rename_sigpause
+#include <errno.h>
+#include <signal.h>
+#undef sigpause
+
+int
+__sigpause (sig_or_mask, is_sig)
+ int sig_or_mask;
+ int is_sig;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (__sigpause)
+libc_hidden_def (__sigpause)
+
+int
+__attribute__ ((weak))
+__default_sigpause (int mask)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__default_sigpause, sigpause)
+stub_warning (sigpause)
+#include <stub-tag.h>
+
+
+int
+__attribute ((weak))
+__xpg___sigpause (int sig)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
diff --git a/libc/signal/sigpending.c b/libc/signal/sigpending.c
new file mode 100644
index 000000000..80e16e588
--- /dev/null
+++ b/libc/signal/sigpending.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 1991, 1995, 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stddef.h>
+#include <signal.h>
+
+
+/* Store in SET all signals that are blocked and pending. */
+int
+sigpending (set)
+ sigset_t *set;
+{
+ if (set == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigpending)
+#include <stub-tag.h>
diff --git a/libc/signal/sigprocmask.c b/libc/signal/sigprocmask.c
new file mode 100644
index 000000000..472b3a4fa
--- /dev/null
+++ b/libc/signal/sigprocmask.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 1991, 1995, 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* If SET is not NULL, modify the current set of blocked signals
+ according to HOW, which may be SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK.
+ If OSET is not NULL, store the old set of blocked signals in *OSET. */
+int
+__sigprocmask (how, set, oset)
+ int how;
+ const sigset_t *set;
+ sigset_t *oset;
+{
+ switch (how)
+ {
+ case SIG_BLOCK:
+ case SIG_UNBLOCK:
+ case SIG_SETMASK:
+ break;
+ default:
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+/* No stub warning because abort calls __sigprocmask,
+ and we don't want warnings for every use of abort on
+ a system without safe signals. */
+
+weak_alias (__sigprocmask, sigprocmask)
diff --git a/libc/signal/sigqueue.c b/libc/signal/sigqueue.c
new file mode 100644
index 000000000..c6e77c0a2
--- /dev/null
+++ b/libc/signal/sigqueue.c
@@ -0,0 +1,33 @@
+/* Implementation of sigqueue function from POSIX.1b.
+ Copyright (C) 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#include <sys/types.h>
+
+int
+__sigqueue (pid_t pid, int sig, const union sigval val)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__sigqueue, sigqueue)
+
+stub_warning (sigqueue)
+#include <stub-tag.h>
diff --git a/libc/signal/sigrelse.c b/libc/signal/sigrelse.c
new file mode 100644
index 000000000..ada72727c
--- /dev/null
+++ b/libc/signal/sigrelse.c
@@ -0,0 +1,41 @@
+/* Remove SIG from the calling process' signal mask.
+ Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define __need_NULL
+#include <stddef.h>
+#include <signal.h>
+
+int
+sigrelse (sig)
+ int sig;
+{
+ sigset_t set;
+
+ /* Retrieve current signal set. */
+ if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0)
+ return -1;
+
+ /* Remove the specified signal. */
+ if (sigdelset (&set, sig) < 0)
+ return -1;
+
+ /* Set the new mask. */
+ return __sigprocmask (SIG_SETMASK, &set, NULL);
+}
diff --git a/libc/signal/sigreturn.c b/libc/signal/sigreturn.c
new file mode 100644
index 000000000..0239b0a98
--- /dev/null
+++ b/libc/signal/sigreturn.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1992, 1994, 1995, 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+#include <errno.h>
+
+int
+__sigreturn (context)
+ struct sigcontext *context;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sigreturn)
+
+weak_alias (__sigreturn, sigreturn)
+#include <stub-tag.h>
diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c
new file mode 100644
index 000000000..191a90915
--- /dev/null
+++ b/libc/signal/sigset.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1998 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Set the disposition for SIG. */
+__sighandler_t
+sigset (sig, disp)
+ int sig;
+ __sighandler_t disp;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigset)
+#include <stub-tag.h>
diff --git a/libc/signal/sigsetmask.c b/libc/signal/sigsetmask.c
new file mode 100644
index 000000000..602c0add4
--- /dev/null
+++ b/libc/signal/sigsetmask.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991, 1995, 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+int
+__sigsetmask (mask)
+ int mask;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sigsetmask)
+
+weak_alias (__sigsetmask, sigsetmask)
+#include <stub-tag.h>
diff --git a/libc/signal/sigsetops.c b/libc/signal/sigsetops.c
new file mode 100644
index 000000000..0317662a1
--- /dev/null
+++ b/libc/signal/sigsetops.c
@@ -0,0 +1,11 @@
+/* Define the real-function versions of all inline functions
+ defined in signal.h (or bits/sigset.h). */
+
+#include <features.h>
+
+#define _EXTERN_INLINE
+#ifndef __USE_EXTERN_INLINES
+# define __USE_EXTERN_INLINES 1
+#endif
+
+#include "signal.h"
diff --git a/libc/signal/sigsetops.h b/libc/signal/sigsetops.h
new file mode 100644
index 000000000..52081c2ba
--- /dev/null
+++ b/libc/signal/sigsetops.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1995, 1996 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Definitions relevant to functions that operate on `sigset_t's. */
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+
+#define BITS (_NSIG - 1)
+#define ELT(signo) (((signo) - 1) / BITS)
+#define MASK(signo) (1 << (((signo) - 1) % BITS))
+
+#undef sigemptyset
+#undef sigfillset
+#undef sigaddset
+#undef sigdelset
+#undef sigismember
diff --git a/libc/signal/sigstack.c b/libc/signal/sigstack.c
new file mode 100644
index 000000000..ca9c8018a
--- /dev/null
+++ b/libc/signal/sigstack.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 2000 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+/* Run signals handlers on the stack specified by SS (if not NULL).
+ If OSS is not NULL, it is filled in with the old signal stack status. */
+int
+sigstack (ss, oss)
+ struct sigstack *ss;
+ struct sigstack *oss;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (sigstack)
+#include <stub-tag.h>
diff --git a/libc/signal/sigsuspend.c b/libc/signal/sigsuspend.c
new file mode 100644
index 000000000..58452e334
--- /dev/null
+++ b/libc/signal/sigsuspend.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991,1995,1996,1997,1998,2002 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+
+/* Change the set of blocked signals to SET,
+ wait until a signal arrives, and restore the set of blocked signals. */
+int
+__sigsuspend (set)
+ const sigset_t *set;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__sigsuspend)
+weak_alias (__sigsuspend, sigsuspend)
+
+stub_warning (sigsuspend)
+stub_warning (__sigsuspend)
+#include <stub-tag.h>
diff --git a/libc/signal/sigtimedwait.c b/libc/signal/sigtimedwait.c
new file mode 100644
index 000000000..7b114a313
--- /dev/null
+++ b/libc/signal/sigtimedwait.c
@@ -0,0 +1,34 @@
+/* Implementation of sigtimedwait function from POSIX.1b.
+ Copyright (C) 1997, 2002 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+int
+__sigtimedwait (const sigset_t *set, siginfo_t *info,
+ const struct timespec *timeout)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__sigtimedwait)
+weak_alias (__sigtimedwait, sigtimedwait)
+
+stub_warning (sigtimedwait)
+#include <stub-tag.h>
diff --git a/libc/signal/sigvec.c b/libc/signal/sigvec.c
new file mode 100644
index 000000000..148e9a0d8
--- /dev/null
+++ b/libc/signal/sigvec.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991, 1995, 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <signal.h>
+#include <errno.h>
+
+/* If VEC is non-NULL, set the handler for SIG to the `sv_handler' member
+ of VEC. The signals in `sv_mask' will be blocked while the handler runs.
+ If the SV_RESETHAND bit is set in `sv_flags', the handler for SIG will be
+ reset to SIG_DFL before `sv_handler' is entered. If OVEC is non-NULL,
+ it is filled in with the old information for SIG. */
+int
+__sigvec (sig, vec, ovec)
+ int sig;
+ const struct sigvec *vec;
+ struct sigvec *ovec;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (sigvec)
+
+weak_alias (__sigvec, sigvec)
+#include <stub-tag.h>
diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c
new file mode 100644
index 000000000..016768553
--- /dev/null
+++ b/libc/signal/sigwait.c
@@ -0,0 +1,32 @@
+/* sigwait - implementation of sigwait function from POSIX.1c.
+ Copyright (C) 1996 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+int
+__sigwait (const sigset_t *set, int *sig)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__sigwait, sigwait)
+
+stub_warning (sigwait)
+#include <stub-tag.h>
diff --git a/libc/signal/sigwaitinfo.c b/libc/signal/sigwaitinfo.c
new file mode 100644
index 000000000..e0659b024
--- /dev/null
+++ b/libc/signal/sigwaitinfo.c
@@ -0,0 +1,33 @@
+/* Implementation of sigwaitinfo function from POSIX.1b.
+ Copyright (C) 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+int
+__sigwaitinfo (const sigset_t *set, siginfo_t *info)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__sigwaitinfo)
+weak_alias (__sigwaitinfo, sigwaitinfo)
+
+stub_warning (sigwaitinfo)
+#include <stub-tag.h>
diff --git a/libc/signal/sys/signal.h b/libc/signal/sys/signal.h
new file mode 100644
index 000000000..2e602dad8
--- /dev/null
+++ b/libc/signal/sys/signal.h
@@ -0,0 +1 @@
+#include <signal.h>
diff --git a/libc/signal/sysv_signal.c b/libc/signal/sysv_signal.c
new file mode 100644
index 000000000..86dbb1d09
--- /dev/null
+++ b/libc/signal/sysv_signal.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1992, 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+
+/* Set the handler for the signal SIG to HANDLER,
+ returning the old handler, or SIG_ERR on error. */
+__sighandler_t
+__sysv_signal (sig, handler)
+ int sig;
+ __sighandler_t handler;
+{
+ /* Check signal extents to protect __sigismember. */
+ if (handler == SIG_ERR || sig < 1 || sig >= NSIG)
+ {
+ __set_errno (EINVAL);
+ return SIG_ERR;
+ }
+
+ __set_errno (ENOSYS);
+
+ return SIG_ERR;
+}
+weak_alias (__sysv_signal, sysv_signal)
+
+stub_warning (sysv_signal)
+#include <stub-tag.h>
diff --git a/libc/signal/tst-raise.c b/libc/signal/tst-raise.c
new file mode 100644
index 000000000..5ea9886a4
--- /dev/null
+++ b/libc/signal/tst-raise.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <error.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+volatile int count;
+
+void
+sh (int sig)
+{
+ ++count;
+}
+
+int
+main (void)
+{
+ struct sigaction sa;
+ sa.sa_handler = sh;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ if (sigaction (SIGUSR1, &sa, NULL) < 0)
+ {
+ printf ("sigaction failed: %m\n");
+ exit (1);
+ }
+ if (raise (SIGUSR1) < 0)
+ {
+ printf ("first raise failed: %m\n");
+ exit (1);
+ }
+ if (raise (SIGUSR1) < 0)
+ {
+ printf ("second raise failed: %m\n");
+ exit (1);
+ }
+ if (count != 2)
+ {
+ printf ("signal handler not called 2 times\n");
+ exit (1);
+ }
+ exit (0);
+}
diff --git a/libc/signal/tst-signal.c b/libc/signal/tst-signal.c
new file mode 100644
index 000000000..6d3178792
--- /dev/null
+++ b/libc/signal/tst-signal.c
@@ -0,0 +1,44 @@
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int win = 0;
+
+static void
+handler (int sig)
+{
+ printf ("Received signal %d (%s).\n", sig, strsignal(sig));
+ win = 1;
+}
+
+int
+main (void)
+{
+ if (signal (SIGTERM, handler) == SIG_ERR)
+ {
+ perror ("signal: SIGTERM");
+ exit (EXIT_FAILURE);
+ }
+
+ puts ("Set handler.");
+
+ printf ("Sending myself signal %d.\n", SIGTERM);
+ fflush (stdout);
+
+ if (raise (SIGTERM) < 0)
+ {
+ perror ("raise: SIGTERM");
+ exit (EXIT_FAILURE);
+ }
+
+ if (!win)
+ {
+ puts ("Didn't get any signal. Test FAILED!");
+ exit (EXIT_FAILURE);
+ }
+
+ puts ("Got a signal. Test succeeded.");
+
+ return EXIT_SUCCESS;
+}
diff --git a/libc/signal/tst-sigset.c b/libc/signal/tst-sigset.c
new file mode 100644
index 000000000..d47adcc0d
--- /dev/null
+++ b/libc/signal/tst-sigset.c
@@ -0,0 +1,43 @@
+/* Test sig*set functions. */
+
+#include <signal.h>
+#include <stdio.h>
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+ int result = 0;
+ int sig = -1;
+
+#define TRY(call) \
+ if (call) \
+ { \
+ printf ("%s (sig = %d): %m\n", #call, sig); \
+ result = 1; \
+ } \
+ else
+
+
+ sigset_t set;
+ TRY (sigemptyset (&set) != 0);
+
+#ifdef SIGRTMAX
+ int max_sig = SIGRTMAX;
+#else
+ int max_sig = NSIG - 1;
+#endif
+
+ for (sig = 1; sig <= max_sig; ++sig)
+ {
+ TRY (sigismember (&set, sig) != 0);
+ TRY (sigaddset (&set, sig) != 0);
+ TRY (sigismember (&set, sig) == 0);
+ TRY (sigdelset (&set, sig) != 0);
+ TRY (sigismember (&set, sig) != 0);
+ }
+
+ return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/libc/signal/tst-sigset2.c b/libc/signal/tst-sigset2.c
new file mode 100644
index 000000000..f65332332
--- /dev/null
+++ b/libc/signal/tst-sigset2.c
@@ -0,0 +1,184 @@
+/* sigset_SIG_HOLD_bug.c [BZ #1951] */
+#include <errno.h>
+#include <error.h>
+#include <inttypes.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#define TEST_SIG SIGINT
+
+
+/* Print mask of blocked signals for this process */
+static void
+printSigMask (const char *msg)
+{
+ sigset_t currMask;
+ int sig;
+ int cnt;
+
+ if (msg != NULL)
+ printf ("%s", msg);
+
+ if (sigprocmask (SIG_BLOCK, NULL, &currMask) == -1)
+ error (1, errno, "sigaction");
+
+ cnt = 0;
+ for (sig = 1; sig < NSIG; sig++)
+ {
+ if (sigismember (&currMask, sig))
+ {
+ cnt++;
+ printf ("\t\t%d (%s)\n", sig, strsignal (sig));
+ }
+ }
+
+ if (cnt == 0)
+ printf ("\t\t<empty signal set>\n");
+} /* printSigMask */
+
+static void
+handler (int sig)
+{
+ printf ("Caught signal %d\n", sig);
+ printSigMask ("Signal mask in handler\n");
+ printf ("Handler returning\n");
+ _exit (1);
+} /* handler */
+
+static void
+printDisposition (sighandler_t disp)
+{
+ if (disp == SIG_HOLD)
+ printf ("SIG_HOLD");
+ else if (disp == SIG_DFL)
+ printf ("SIG_DFL");
+ else if (disp == SIG_IGN)
+ printf ("SIG_IGN");
+ else
+ printf ("handled at %" PRIxPTR, (uintptr_t) disp);
+} /* printDisposition */
+
+static int
+returnTest1 (void)
+{
+ sighandler_t prev;
+
+ printf ("===== TEST 1 =====\n");
+ printf ("Blocking signal with sighold()\n");
+ if (sighold (TEST_SIG) == -1)
+ error (1, errno, "sighold");
+ printSigMask ("Signal mask after sighold()\n");
+
+ printf ("About to use sigset() to establish handler\n");
+ prev = sigset (TEST_SIG, handler);
+ if (prev == SIG_ERR)
+ error(1, errno, "sigset");
+
+ printf ("Previous disposition: ");
+ printDisposition (prev);
+ printf (" (should be SIG_HOLD)\n");
+ if (prev != SIG_HOLD)
+ {
+ printf("TEST FAILED!!!\n");
+ return 1;
+ }
+ return 0;
+} /* returnTest1 */
+
+static int
+returnTest2 (void)
+{
+ sighandler_t prev;
+
+ printf ("\n===== TEST 2 =====\n");
+
+ printf ("About to use sigset() to set SIG_HOLD\n");
+ prev = sigset (TEST_SIG, SIG_HOLD);
+ if (prev == SIG_ERR)
+ error (1, errno, "sigset");
+
+ printf ("Previous disposition: ");
+ printDisposition (prev);
+ printf (" (should be SIG_DFL)\n");
+ if (prev != SIG_DFL)
+ {
+ printf("TEST FAILED!!!\n");
+ return 1;
+ }
+ return 0;
+} /* returnTest2 */
+
+static int
+returnTest3 (void)
+{
+ sighandler_t prev;
+
+ printf ("\n===== TEST 3 =====\n");
+
+ printf ("About to use sigset() to set SIG_HOLD\n");
+ prev = sigset (TEST_SIG, SIG_HOLD);
+ if (prev == SIG_ERR)
+ error (1, errno, "sigset");
+
+ printf ("About to use sigset() to set SIG_HOLD (again)\n");
+ prev = sigset (TEST_SIG, SIG_HOLD);
+ if (prev == SIG_ERR)
+ error (1, errno, "sigset");
+
+ printf ("Previous disposition: ");
+ printDisposition (prev);
+ printf (" (should be SIG_HOLD)\n");
+ if (prev != SIG_HOLD)
+ {
+ printf("TEST FAILED!!!\n");
+ return 1;
+ }
+ return 0;
+} /* returnTest3 */
+
+int
+main (int argc, char *argv[])
+{
+ pid_t childPid;
+
+ childPid = fork();
+ if (childPid == -1)
+ error (1, errno, "fork");
+
+ if (childPid == 0)
+ exit (returnTest1 ());
+
+ int status;
+ if (TEMP_FAILURE_RETRY (waitpid (childPid, &status, 0)) != childPid)
+ error (1, errno, "waitpid");
+ int result = !WIFEXITED (status) || WEXITSTATUS (status) != 0;
+
+ childPid = fork();
+ if (childPid == -1)
+ error (1, errno, "fork");
+
+ if (childPid == 0)
+ exit (returnTest2 ());
+
+ if (TEMP_FAILURE_RETRY (waitpid (childPid, &status, 0)) != childPid)
+ error (1, errno, "waitpid");
+ result |= !WIFEXITED (status) || WEXITSTATUS (status) != 0;
+
+ childPid = fork();
+ if (childPid == -1)
+ error (1, errno, "fork");
+
+ if (childPid == 0)
+ exit (returnTest3 ());
+
+ if (TEMP_FAILURE_RETRY (waitpid (childPid, &status, 0)) != childPid)
+ error (1, errno, "waitpid");
+ result |= !WIFEXITED (status) || WEXITSTATUS (status) != 0;
+
+ return result;
+} /* main */
diff --git a/libc/signal/tst-sigsimple.c b/libc/signal/tst-sigsimple.c
new file mode 100644
index 000000000..22bb85cba
--- /dev/null
+++ b/libc/signal/tst-sigsimple.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static int
+do_test (void)
+{
+ int result = 0;
+ int e;
+
+#define RUN(test) \
+ errno = 0; \
+ e = test; \
+ if (e != -1) \
+ { \
+ printf ("%s returned %d\n", #test, e); \
+ result = 1; \
+ } \
+ else if (errno != EINVAL) \
+ { \
+ printf ("%s didn't set errno to EINVAL (%s instead)\n", \
+ #test, strerror (errno)); \
+ result = 1; \
+ }
+
+ RUN (sighold (-1));
+ RUN (sighold (_NSIG + 100));
+
+ RUN (sigrelse (-1));
+ RUN (sigrelse (_NSIG + 100));
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"