OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [include/] [sys/] [signal.h] - Blame information for rev 148

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* sys/signal.h */
2
 
3
#ifndef _SYS_SIGNAL_H
4
#define _SYS_SIGNAL_H
5
#ifdef __cplusplus
6
extern "C" {
7
#endif
8
 
9
#include "_ansi.h"
10
#include <sys/features.h>
11
 
12
/* #ifndef __STRICT_ANSI__*/
13
 
14
#if defined(_POSIX_THREADS)
15
#include <sys/types.h>   /* for pthread data types */
16
#endif
17
 
18
typedef unsigned long sigset_t;
19
 
20
#if defined(__rtems__)
21
 
22
#if defined(_POSIX_REALTIME_SIGNALS)
23
 
24
/* sigev_notify values
25
   NOTE: P1003.1c/D10, p. 34 adds SIGEV_THREAD.  */
26
 
27
#define SIGEV_NONE   1  /* No asynchronous notification shall be delivered */
28
                        /*   when the event of interest occurs. */
29
#define SIGEV_SIGNAL 2  /* A queued signal, with an application defined */
30
                        /*  value, shall be delivered when the event of */
31
                        /*  interest occurs. */
32
#define SIGEV_THREAD 3  /* A notification function shall be called to */
33
                        /*   perform notification. */
34
 
35
/*  Signal Generation and Delivery, P1003.1b-1993, p. 63
36
    NOTE: P1003.1c/D10, p. 34 adds sigev_notify_function and
37
          sigev_notify_attributes to the sigevent structure.  */
38
 
39
union sigval {
40
  int    sival_int;    /* Integer signal value */
41
  void  *sival_ptr;    /* Pointer signal value */
42
};
43
 
44
struct sigevent {
45
  int              sigev_notify;               /* Notification type */
46
  int              sigev_signo;                /* Signal number */
47
  union sigval     sigev_value;                /* Signal value */
48
 
49
#if defined(_POSIX_THREADS)
50
  void           (*sigev_notify_function)( union sigval );
51
                                               /* Notification function */
52
  pthread_attr_t  *sigev_notify_attributes;    /* Notification Attributes */
53
#endif
54
};
55
 
56
/* Signal Actions, P1003.1b-1993, p. 64 */
57
/* si_code values, p. 66 */
58
 
59
#define SI_USER    1    /* Sent by a user. kill(), abort(), etc */
60
#define SI_QUEUE   2    /* Sent by sigqueue() */
61
#define SI_TIMER   3    /* Sent by expiration of a timer_settime() timer */
62
#define SI_ASYNCIO 4    /* Indicates completion of asycnhronous IO */
63
#define SI_MESGQ   5    /* Indicates arrival of a message at an empty queue */
64
 
65
typedef struct {
66
  int          si_signo;    /* Signal number */
67
  int          si_code;     /* Cause of the signal */
68
  union sigval si_value;    /* Signal value */
69
} siginfo_t;
70
#endif
71
 
72
/*  3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 */
73
 
74
#define SA_NOCLDSTOP 1   /* Do not generate SIGCHLD when children stop */
75
#define SA_SIGINFO   2   /* Invoke the signal catching function with */
76
                         /*   three arguments instead of one. */
77
 
78
/* struct sigaction notes from POSIX:
79
 *
80
 *  (1) Routines stored in sa_handler should take a single int as
81
 *      their argument although the POSIX standard does not require this.
82
 *  (2) The fields sa_handler and sa_sigaction may overlap, and a conforming
83
 *      application should not use both simultaneously.
84
 */
85
 
86
typedef void (*_sig_func_ptr)();
87
 
88
struct sigaction {
89
  int         sa_flags;       /* Special flags to affect behavior of signal */
90
  sigset_t    sa_mask;        /* Additional set of signals to be blocked */
91
                              /*   during execution of signal-catching */
92
                              /*   function. */
93
  union {
94
    _sig_func_ptr _handler;  /* SIG_DFL, SIG_IGN, or pointer to a function */
95
#if defined(_POSIX_REALTIME_SIGNALS)
96
    void      (*_sigaction)( int, siginfo_t *, void * );
97
#endif
98
  } _signal_handlers;
99
};
100
 
101
#define sa_handler    _signal_handlers._handler
102
#if defined(_POSIX_REALTIME_SIGNALS)
103
#define sa_sigaction  _signal_handlers._sigaction
104
#endif
105
 
106
#elif defined(__CYGWIN__)
107
#include <cygwin/signal.h>
108
#else
109
#define SA_NOCLDSTOP 1  /* only value supported now for sa_flags */
110
 
111
typedef void (*_sig_func_ptr)(int);
112
 
113
struct sigaction
114
{
115
        _sig_func_ptr sa_handler;
116
        sigset_t sa_mask;
117
        int sa_flags;
118
};
119
#endif /* defined(__rtems__) */
120
 
121
#define SIG_SETMASK 0   /* set mask with sigprocmask() */
122
#define SIG_BLOCK 1     /* set of signals to block */
123
#define SIG_UNBLOCK 2   /* set of signals to, well, unblock */
124
 
125
/* These depend upon the type of sigset_t, which right now
126
   is always a long.. They're in the POSIX namespace, but
127
   are not ANSI. */
128
#define sigaddset(what,sig) (*(what) |= (1<<(sig)), 0)
129
#define sigdelset(what,sig) (*(what) &= ~(1<<(sig)), 0)
130
#define sigemptyset(what)   (*(what) = 0, 0)
131
#define sigfillset(what)    (*(what) = ~(0), 0)
132
#define sigismember(what,sig) (((*(what)) & (1<<(sig))) != 0)
133
 
134
int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset));
135
 
