2 * Copyright (C) 2004-2007 Atmel Corporation
4 * This file is subject to the terms and conditions of the GNU Lesser General
5 * Public License. See the file "COPYING.LIB" in the main directory of this
6 * archive for more details.
11 #include <sys/syscall.h>
12 #include <bits/kernel_sigaction.h>
14 #define SA_RESTORER 0x04000000
15 extern void __default_rt_sa_restorer(void);
18 * If act is not NULL, change the action for sig to *act.
19 * If oact is not NULL, put the old action for sig in *oact.
21 int __libc_sigaction(int sig
, const struct sigaction
*act
,
22 struct sigaction
*oact
)
24 struct sigaction kact
;
26 if (act
&& !(act
->sa_flags
& SA_RESTORER
)) {
27 memcpy(&kact
, act
, sizeof(kact
));
28 kact
.sa_restorer
= __default_rt_sa_restorer
;
29 kact
.sa_flags
|= SA_RESTORER
;
33 /* NB: kernel (as of 2.6.25) will return EINVAL
34 * if sizeof(act->sa_mask) does not match kernel's sizeof(sigset_t) */
35 return __syscall_rt_sigaction(sig
, act
, oact
, sizeof(act
->sa_mask
));
38 #ifndef LIBC_SIGACTION
39 # ifndef __UCLIBC_HAS_THREADS__
40 strong_alias(__libc_sigaction
,sigaction
)
41 libc_hidden_def(sigaction
)
43 weak_alias(__libc_sigaction
,sigaction
)
44 libc_hidden_weak(sigaction
)