aboutsummaryrefslogtreecommitdiff
path: root/signal
diff options
context:
space:
mode:
Diffstat (limited to 'signal')
-rw-r--r--signal/Makefile5
-rw-r--r--signal/allocrtsig.c96
-rw-r--r--signal/kill.c37
-rw-r--r--signal/killpg.c36
-rw-r--r--signal/raise.c34
-rw-r--r--signal/sigaction.c44
-rw-r--r--signal/sigaltstack.c34
-rw-r--r--signal/sigblock.c33
-rw-r--r--signal/sigfillset.c47
-rw-r--r--signal/sigignore.c33
-rw-r--r--signal/sigintr.c35
-rw-r--r--signal/signal.c38
-rw-r--r--signal/sigpause.c53
-rw-r--r--signal/sigpending.c40
-rw-r--r--signal/sigprocmask.c51
-rw-r--r--signal/sigqueue.c33
-rw-r--r--signal/sigreturn.c32
-rw-r--r--signal/sigset.c34
-rw-r--r--signal/sigsetmask.c32
-rw-r--r--signal/sigstack.c34
-rw-r--r--signal/sigsuspend.c37
-rw-r--r--signal/sigtimedwait.c34
-rw-r--r--signal/sigvec.c39
-rw-r--r--signal/sigwait.c32
-rw-r--r--signal/sigwaitinfo.c33
-rw-r--r--signal/sysv_signal.c43
-rw-r--r--signal/tst-sigset2.c184
27 files changed, 1180 insertions, 3 deletions
diff --git a/signal/Makefile b/signal/Makefile
index b5c18fe..fa8d098 100644
--- a/signal/Makefile
+++ b/signal/Makefile
@@ -1,5 +1,4 @@
-# Copyright (C) 1991,1992,1993,1994,1995,1996,1997,1998,2003
-# Free Software Foundation, Inc.
+# 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
@@ -38,7 +37,7 @@ routines := signal raise killpg \
allocrtsig sigtimedwait sigwaitinfo sigqueue \
sighold sigrelse sigignore sigset
-tests := tst-signal tst-sigset tst-sigsimple tst-raise
+tests := tst-signal tst-sigset tst-sigsimple tst-raise tst-sigset2
distribute := sigsetops.h testrtsig.h sigset-cvt-mask.h
diff --git a/signal/allocrtsig.c b/signal/allocrtsig.c
new file mode 100644
index 0000000..ac8d2b6
--- /dev/null
+++ b/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/signal/kill.c b/signal/kill.c
new file mode 100644
index 0000000..1d81e45
--- /dev/null
+++ b/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/signal/killpg.c b/signal/killpg.c
new file mode 100644
index 0000000..ad9258d
--- /dev/null
+++ b/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/signal/raise.c b/signal/raise.c
new file mode 100644
index 0000000..c5a449f
--- /dev/null
+++ b/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/signal/sigaction.c b/signal/sigaction.c
new file mode 100644
index 0000000..bf0a15b
--- /dev/null
+++ b/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/signal/sigaltstack.c b/signal/sigaltstack.c
new file mode 100644
index 0000000..17c7e06
--- /dev/null
+++ b/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/signal/sigblock.c b/signal/sigblock.c
new file mode 100644
index 0000000..81a4ff1
--- /dev/null
+++ b/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/signal/sigfillset.c b/signal/sigfillset.c
new file mode 100644
index 0000000..95d52cf
--- /dev/null
+++ b/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/signal/sigignore.c b/signal/sigignore.c
new file mode 100644
index 0000000..734422d
--- /dev/null
+++ b/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/signal/sigintr.c b/signal/sigintr.c
new file mode 100644
index 0000000..9d4c2c8
--- /dev/null
+++ b/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/signal/signal.c b/signal/signal.c
new file mode 100644
index 0000000..6c1808b
--- /dev/null
+++ b/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/signal/sigpause.c b/signal/sigpause.c
new file mode 100644
index 0000000..bc598d0
--- /dev/null
+++ b/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/signal/sigpending.c b/signal/sigpending.c
new file mode 100644
index 0000000..80e16e5
--- /dev/null
+++ b/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/signal/sigprocmask.c b/signal/sigprocmask.c
new file mode 100644
index 0000000..472b3a4
--- /dev/null
+++ b/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/signal/sigqueue.c b/signal/sigqueue.c
new file mode 100644
index 0000000..c6e77c0
--- /dev/null
+++ b/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/signal/sigreturn.c b/signal/sigreturn.c
new file mode 100644
index 0000000..0239b0a
--- /dev/null
+++ b/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/signal/sigset.c b/signal/sigset.c
new file mode 100644
index 0000000..191a909
--- /dev/null
+++ b/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/signal/sigsetmask.c b/signal/sigsetmask.c
new file mode 100644
index 0000000..602c0ad
--- /dev/null
+++ b/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/signal/sigstack.c b/signal/sigstack.c
new file mode 100644
index 0000000..ca9c801
--- /dev/null
+++ b/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/signal/sigsuspend.c b/signal/sigsuspend.c
new file mode 100644
index 0000000..58452e3
--- /dev/null
+++ b/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/signal/sigtimedwait.c b/signal/sigtimedwait.c
new file mode 100644
index 0000000..7b114a3
--- /dev/null
+++ b/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/signal/sigvec.c b/signal/sigvec.c
new file mode 100644
index 0000000..148e9a0
--- /dev/null
+++ b/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/signal/sigwait.c b/signal/sigwait.c
new file mode 100644
index 0000000..0167685
--- /dev/null
+++ b/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/signal/sigwaitinfo.c b/signal/sigwaitinfo.c
new file mode 100644
index 0000000..e0659b0
--- /dev/null
+++ b/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/signal/sysv_signal.c b/signal/sysv_signal.c
new file mode 100644
index 0000000..86dbb1d
--- /dev/null
+++ b/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/signal/tst-sigset2.c b/signal/tst-sigset2.c
new file mode 100644
index 0000000..f653323
--- /dev/null
+++ b/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 */