136
#if defined(_POSIX_THREADS)
137
int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset));
138
#endif
139
 
140
/* protos for functions found in winsup sources for CYGWIN */
141
#if defined(__CYGWIN__) || defined(__rtems__)
142
#undef sigaddset
143
#undef sigdelset
144
#undef sigemptyset
145
#undef sigfillset
146
#undef sigismember
147
/* The first argument to kill should be pid_t.  Right now
148
   <sys/types.h> always defines pid_t to be int.  If that ever
149
   changes, then we will need to do something else, perhaps along the
150
   lines of <machine/types.h>.  */
151
int _EXFUN(kill, (int, int));
152
int _EXFUN(killpg, (pid_t, int));
153
int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *));
154
int _EXFUN(sigaddset, (sigset_t *, const int));
155
int _EXFUN(sigdelset, (sigset_t *, const int));
156
int _EXFUN(sigismember, (const sigset_t *, int));
157
int _EXFUN(sigfillset, (sigset_t *));
158
int _EXFUN(sigemptyset, (sigset_t *));
159
int _EXFUN(sigpending, (sigset_t *));
160
int _EXFUN(sigsuspend, (const sigset_t *));
161
int _EXFUN(sigpause, (int));
162
 
163
#if defined(_POSIX_THREADS)
164
#ifdef __CYGWIN__
165
#  ifndef _CYGWIN_TYPES_H
166
#    error You need the winsup sources or a cygwin installation to compile the cygwin version of newlib.
167
#  endif
168
#endif
169
int _EXFUN(pthread_kill, (pthread_t thread, int sig));
170
#endif
171
 
172
#if defined(_POSIX_REALTIME_SIGNALS)
173
 
174
/*  3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76
175
    NOTE: P1003.1c/D10, p. 39 adds sigwait().  */
176
 
177
int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t *info));
178
int _EXFUN(sigtimedwait,
179
  (const sigset_t *set, siginfo_t *info, const struct timespec  *timeout)
180
);
181
int _EXFUN(sigwait, (const sigset_t *set, int *sig));
182
 
183
/*  3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */
184
int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value));
185
 
186
#endif /* defined(_POSIX_REALTIME_SIGNALS) */
187
 
188
#endif /* defined(__CYGWIN__) || defined(__rtems__) */
189
 
190
/* #endif __STRICT_ANSI__ */
191
 
192
#if defined(___AM29K__)
193
/* These all need to be defined for ANSI C, but I don't think they are
194
   meaningful.  */
195
#define SIGABRT 1
196
#define SIGFPE 1
197
#define SIGILL 1
198
#define SIGINT 1
199
#define SIGSEGV 1
200
#define SIGTERM 1
201
/* These need to be defined for POSIX, and some others do too.  */
202
#define SIGHUP 1
203
#define SIGQUIT 1
204
#define NSIG 2
205
#elif defined(__GO32__)
206
#define SIGINT  1
207
#define SIGKILL 2
208
#define SIGPIPE 3
209
#define SIGFPE  4
210
#define SIGHUP  5
211
#define SIGTERM 6
212
#define SIGSEGV 7
213
#define SIGTSTP 8
214
#define SIGQUIT 9
215
#define SIGTRAP 10
216
#define SIGILL  11
217
#define SIGEMT  12
218
#define SIGALRM 13
219
#define SIGBUS  14
220
#define SIGLOST 15
221
#define SIGSTOP 16
222
#define SIGABRT 17
223
#define SIGUSR1 18
224
#define SIGUSR2 19
225
#define NSIG    20
226
#elif !defined(SIGTRAP)
227
#define SIGHUP  1       /* hangup */
228
#define SIGINT  2       /* interrupt */
229
#define SIGQUIT 3       /* quit */
230
#define SIGILL  4       /* illegal instruction (not reset when caught) */
231
#define SIGTRAP 5       /* trace trap (not reset when caught) */
232
#define SIGIOT  6       /* IOT instruction */
233
#define SIGABRT 6       /* used by abort, replace SIGIOT in the future */
234
#define SIGEMT  7       /* EMT instruction */
235
#define SIGFPE  8       /* floating point exception */
236
#define SIGKILL 9       /* kill (cannot be caught or ignored) */
237
#define SIGBUS  10      /* bus error */
238
#define SIGSEGV 11      /* segmentation violation */
239
#define SIGSYS  12      /* bad argument to system call */
240
#define SIGPIPE 13      /* write on a pipe with no one to read it */
241
#define SIGALRM 14      /* alarm clock */
242
#define SIGTERM 15      /* software termination signal from kill */
243
 
