diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2000-12-12 01:24:09 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2000-12-12 01:24:09 +0000 |
commit | 8fb3796385eb2416d05567a5996cc60f251d0021 (patch) | |
tree | bbb95a383e2485dcc0fdf9948770e2edfad0aee1 /newlib/libc/include/sys/signal.h | |
parent | 947411367d78a0fcbecb21f47711bce31c5a0d08 (diff) | |
download | cygnal-8fb3796385eb2416d05567a5996cc60f251d0021.tar.gz cygnal-8fb3796385eb2416d05567a5996cc60f251d0021.tar.bz2 cygnal-8fb3796385eb2416d05567a5996cc60f251d0021.zip |
2000-12-11 Joel Sherrill <joel@OARcorp.com>
* Merge RTEMS specific .h files into main libc/include.
* libc/sys/rtems/include/signal.h: Removed.
* libc/sys/rtems/include/time.h: Removed.
* libc/sys/rtems/sys/features.h: Removed.
* libc/sys/rtems/sys/sched.h: Removed.
* libc/sys/rtems/sys/siginfo.h: Removed.
* libc/sys/rtems/sys/signal.h: Removed.
* libc/sys/rtems/sys/time.h: Removed.
* libc/sys/rtems/sys/times.h: Removed.
definitions for time_t and clock_t since these are
no longer in time.h.
* libc/include/pthread.h: New file.
* libc/include/sys/sched.h: New file.
* libc/include/sys/features.h: New file.
* libc/include/time.h: Removed duplicate definition of clock_t
and time_t, get them from <sys/types.h> instead. Add prototypes for POSIX clock and timer functionality.
* libc/sys/linux/sys/types.h: Changed to include
* libc/include/machine/types.h: Add _CLOCKID_T_ and _TIMER_T_.
* libc/include/sys/signal.h: Add more complete set of POSIX
signal functionality including real-time and threaded signals.
* libc/include/sys/types.h: Add clock_t, time_t, struct
timespec, and struct itimerspec. Centralizing these makes
things cleaner. RTEMS uses 64-bit dev_t.
Added numerous primitive definitions
for pthreads including macros, pthread_attr_t,
pthread_mutexattr_t, pthread_condattr_t, pthread_key_t,
pthread_once_t, and pthread_t.
* libc/include/sys/unistd.h: Added getlogin_r() prototype.
If RTEMS follow POSIX on read(), write() and sbrk() prototype.
Feature flags removed and moved to new file <sys/features.h>.
Full set of POSIX sysconf() constants
Diffstat (limited to 'newlib/libc/include/sys/signal.h')
-rw-r--r-- | newlib/libc/include/sys/signal.h | 157 |
1 files changed, 150 insertions, 7 deletions
diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h index 478531023..58d84de11 100644 --- a/newlib/libc/include/sys/signal.h +++ b/newlib/libc/include/sys/signal.h @@ -8,16 +8,113 @@ extern "C" { #endif #include "_ansi.h" +#include <sys/features.h> + +/* #ifndef __STRICT_ANSI__*/ + +#if defined(_POSIX_THREADS) +#include <sys/types.h> /* for pthread data types */ +#endif -#ifndef __STRICT_ANSI__ typedef unsigned long sigset_t; + +#if defined(__rtems__) + +#if defined(_POSIX_REALTIME_SIGNALS) + +/* sigev_notify values + NOTE: P1003.1c/D10, p. 34 adds SIGEV_THREAD. */ + +#define SIGEV_NONE 1 /* No asynchronous notification shall be delivered */ + /* when the event of interest occurs. */ +#define SIGEV_SIGNAL 2 /* A queued signal, with an application defined */ + /* value, shall be delivered when the event of */ + /* interest occurs. */ +#define SIGEV_THREAD 3 /* A notification function shall be called to */ + /* perform notification. */ + +/* 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 */ +}; + +struct sigevent { + int sigev_notify; /* Notification type */ + int sigev_signo; /* Signal number */ + union sigval sigev_value; /* Signal value */ + +#if defined(_POSIX_THREADS) + void (*sigev_notify_function)( union sigval ); + /* Notification function */ + pthread_attr_t *sigev_notify_attributes; /* Notification Attributes */ +#endif +}; + +/* Signal Actions, P1003.1b-1993, p. 64 */ +/* si_code values, p. 66 */ + +#define SI_USER 1 /* Sent by a user. kill(), abort(), etc */ +#define SI_QUEUE 2 /* Sent by sigqueue() */ +#define SI_TIMER 3 /* Sent by expiration of a timer_settime() timer */ +#define SI_ASYNCIO 4 /* Indicates completion of asycnhronous IO */ +#define SI_MESGQ 5 /* Indicates arrival of a message at an empty queue */ + +typedef struct { + int si_signo; /* Signal number */ + int si_code; /* Cause of the signal */ + union sigval si_value; /* Signal value */ +} siginfo_t; +#endif + +/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 */ + +#define SA_NOCLDSTOP 1 /* Do not generate SIGCHLD when children stop */ +#define SA_SIGINFO 2 /* Invoke the signal catching function with */ + /* three arguments instead of one. */ + +/* struct sigaction notes from POSIX: + * + * (1) Routines stored in sa_handler should take a single int as + * there argument although the POSIX standard does not require this. + * (2) The fields sa_handler and sa_sigaction may overlap, and a conforming + * application should not use both simultaneously. + */ + +struct sigaction { + int sa_flags; /* Special flags to affect behavior of signal */ + sigset_t sa_mask; /* Additional set of signals to be blocked */ + /* during execution of signal-catching */ + /* function. */ + union { + void (*_handler)(); /* SIG_DFL, SIG_IGN, or pointer to a function */ +#if defined(_POSIX_REALTIME_SIGNALS) + void (*_sigaction)( int, siginfo_t *, void * ); +#endif + } _signal_handlers; +}; + +#define sa_handler _signal_handlers._handler +#if defined(_POSIX_REALTIME_SIGNALS) +#define sa_sigaction _signal_handlers._sigaction +#endif + +#else + struct sigaction { void (*sa_handler)(int); sigset_t sa_mask; int sa_flags; }; -#define SA_NOCLDSTOP 1 /* only value supported now for sa_flags */ + +#define SA_NOCLDSTOP 1 /* only value supported now for sa_flags */ + +#endif /* defined(__rtems__) */ + #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 */ @@ -28,10 +125,14 @@ struct sigaction #define sigaddset(what,sig) (*(what) |= (1<<(sig))) #define sigemptyset(what) (*(what) = 0) -int sigprocmask (int __how, const sigset_t *__a, sigset_t *__b); +int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset)); + +#if defined(_POSIX_THREADS) +int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset)); +#endif -/* protos for functions found in winsup sources */ -#if defined(__CYGWIN__) +/* protos for functions found in winsup sources for CYGWIN */ +#if defined(__CYGWIN__) || defined(__rtems__) #undef sigaddset #undef sigemptyset /* The first argument to kill should be pid_t. Right now @@ -48,9 +149,30 @@ int _EXFUN(sigemptyset, (sigset_t *)); int _EXFUN(sigpending, (sigset_t *)); int _EXFUN(sigsuspend, (const sigset_t *)); int _EXFUN(sigpause, (int)); + +#if defined(_POSIX_THREADS) +int _EXFUN(pthread_kill, (pthread_t thread, int sig)); #endif -#endif /* __STRICT_ANSI__ */ +#if defined(_POSIX_REALTIME_SIGNALS) + +/* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 + NOTE: P1003.1c/D10, p. 39 adds sigwait(). */ + +int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t *info)); +int _EXFUN(sigtimedwait, + (const sigset_t *set, siginfo_t *info, const struct timespec *timeout) +); +int _EXFUN(sigwait, (const sigset_t *set, int *sig)); + +/* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */ +int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value)); + +#endif /* defined(_POSIX_REALTIME_SIGNALS) */ + +#endif /* defined(__CYGWIN32__) || defined(__rtems__) */ + +/* #endif __STRICT_ANSI__ */ #if defined(___AM29K__) /* These all need to be defined for ANSI C, but I don't think they are @@ -139,7 +261,28 @@ int _EXFUN(sigpause, (int)); #define SIGALRM 14 /* alarm clock */ #define SIGTERM 15 /* software termination signal from kill */ -#if defined(__svr4__) +#if defined(__rtems__) +#define SIGUSR1 16 /* reserved as application defined signal 1 */ +#define SIGUSR2 17 /* reserved as application defined signal 2 */ + +#define __SIGFIRSTNOTRT SIGHUP +#define __SIGLASTNOTRT SIGUSR2 + +/* RTEMS does not support job control, hence no Job Control Signals are + defined per P1003.1b-1993, p. 60-61. + + RTEMS does not support memory protection, hence no Memory Protection + Signals are defined per P1003.1b-1993, p. 60-61. */ + +/* Real-Time Signals Range, P1003.1b-1993, p. 61 + NOTE: By P1003.1b-1993, this should be at least RTSIG_MAX + (which is a minimum of 8) signals. + */ + +#define SIGRTMIN 18 +#define SIGRTMAX 32 + +#elif defined(__svr4__) /* svr4 specifics. different signals above 15, and sigaction. */ #define SIGUSR1 16 #define SIGUSR2 17 |