diff options
author | greg@kroah.com <greg@kroah.com> | 2004-10-05 18:51:53 -0700 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 21:37:02 -0700 |
commit | 60d1e263f0da2976938fa54efec88ab777a6b3c3 (patch) | |
tree | 94bfcc4279827a68f90f8b63c0d458ddc753c69b /klibc/include/signal.h | |
parent | a0622777688ad84ef3d789e0171cfb0ca3dc21d2 (diff) |
[PATCH] oops forgot to add the new klibc/include directory
Diffstat (limited to 'klibc/include/signal.h')
-rw-r--r-- | klibc/include/signal.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/klibc/include/signal.h b/klibc/include/signal.h new file mode 100644 index 0000000000..1b439077f2 --- /dev/null +++ b/klibc/include/signal.h @@ -0,0 +1,81 @@ +/* + * signal.h + */ + +#ifndef _SIGNAL_H +#define _SIGNAL_H + +#include <klibc/compiler.h> +#include <klibc/extern.h> +#include <string.h> /* For memset() */ +#include <limits.h> /* For LONG_BIT */ +#include <sys/types.h> +#include <asm/signal.h> + +#include <klibc/archsignal.h> + +/* glibc seems to use sig_atomic_t as "int" pretty much on all architectures. + Do the same, but allow the architecture to override. */ +#ifdef _KLIBC_HAS_ARCH_SIG_ATOMIC_T +typedef int sig_atomic_t; +#endif + +/* Some architectures don't define these */ +#ifndef SA_RESETHAND +# define SA_RESETHAND SA_ONESHOT +#endif +#ifndef SA_NODEFER +# define SA_NODEFER SA_NOMASK +#endif +#ifndef NSIG +# define NSIG _NSIG +#endif + +__extern const char * const sys_siglist[]; + +/* This assumes sigset_t is either an unsigned long or an array of such, + and that _NSIG_BPW in the kernel is always LONG_BIT */ + +static __inline__ int sigemptyset(sigset_t *__set) +{ + memset(__set, 0, sizeof *__set); + return 0; +} +static __inline__ int sigfillset(sigset_t *__set) +{ + memset(__set, ~0, sizeof *__set); + return 0; +} +static __inline__ int sigaddset(sigset_t *__set, int __signum) +{ + unsigned long *__lset = (unsigned long *)__set; + __lset[__signum/LONG_BIT] |= 1UL << (__signum%LONG_BIT); + return 0; +} +static __inline__ int sigdelset(sigset_t *__set, int __signum) +{ + unsigned long *__lset = (unsigned long *)__set; + __lset[__signum/LONG_BIT] &= ~(1UL << (__signum%LONG_BIT)); + return 0; +} +static __inline__ int sigismember(sigset_t *__set, int __signum) +{ + unsigned long *__lset = (unsigned long *)__set; + return (int)((__lset[__signum/LONG_BIT] >> (__signum%LONG_BIT)) & 1); +} + +__extern __sighandler_t __signal(int, __sighandler_t, int); +__extern __sighandler_t sysv_signal(int, __sighandler_t); +__extern __sighandler_t bsd_signal(int, __sighandler_t); +__extern int sigaction(int, const struct sigaction *, struct sigaction *); +__extern int sigprocmask(int, const sigset_t *, sigset_t *); +__extern int sigpending(sigset_t *); +__extern int sigsuspend(const sigset_t *); +__extern int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t); +__extern int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t); +__extern int rt_sigpending(sigset_t *, size_t); +__extern int rt_sigsuspend(const sigset_t *, size_t); +__extern int raise(int); +__extern int kill(pid_t, int); + +#endif /* _SIGNAL_H */ |