123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- /*
- * Copyright (c) 2006-2021, RT-Thread Development Team
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Change Logs:
- * Date Author Notes
- * 2017-09-12 Bernard The first version
- */
- #ifndef LIBC_SIGNAL_H__
- #define LIBC_SIGNAL_H__
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <stdint.h>
- #ifdef HAVE_CCONFIG_H
- #include <cconfig.h>
- #endif
- #ifndef HAVE_SIGVAL
- /* Signal Generation and Delivery, P1003.1b-1993, p. 63
- NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and
- sigev_notify_attributes to the sigevent structure. */
- union sigval
- {
- int sival_int; /* Integer signal value */
- void *sival_ptr; /* Pointer signal value */
- };
- #endif
- #ifndef HAVE_SIGEVENT
- struct sigevent
- {
- int sigev_notify; /* Notification type */
- int sigev_signo; /* Signal number */
- union sigval sigev_value; /* Signal value */
- void (*sigev_notify_function)( union sigval );
- /* Notification function */
- void *sigev_notify_attributes; /* Notification Attributes, really pthread_attr_t */
- };
- #endif
- #ifndef HAVE_SIGINFO
- struct siginfo
- {
- uint16_t si_signo;
- uint16_t si_code;
- union sigval si_value;
- };
- typedef struct siginfo siginfo_t;
- #endif
- #define SI_USER 0x01 /* Signal sent by kill(). */
- #define SI_QUEUE 0x02 /* Signal sent by sigqueue(). */
- #define SI_TIMER 0x03 /* Signal generated by expiration of a
- timer set by timer_settime(). */
- #define SI_ASYNCIO 0x04 /* Signal generated by completion of an
- asynchronous I/O request. */
- #define SI_MESGQ 0x05 /* Signal generated by arrival of a
- message on an empty message queue. */
- #if !defined(RT_USING_NEWLIB)
- typedef void (*_sig_func_ptr)(int);
- typedef unsigned long sigset_t;
- #endif
- #include <signal.h>
- #if defined(__CC_ARM) || defined(__CLANG_ARM)
- #define SIGHUP 1
- /* #define SIGINT 2 */
- #define SIGQUIT 3
- /* #define SIGILL 4 */
- #define SIGTRAP 5
- /* #define SIGABRT 6 */
- #define SIGEMT 7
- /* #define SIGFPE 8 */
- #define SIGKILL 9
- #define SIGBUS 10
- /* #define SIGSEGV 11 */
- #define SIGSYS 12
- #define SIGPIPE 13
- #define SIGALRM 14
- /* #define SIGTERM 15 */
- #define SIGURG 16
- #define SIGSTOP 17
- #define SIGTSTP 18
- #define SIGCONT 19
- #define SIGCHLD 20
- #define SIGTTIN 21
- #define SIGTTOU 22
- #define SIGPOLL 23
- #define SIGWINCH 24
- /* #define SIGUSR1 25 */
- /* #define SIGUSR2 26 */
- #define SIGRTMIN 27
- #define SIGRTMAX 31
- #define NSIG 32
- #define SIG_SETMASK 0 /* set mask with sigprocmask() */
- #define SIG_BLOCK 1 /* set of signals to block */
- #define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
- struct sigaction
- {
- _sig_func_ptr sa_handler;
- sigset_t sa_mask;
- int sa_flags;
- };
- #define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0)
- #define sigdelset(what,sig) (*(what) &= ~(1<<(sig)), 0)
- #define sigemptyset(what) (*(what) = 0, 0)
- #define sigfillset(what) (*(what) = ~(0), 0)
- #define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
- int sigprocmask (int how, const sigset_t *set, sigset_t *oset);
- int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
- #elif defined(__IAR_SYSTEMS_ICC__)
- #define SIGHUP 1
- #define SIGINT 2
- #define SIGQUIT 3
- #define SIGILL 4
- #define SIGTRAP 5
- /* #define SIGABRT 6 */
- #define SIGEMT 7
- #define SIGFPE 8
- #define SIGKILL 9
- #define SIGBUS 10
- #define SIGSEGV 11
- #define SIGSYS 12
- #define SIGPIPE 13
- #define SIGALRM 14
- #define SIGTERM 15
- #define SIGURG 16
- #define SIGSTOP 17
- #define SIGTSTP 18
- #define SIGCONT 19
- #define SIGCHLD 20
- #define SIGTTIN 21
- #define SIGTTOU 22
- #define SIGPOLL 23
- #define SIGWINCH 24
- #define SIGUSR1 25
- #define SIGUSR2 26
- #define SIGRTMIN 27
- #define SIGRTMAX 31
- #define NSIG 32
- #define SIG_SETMASK 0 /* set mask with sigprocmask() */
- #define SIG_BLOCK 1 /* set of signals to block */
- #define SIG_UNBLOCK 2 /* set of signals to, well, unblock */
- struct sigaction
- {
- _sig_func_ptr sa_handler;
- sigset_t sa_mask;
- int sa_flags;
- };
- #define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0)
- #define sigdelset(what,sig) (*(what) &= ~(1<<(sig)), 0)
- #define sigemptyset(what) (*(what) = 0, 0)
- #define sigfillset(what) (*(what) = ~(0), 0)
- #define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
- int sigprocmask (int how, const sigset_t *set, sigset_t *oset);
- int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|