1 /* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 /* Modified 05/30/02 by Jeff Johnston, Red Hat Inc. */
25 #include <machine/syscall.h>
27 /* The difference here is that the sigaction structure used in the
28 kernel is not the same as we use in the libc. Therefore we must
30 #include <kernel_sigaction.h>
32 #define __NR___rt_sigaction __NR_rt_sigaction
34 static _syscall4(int,__rt_sigaction,int,sig,
35 const struct kernel_sigaction *,act,
36 struct kernel_sigaction *,oact,size_t,size);
38 /* If ACT is not NULL, change the action for SIG to *ACT.
39 If OACT is not NULL, put the old action for SIG in *OACT. */
41 __libc_sigaction (sig, act, oact)
43 const struct sigaction *act;
44 struct sigaction *oact;
47 struct kernel_sigaction kact, koact;
48 /* Save the current error value for later. We need not do this
49 if we are guaranteed to have realtime signals. */
53 kact.k_sa_handler = act->sa_handler;
54 memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
55 kact.sa_flags = act->sa_flags;
56 kact.sa_restorer = act->sa_restorer;
59 /* XXX The size argument hopefully will have to be changed to the
60 real size of the user-level sigset_t. */
61 result = __rt_sigaction (sig,
63 oact ? (&koact) : NULL, _NSIG / 8);
65 if (oact && result >= 0)
67 oact->sa_handler = koact.k_sa_handler;
68 memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
69 oact->sa_flags = koact.sa_flags;
70 oact->sa_restorer = koact.sa_restorer;
76 weak_alias (__libc_sigaction, __sigaction)
77 weak_alias (__libc_sigaction, sigaction)