[uClibc-cvs] uClibc/libc/signal sigaction.c,1.5,1.6
Erik Andersen
andersen at codepoet.org
Wed Jan 22 14:52:02 UTC 2003
Update of /var/cvs/uClibc/libc/signal
In directory winder:/tmp/cvs-serv9770/signal
Modified Files:
sigaction.c
Log Message:
Looks like sigaction on arm needs adjustment, so split this into
a common header file and a default implementation.
Index: sigaction.c
===================================================================
RCS file: /var/cvs/uClibc/libc/signal/sigaction.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sigaction.c 16 Feb 2002 20:19:35 -0000 1.5
+++ sigaction.c 22 Jan 2003 14:51:58 -0000 1.6
@@ -20,103 +20,11 @@
#include <signal.h>
#include <string.h>
#include <sys/syscall.h>
-
-
-/* The difference here is that the sigaction structure used in the
- kernel is not the same as we use in the libc. Therefore we must
- translate it here. */
-#define HAVE_SA_RESTORER
-
-
-#if defined(__alpha__)
-#undef HAVE_SA_RESTORER
-/* This is the sigaction struction from the Linux 2.1.20 kernel. */
-struct old_kernel_sigaction {
- __sighandler_t k_sa_handler;
- unsigned long sa_mask;
- unsigned int sa_flags;
-};
-/* This is the sigaction structure from the Linux 2.1.68 kernel. */
-struct kernel_sigaction {
- __sighandler_t k_sa_handler;
- unsigned int sa_flags;
- sigset_t sa_mask;
-};
-#elif defined(__hppa__)
-/* We do not support SA_RESTORER on hppa. */
-#undef HAVE_SA_RESTORER
-/* This is the sigaction struction from the Linux 2.1.20 kernel. */
-/* Blah. This is bogus. We don't ever use it. */
-struct old_kernel_sigaction {
- __sighandler_t k_sa_handler;
- unsigned long sa_mask;
- unsigned long sa_flags;
-};
-/* This is the sigaction structure from the Linux 2.1.68 kernel. */
-struct kernel_sigaction {
- __sighandler_t k_sa_handler;
- unsigned long sa_flags;
- sigset_t sa_mask;
-};
-#elif defined(__mips__)
-/* This is the sigaction structure from the Linux 2.1.24 kernel. */
-#include <sgidefs.h>
-struct old_kernel_sigaction {
- unsigned int sa_flags;
- __sighandler_t k_sa_handler;
- unsigned long sa_mask;
- unsigned int __pad0[3]; /* reserved, keep size constant */
-
- /* Abi says here follows reserved int[2] */
- void (*sa_restorer)(void);
-#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2)
- /* For 32 bit code we have to pad struct sigaction to get
- * constant size for the ABI */
- int pad1[1]; /* reserved */
-#endif
-};
-
-#define _KERNEL_NSIG 128
-#define _KERNEL_NSIG_BPW 32
-#define _KERNEL_NSIG_WORDS (_KERNEL_NSIG / _KERNEL_NSIG_BPW)
-
-typedef struct {
- unsigned long sig[_KERNEL_NSIG_WORDS];
-} kernel_sigset_t;
-
-/* This is the sigaction structure from the Linux 2.1.68 kernel. */
-struct kernel_sigaction {
- unsigned int sa_flags;
- __sighandler_t k_sa_handler;
- kernel_sigset_t sa_mask;
- void (*sa_restorer)(void);
- int s_resv[1]; /* reserved */
-};
-#else
-/* This is the sigaction structure from the Linux 2.1.20 kernel. */
-struct old_kernel_sigaction {
- __sighandler_t k_sa_handler;
- unsigned long sa_mask;
- unsigned long sa_flags;
- void (*sa_restorer) (void);
-};
-
-/* This is the sigaction structure from the Linux 2.1.68 kernel. */
-struct kernel_sigaction {
- __sighandler_t k_sa_handler;
- unsigned long sa_flags;
- void (*sa_restorer) (void);
- sigset_t sa_mask;
-};
-#endif
-
+#include <bits/kernel_sigaction.h>
#if defined __NR_rt_sigaction
-extern int __rt_sigaction (int, const struct kernel_sigaction *__unbounded,
- struct kernel_sigaction *__unbounded, size_t);
-
/* 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 __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
@@ -148,45 +56,40 @@
}
return result;
}
-weak_alias(__libc_sigaction, sigaction)
-
-
#else
-extern int __sigaction (int, const struct old_kernel_sigaction *__unbounded,
- struct old_kernel_sigaction *__unbounded);
-
/* 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 __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
{
- struct old_kernel_sigaction k_sigact, k_osigact;
int result;
+ struct old_kernel_sigaction kact, koact;
if (act) {
- k_sigact.k_sa_handler = act->sa_handler;
- k_sigact.sa_mask = act->sa_mask.__val[0];
- k_sigact.sa_flags = act->sa_flags;
+ kact.k_sa_handler = act->sa_handler;
+ kact.sa_mask = act->sa_mask.__val[0];
+ kact.sa_flags = act->sa_flags;
# ifdef HAVE_SA_RESTORER
- k_sigact.sa_restorer = act->sa_restorer;
+ kact.sa_restorer = act->sa_restorer;
# endif
}
- result = __sigaction(sig, act ? __ptrvalue (&k_sigact) : NULL,
- oact ? __ptrvalue (&k_osigact) : NULL);
+ result = __sigaction(sig, act ? __ptrvalue (&kact) : NULL,
+ oact ? __ptrvalue (&koact) : NULL);
if (oact && result >= 0) {
- oact->sa_handler = k_osigact.k_sa_handler;
- oact->sa_mask.__val[0] = k_osigact.sa_mask;
- oact->sa_flags = k_osigact.sa_flags;
+ oact->sa_handler = koact.k_sa_handler;
+ oact->sa_mask.__val[0] = koact.sa_mask;
+ oact->sa_flags = koact.sa_flags;
# ifdef HAVE_SA_RESTORER
- oact->sa_restorer = k_osigact.sa_restorer;
+ oact->sa_restorer = koact.sa_restorer;
# endif
}
return result;
}
+#endif
+
weak_alias(__libc_sigaction, sigaction)
-#endif
More information about the uClibc-cvs
mailing list