From 360b2b7ab8fd7cf337f02e260346a0f0ecbb8064 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 20 Mar 2007 16:51:12 +0000 Subject: Restructure header files for POSIX compliance; eliminate compile warnings git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@107 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/include/signal.h | 88 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 35 deletions(-) (limited to 'nuttx/include/signal.h') diff --git a/nuttx/include/signal.h b/nuttx/include/signal.h index df8fe214d..8e25f8c00 100644 --- a/nuttx/include/signal.h +++ b/nuttx/include/signal.h @@ -1,4 +1,4 @@ -/************************************************************ +/******************************************************************************** * signal.h * * Copyright (C) 2007 Gregory Nutt. All rights reserved. @@ -31,27 +31,27 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ********************************************************************************/ #ifndef __SIGNAL_H #define __SIGNAL_H -/************************************************************ +/******************************************************************************** * Included Files - ************************************************************/ + ********************************************************************************/ #include #include #include /* Needed for struct timespec */ #include /* Needed for, e.g., sigset_t */ -/************************************************************ +/******************************************************************************** * Compilations Switches - ************************************************************/ + ********************************************************************************/ -/************************************************************ +/******************************************************************************** * Definitions - ************************************************************/ + ********************************************************************************/ /* Signal set management definitions and macros. */ @@ -62,13 +62,18 @@ #define GOOD_SIGNO(s) (((s)>=MIN_SIGNO)&&((s)<=MAX_SIGNO)) #define SIGNO2SET(s) ((sigset_t)1 << (s)) +/* All signals are "real time" signals */ + +#define SIGRTMIN 0 /* First real time signal */ +#define SIGRTMAX 31 /* Last real time signal */ + /* sigprocmask() "how" definitions. Only one of the following * can be specified: */ -#define SIG_BLOCK 1 -#define SIG_UNBLOCK 2 -#define SIG_SETMASK 3 +#define SIG_BLOCK 1 /* Block the given signals */ +#define SIG_UNBLOCK 2 /* Unblock the given signals */ +#define SIG_SETMASK 3 /* Set the signal mask to the current set */ /* struct sigaction flag values */ @@ -80,19 +85,25 @@ /* Dummy value for the sigev_notify field of struct sigevent */ -#define SIGEV_SIGNAL 0 +#define SIGEV_SIGNAL 0 /* These are the possible values of the signfo si_code field */ -#define SI_QUEUE 0 /* Signal sent from sigqueue */ -#define SI_MESGQ 1 /* Signal generated by arrival of a message on an - * empty message queue */ -#define SI_NOWAIT 2 /* Signal already pending -- don't know how sent */ -#define SI_TIMEOUT 3 /* No-signal, unblocked by timeout */ +#define SI_USER 0 /* Signal sent from kill, raise, or abort */ +#define SI_QUEUE 1 /* Signal sent from sigqueue */ +#define SI_TIMER 2 /* Signal is result of timer expiration */ +#define SI_ASYNCIO 3 /* Signal is the result of asynch IO completion */ +#define SI_MESGQ 4 /* Signal generated by arrival of a message on an */ + /* empty message queue */ + +/* sigevent definitions */ -/************************************************************ +#define SIGEV_NONE 0 /* No notification desired */ +#define SIGEV_SIGNAL 1 /* Notify via signal */ + +/******************************************************************************** * Global Type Declarations - ************************************************************/ + ********************************************************************************/ /* This defines a set of 32 signals (numbered 0 through 31). */ @@ -106,6 +117,18 @@ union sigval void *sival_ptr; }; +/* This structure contains elements that define a queue signal. + * The following is used to attach a signal to a message queue + * to notify a task when a message is available on a queue + */ + +struct sigevent +{ + int sigev_signo; /* Notification: SIGNAL or NONE */ + union sigval sigev_value; /* Generate this signal */ + int sigev_notify; /* Queue this value */ +}; + /* The following types is used to pass parameters to/from * signal handlers */ @@ -132,13 +155,13 @@ struct sigaction #define sa_handler sa_u._sa_handler #define sa_sigaction sa_u._sa_sigaction -/************************************************************ +/******************************************************************************** * Global Variables - ************************************************************/ + ********************************************************************************/ -/************************************************************ +/******************************************************************************** * Global Function Prototypes - ************************************************************/ + ********************************************************************************/ #ifdef __cplusplus #define EXTERN extern "C" @@ -147,26 +170,21 @@ extern "C" { #define EXTERN extern #endif +EXTERN int kill(pid_t, int); EXTERN int sigemptyset(sigset_t *set); EXTERN int sigfillset(sigset_t *set); EXTERN int sigaddset(sigset_t *set, int signo); EXTERN int sigdelset(sigset_t *set, int signo); EXTERN int sigismember(const sigset_t *set, int signo); -EXTERN int sigaction(int sig, - const struct sigaction *act, - struct sigaction *oact); -EXTERN int sigprocmask(int how, const sigset_t *set, - sigset_t *oset); +EXTERN int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); +EXTERN int sigprocmask(int how, const sigset_t *set, sigset_t *oset); EXTERN int sigpending(sigset_t *set); EXTERN int sigsuspend(const sigset_t *sigmask); -EXTERN int sigwaitinfo(const sigset_t *set, - struct siginfo *value); -EXTERN int sigtimedwait(const sigset_t *set, - struct siginfo *value, - const struct timespec *timeout); +EXTERN int sigwaitinfo(const sigset_t *set, struct siginfo *value); +EXTERN int sigtimedwait(const sigset_t *set, struct siginfo *value, + const struct timespec *timeout); #ifdef CONFIG_CAN_PASS_STRUCTS -EXTERN int sigqueue(int pid, int signo, - const union sigval value); +EXTERN int sigqueue(int pid, int signo, const union sigval value); #else EXTERN int sigqueue(int pid, int signo, void *sival_ptr); #endif -- cgit v1.2.3