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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [include/] [sys/] [signal.h] - Blame information for rev 1005

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

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

powered by: WebSVN 2.1.0

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