Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/include/sys/signal.h')
-rw-r--r--newlib/libc/include/sys/signal.h157
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