summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authormarcus <marcus>2005-01-27 04:20:56 +0000
committermarcus <marcus>2005-01-27 04:20:56 +0000
commit5e1770e77ea7c7d603ac8923e9a5910ef6d00e8f (patch)
tree8f4c1a4aec2f14bf95ba7c4ab80aa29cde0dbf47 /libc
parent050830eab7a59c2c6150d11740bfaf56d973d039 (diff)
2005-01-27 Marcus Brinkmann <marcus@gnu.org>
* hurd-l4/sysdeps/l4/hurd/sigaction.c: New dummy file to prevent including recursive dependencies from the BSD implementation. * hurd-l4/sysdeps/l4/hurd/sigprocmask.c: Likewise.
Diffstat (limited to 'libc')
-rw-r--r--libc/ChangeLog6
-rw-r--r--libc/hurd-l4/sysdeps/l4/hurd/sigaction.c94
-rw-r--r--libc/hurd-l4/sysdeps/l4/hurd/sigprocmask.c86
3 files changed, 186 insertions, 0 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index fffb9f3..25864da 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,9 @@
+2005-01-27 Marcus Brinkmann <marcus@gnu.org>
+
+ * hurd-l4/sysdeps/l4/hurd/sigaction.c: New dummy file to prevent
+ including recursive dependencies from the BSD implementation.
+ * hurd-l4/sysdeps/l4/hurd/sigprocmask.c: Likewise.
+
2005-01-23 Marcus Brinkmann <marcus@gnu.org>
* Initial check-in.
diff --git a/libc/hurd-l4/sysdeps/l4/hurd/sigaction.c b/libc/hurd-l4/sysdeps/l4/hurd/sigaction.c
new file mode 100644
index 0000000..873b85b
--- /dev/null
+++ b/libc/hurd-l4/sysdeps/l4/hurd/sigaction.c
@@ -0,0 +1,94 @@
+/* Copyright (C) 1991,92,93,94,95,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>
+
+/* 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 0
+ struct hurd_sigstate *ss;
+ struct sigaction a, old;
+ sigset_t pending;
+
+ if (sig <= 0 || sig >= NSIG ||
+ (act != NULL && act->sa_handler != SIG_DFL &&
+ ((__sigmask (sig) & _SIG_CANT_MASK) ||
+ act->sa_handler == SIG_ERR)))
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* Copy so we fault before taking locks. */
+ if (act != NULL)
+ a = *act;
+
+ ss = _hurd_self_sigstate ();
+
+ __spin_lock (&ss->critical_section_lock);
+ __spin_lock (&ss->lock);
+ old = ss->actions[sig];
+ if (act != NULL)
+ ss->actions[sig] = a;
+
+ if (act != NULL && sig == SIGCHLD &&
+ (a.sa_flags & SA_NOCLDSTOP) != (old.sa_flags & SA_NOCLDSTOP))
+ {
+ __spin_unlock (&ss->lock);
+
+ /* Inform the proc server whether or not it should send us SIGCHLD for
+ stopped children. We do this in a critical section so that no
+ SIGCHLD can arrive in the middle and be of indeterminate status. */
+ __USEPORT (PROC,
+ __proc_mod_stopchild (port, !(a.sa_flags & SA_NOCLDSTOP)));
+
+ __spin_lock (&ss->lock);
+ pending = ss->pending & ~ss->blocked;
+ }
+ else if (a.sa_handler == SIG_IGN || a.sa_handler == SIG_DFL)
+ /* We are changing to an action that might be to ignore SIG signals.
+ If SIG is blocked and pending and the new action is to ignore it, we
+ must remove it from the pending set now; if the action is changed
+ back and then SIG is unblocked, the signal pending now should not
+ arrive. So wake up the signal thread to check the new state and do
+ the right thing. */
+ pending = ss->pending & __sigmask (sig);
+ else
+ pending = 0;
+
+ __spin_unlock (&ss->lock);
+ __spin_unlock (&ss->critical_section_lock);
+
+ if (pending)
+ __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
+
+ if (oact != NULL)
+ *oact = old;
+#endif
+
+ return 0;
+}
+libc_hidden_def (__sigaction)
+weak_alias (__sigaction, sigaction)
diff --git a/libc/hurd-l4/sysdeps/l4/hurd/sigprocmask.c b/libc/hurd-l4/sysdeps/l4/hurd/sigprocmask.c
new file mode 100644
index 0000000..d02629c
--- /dev/null
+++ b/libc/hurd-l4/sysdeps/l4/hurd/sigprocmask.c
@@ -0,0 +1,86 @@
+/* Copyright (C) 1991,92,93,94,95,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>
+
+/* 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;
+{
+#if 0
+ struct hurd_sigstate *ss;
+ sigset_t old, new;
+ sigset_t pending;
+
+ if (set != NULL)
+ new = *set;
+
+ ss = _hurd_self_sigstate ();
+
+ __spin_lock (&ss->lock);
+
+ old = ss->blocked;
+
+ if (set != NULL)
+ {
+ switch (how)
+ {
+ case SIG_BLOCK:
+ __sigorset (&ss->blocked, &ss->blocked, &new);
+ break;
+
+ case SIG_UNBLOCK:
+ ss->blocked &= ~new;
+ break;
+
+ case SIG_SETMASK:
+ ss->blocked = new;
+ break;
+
+ default:
+ __spin_unlock (&ss->lock);
+ errno = EINVAL;
+ return -1;
+ }
+
+ ss->blocked &= ~_SIG_CANT_MASK;
+ }
+
+ pending = ss->pending & ~ss->blocked;
+
+ __spin_unlock (&ss->lock);
+
+ if (oset != NULL)
+ *oset = old;
+
+ if (pending)
+ /* Send a message to the signal thread so it
+ will wake up and check for pending signals. */
+ __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
+#endif
+
+ return 0;
+}
+
+weak_alias (__sigprocmask, sigprocmask)