244
#if defined(__rtems__)
245
#define SIGURG  16      /* urgent condition on IO channel */
246
#define SIGSTOP 17      /* sendable stop signal not from tty */
247
#define SIGTSTP 18      /* stop signal from tty */
248
#define SIGCONT 19      /* continue a stopped process */
249
#define SIGCHLD 20      /* to parent on child stop or exit */
250
#define SIGCLD  20      /* System V name for SIGCHLD */
251
#define SIGTTIN 21      /* to readers pgrp upon background tty read */
252
#define SIGTTOU 22      /* like TTIN for output if (tp->t_local&LTOSTOP) */
253
#define SIGIO   23      /* input/output possible signal */
254
#define SIGPOLL SIGIO   /* System V name for SIGIO */
255
#define SIGWINCH 24     /* window changed */
256
#define SIGUSR1 25      /* user defined signal 1 */
257
#define SIGUSR2 26      /* user defined signal 2 */
258
 
259
/* Real-Time Signals Range, P1003.1b-1993, p. 61
260
   NOTE: By P1003.1b-1993, this should be at least RTSIG_MAX
261
         (which is a minimum of 8) signals.
262
 */
263
#define SIGRTMIN 27
264
#define SIGRTMAX 31
265
#define __SIGFIRSTNOTRT SIGHUP
266
#define __SIGLASTNOTRT  SIGUSR2
267
 
268
#define NSIG    32      /* signal 0 implied */
269
 
270
#elif defined(__svr4__)
271
/* svr4 specifics. different signals above 15, and sigaction. */
272
#define SIGUSR1 16
273
#define SIGUSR2 17
274
#define SIGCLD  18
275
#define SIGPWR  19
276
#define SIGWINCH 20
277
#define SIGPOLL 22      /* 20 for x.out binaries!!!! */
278
#define SIGSTOP 23      /* sendable stop signal not from tty */
279
#define SIGTSTP 24      /* stop signal from tty */
280
#define SIGCONT 25      /* continue a stopped process */
281
#define SIGTTIN 26      /* to readers pgrp upon background tty read */
282
#define SIGTTOU 27      /* like TTIN for output if (tp->t_local&LTOSTOP) */
283
#define NSIG    28      
284
#else
285
#define SIGURG  16      /* urgent condition on IO channel */
286
#define SIGSTOP 17      /* sendable stop signal not from tty */
287
#define SIGTSTP 18      /* stop signal from tty */
288
#define SIGCONT 19      /* continue a stopped process */
289
#define SIGCHLD 20      /* to parent on child stop or exit */
290
#define SIGCLD  20      /* System V name for SIGCHLD */
291
#define SIGTTIN 21      /* to readers pgrp upon background tty read */
292
#define SIGTTOU 22      /* like TTIN for output if (tp->t_local&LTOSTOP) */
293
#define SIGIO   23      /* input/output possible signal */
294
#define SIGPOLL SIGIO   /* System V name for SIGIO */
295
#define SIGXCPU 24      /* exceeded CPU time limit */
296
#define SIGXFSZ 25      /* exceeded file size limit */
297
#define SIGVTALRM 26    /* virtual time alarm */
298
#define SIGPROF 27      /* profiling time alarm */
299
#define SIGWINCH 28     /* window changed */
300
#define SIGLOST 29      /* resource lost (eg, record-lock lost) */
301
#define SIGUSR1 30      /* user defined signal 1 */
302
#define SIGUSR2 31      /* user defined signal 2 */
303
#define NSIG    32      /* signal 0 implied */
304
#endif
305
#endif
306
 
307
#ifdef __cplusplus
308
}
309
#endif
310
 
311
#ifndef _SIGNAL_H_
312
/* Some applications take advantage of the fact that <sys/signal.h>
313
 * and <signal.h> are equivalent in glibc.  Allow for that here.  */
314
#include <signal.h>
315
#endif
316
#endif /* _SYS_SIGNAL_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.