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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [include/] [signal.h] - Blame information for rev 1771

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

Line No. Rev Author Line
1 1325 phoenix
/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
2
   This file is part of the GNU C Library.
3
 
4
   The GNU C Library is free software; you can redistribute it and/or
5
   modify it under the terms of the GNU Lesser General Public
6
   License as published by the Free Software Foundation; either
7
   version 2.1 of the License, or (at your option) any later version.
8
 
9
   The GNU C Library is distributed in the hope that it will be useful,
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
   Lesser General Public License for more details.
13
 
14
   You should have received a copy of the GNU Lesser General Public
15
   License along with the GNU C Library; if not, write to the Free
16
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17
   02111-1307 USA.  */
18
 
19
/*
20
 *      ISO C99 Standard: 7.14 Signal handling <signal.h>
21
 */
22
 
23
#ifndef _SIGNAL_H
24
 
25
#if !defined __need_sig_atomic_t && !defined __need_sigset_t
26
# define _SIGNAL_H
27
#endif
28
 
29
#include <features.h>
30
 
31
__BEGIN_DECLS
32
 
33
#include <bits/sigset.h>                /* __sigset_t, __sig_atomic_t.  */
34
 
35
/* An integral type that can be modified atomically, without the
36
   possibility of a signal arriving in the middle of the operation.  */
37
#if defined __need_sig_atomic_t || defined _SIGNAL_H
38
# ifndef __sig_atomic_t_defined
39
#  define __sig_atomic_t_defined
40
typedef __sig_atomic_t sig_atomic_t;
41
# endif
42
# undef __need_sig_atomic_t
43
#endif
44
 
45
#if defined __need_sigset_t || (defined _SIGNAL_H && defined __USE_POSIX)
46
# ifndef __sigset_t_defined
47
#  define __sigset_t_defined
48
typedef __sigset_t sigset_t;
49
# endif
50
# undef __need_sigset_t
51
#endif
52
 
53
#ifdef _SIGNAL_H
54
 
55
#include <bits/types.h>
56
#include <bits/signum.h>
57
 
58
#ifdef __USE_XOPEN
59
# ifndef __pid_t_defined
60
typedef __pid_t pid_t;
61
#  define __pid_t_defined
62
# endif
63
# ifndef __uid_t_defined
64
typedef __uid_t uid_t;
65
#  define __uid_t_defined
66
# endif
67
#endif  /* Unix98 */
68
 
69
 
70
/* Type of a signal handler.  */
71
typedef void (*__sighandler_t) (int);
72
 
73
/* The X/Open definition of `signal' specifies the SVID semantic.  Use
74
   the additional function `sysv_signal' when X/Open compatibility is
75
   requested.  */
76
extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler)
77
     __THROW;
78
#ifdef __USE_GNU
79
extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler)
80
     __THROW;
81
#endif
82
 
83
/* Set the handler for the signal SIG to HANDLER, returning the old
84
   handler, or SIG_ERR on error.
85
   By default `signal' has the BSD semantic.  */
86
#ifdef __USE_BSD
87
extern __sighandler_t signal (int __sig, __sighandler_t __handler) __THROW;
88
#else
89
/* Make sure the used `signal' implementation is the SVID version. */
90
# ifdef __REDIRECT
91
extern __sighandler_t __REDIRECT (signal,
92
                                  (int __sig,
93
                                   __sighandler_t __handler) __THROW,
94
                                  __sysv_signal);
95
# else
96
#  define signal __sysv_signal
97
# endif
98
#endif
99
 
100
#ifdef __USE_XOPEN
101
/* The X/Open definition of `signal' conflicts with the BSD version.
102
   So they defined another function `bsd_signal'.  */
103
extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler) __THROW;
104
#endif
105
 
106
/* Send signal SIG to process number PID.  If PID is zero,
107
   send SIG to all processes in the current process's process group.
108
   If PID is < -1, send SIG to all processes in process group - PID.  */
109
#ifdef __USE_POSIX
110
extern int kill (__pid_t __pid, int __sig) __THROW;
111
#endif /* Use POSIX.  */
112
 
113
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
114
/* Send SIG to all processes in process group PGRP.
115
   If PGRP is zero, send SIG to all processes in
116
   the current process's process group.  */
117
extern int killpg (__pid_t __pgrp, int __sig) __THROW;
118
#endif /* Use BSD || X/Open Unix.  */
119
 
120
/* Raise signal SIG, i.e., send SIG to yourself.  */
121
extern int raise (int __sig) __THROW;
122
 
123
#ifdef __USE_SVID
124
/* SVID names for the same things.  */
125
extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) __THROW;
126
extern int gsignal (int __sig) __THROW;
127
#endif /* Use SVID.  */
128
 
129
#ifdef __USE_MISC
130
/* Print a message describing the meaning of the given signal number.  */
131
extern void psignal (int __sig, __const char *__s) __THROW;
132
#endif /* Use misc.  */
133
 
134
 
135
/* The `sigpause' function has two different interfaces.  The original
136
   BSD definition defines the argument as a mask of the signal, while
137
   the more modern interface in X/Open defines it as the signal
138
   number.  We go with the BSD version unless the user explicitly
139
   selects the X/Open version.  */
140
extern int __sigpause (int __sig_or_mask, int __is_sig) __THROW;
141
 
142
#ifdef __USE_BSD
143
/* Set the mask of blocked signals to MASK,
144
   wait for a signal to arrive, and then restore the mask.  */
145
extern int sigpause (int __mask) __THROW;
146
# define sigpause(mask) __sigpause ((mask), 0)
147
#else
148
# ifdef __USE_XOPEN
149
#  ifdef __GNUC__
150
extern int sigpause (int __sig) __THROW __asm__ ("__xpg_sigpause");
151
#  endif
152
/* Remove a signal from the signal mask and suspend the process.  */
153
#  define sigpause(sig) __sigpause ((sig), 1)
154
# endif
155
#endif
156
 
157
 
158
#ifdef __USE_BSD
159
/* None of the following functions should be used anymore.  They are here
160
   only for compatibility.  A single word (`int') is not guaranteed to be
161
   enough to hold a complete signal mask and therefore these functions
162
   simply do not work in many situations.  Use `sigprocmask' instead.  */
163
 
164
/* Compute mask for signal SIG.  */
165
# define sigmask(sig)   __sigmask(sig)
166
 
167
/* Block signals in MASK, returning the old mask.  */
168
extern int sigblock (int __mask) __THROW;
169
 
170
/* Set the mask of blocked signals to MASK, returning the old mask.  */
171
extern int sigsetmask (int __mask) __THROW;
172
 
173
/* Return currently selected signal mask.  */
174
extern int siggetmask (void) __THROW;
175
#endif /* Use BSD.  */
176
 
177
 
178
#ifdef __USE_MISC
179
# define NSIG   _NSIG
180
#endif
181
 
182
#ifdef __USE_GNU
183
typedef __sighandler_t sighandler_t;
184
#endif
185
 
186
/* 4.4 BSD uses the name `sig_t' for this.  */
187
#ifdef __USE_BSD
188
typedef __sighandler_t sig_t;
189
#endif
190
 
191
#ifdef __USE_POSIX
192
 
193
# ifdef __USE_POSIX199309
194
/* We need `struct timespec' later on.  */
195
#  define __need_timespec
196
#  include <time.h>
197
 
198
/* Get the `siginfo_t' type plus the needed symbols.  */
199
#  include <bits/siginfo.h>
200
# endif
201
 
202
/* Clear all signals from SET.  */
203
extern int sigemptyset (sigset_t *__set) __THROW;
204
 
205
/* Set all signals in SET.  */
206
extern int sigfillset (sigset_t *__set) __THROW;
207
 
208
/* Add SIGNO to SET.  */
209
extern int sigaddset (sigset_t *__set, int __signo) __THROW;
210
 
211
/* Remove SIGNO from SET.  */
212
extern int sigdelset (sigset_t *__set, int __signo) __THROW;
213
 
214
/* Return 1 if SIGNO is in SET, 0 if not.  */
215
extern int sigismember (__const sigset_t *__set, int __signo) __THROW;
216
 
217
# ifdef __USE_GNU
218
/* Return non-empty value is SET is not empty.  */
219
extern int sigisemptyset (__const sigset_t *__set) __THROW;
220
 
221
/* Build new signal set by combining the two inputs set using logical AND.  */
222
extern int sigandset (sigset_t *__set, __const sigset_t *__left,
223
                      __const sigset_t *__right) __THROW;
224
 
225
/* Build new signal set by combining the two inputs set using logical OR.  */
226
extern int sigorset (sigset_t *__set, __const sigset_t *__left,
227
                     __const sigset_t *__right) __THROW;
228
# endif /* GNU */
229
 
230
/* Get the system-specific definitions of `struct sigaction'
231
   and the `SA_*' and `SIG_*'. constants.  */
232
# include <bits/sigaction.h>
233
 
234
/* Get and/or change the set of blocked signals.  */
235
extern int sigprocmask (int __how, __const sigset_t *__restrict __set,
236
                        sigset_t *__restrict __oset) __THROW;
237
 
238
/* Change the set of blocked signals to SET,
239
   wait until a signal arrives, and restore the set of blocked signals.  */
240
extern int sigsuspend (__const sigset_t *__set) __THROW;
241
 
242
/* Get and/or set the action for signal SIG.  */
243
extern int sigaction (int __sig, __const struct sigaction *__restrict __act,
244
                      struct sigaction *__restrict __oact) __THROW;
245
 
246
/* Put in SET all signals that are blocked and waiting to be delivered.  */
247
extern int sigpending (sigset_t *__set) __THROW;
248
 
249
 
250
/* Select any of pending signals from SET or wait for any to arrive.  */
251
extern int sigwait (__const sigset_t *__restrict __set, int *__restrict __sig)
252
     __THROW;
253
 
254
# ifdef __USE_POSIX199309
255
/* Select any of pending signals from SET and place information in INFO.  */
256
extern int sigwaitinfo (__const sigset_t *__restrict __set,
257
                        siginfo_t *__restrict __info) __THROW;
258
 
259
/* Select any of pending signals from SET and place information in INFO.
260
   Wait the imte specified by TIMEOUT if no signal is pending.  */
261
extern int sigtimedwait (__const sigset_t *__restrict __set,
262
                         siginfo_t *__restrict __info,
263
                         __const struct timespec *__restrict __timeout)
264
     __THROW;
265
 
266
/* Send signal SIG to the process PID.  Associate data in VAL with the
267
   signal.  */
268
extern int sigqueue (__pid_t __pid, int __sig, __const union sigval __val)
269
     __THROW;
270
# endif /* Use POSIX 199306.  */
271
 
272
#endif /* Use POSIX.  */
273
 
274
#ifdef __USE_BSD
275
 
276
#ifdef __UCLIBC_HAS_SYS_SIGLIST__
277
/* Names of the signals.  This variable exists only for compatibility.
278
   Use `strsignal' instead (see <string.h>).  */
279
extern __const char *__const _sys_siglist[_NSIG];
280
extern __const char *__const sys_siglist[_NSIG];
281
#endif /* __UCLIBC_HAS_SYS_SIGLIST__ */
282
 
283
/* Structure passed to `sigvec'.  */
284
struct sigvec
285
  {
286
    __sighandler_t sv_handler;  /* Signal handler.  */
287
    int sv_mask;                /* Mask of signals to be blocked.  */
288
 
289
    int sv_flags;               /* Flags (see below).  */
290
# define sv_onstack     sv_flags /* 4.2 BSD compatibility.  */
291
  };
292
 
293
/* Bits in `sv_flags'.  */
294
# define SV_ONSTACK     (1 << 0)/* Take the signal on the signal stack.  */
295
# define SV_INTERRUPT   (1 << 1)/* Do not restart system calls.  */
296
# define SV_RESETHAND   (1 << 2)/* Reset handler to SIG_DFL on receipt.  */
297
 
298
 
299
/* If VEC is non-NULL, set the handler for SIG to the `sv_handler' member
300
   of VEC.  The signals in `sv_mask' will be blocked while the handler runs.
301
   If the SV_RESETHAND bit is set in `sv_flags', the handler for SIG will be
302
   reset to SIG_DFL before `sv_handler' is entered.  If OVEC is non-NULL,
303
   it is filled in with the old information for SIG.  */
304
extern int sigvec (int __sig, __const struct sigvec *__vec,
305
                   struct sigvec *__ovec) __THROW;
306
 
307
 
308
/* Get machine-dependent `struct sigcontext' and signal subcodes.  */
309
# include <bits/sigcontext.h>
310
 
311
/* Restore the state saved in SCP.  */
312
extern int sigreturn (struct sigcontext *__scp) __THROW;
313
 
314
#endif /*  use BSD.  */
315
 
316
 
317
#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
318
 
319
/* If INTERRUPT is nonzero, make signal SIG interrupt system calls
320
   (causing them to fail with EINTR); if INTERRUPT is zero, make system
321
   calls be restarted after signal SIG.  */
322
extern int siginterrupt (int __sig, int __interrupt) __THROW;
323
 
324
# include <bits/sigstack.h>
325
# ifdef __USE_XOPEN
326
#  include <ucontext.h>
327
# endif
328
 
329
/* Run signals handlers on the stack specified by SS (if not NULL).
330
   If OSS is not NULL, it is filled in with the old signal stack status.
331
   This interface is obsolete and on many platform not implemented.  */
332
extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) __THROW;
333
 
334
/* Alternate signal handler stack interface.
335
   This interface should always be preferred over `sigstack'.  */
336
extern int sigaltstack (__const struct sigaltstack *__restrict __ss,
337
                        struct sigaltstack *__restrict __oss) __THROW;
338
 
339
#endif /* use BSD or X/Open Unix.  */
340
 
341
#ifdef __USE_UNIX98
342
/* Simplified interface for signal management.  */
343
 
344
/* Add SIG to the calling process' signal mask.  */
345
extern int sighold (int __sig) __THROW;
346
 
347
/* Remove SIG from the calling process' signal mask.  */
348
extern int sigrelse (int __sig) __THROW;
349
 
350
/* Set the disposition of SIG to SIG_IGN.  */
351
extern int sigignore (int __sig) __THROW;
352
 
353
/* Set the disposition of SIG.  */
354
extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __THROW;
355
#endif
356
 
357
#if defined __UCLIBC_HAS_THREADS__ && (defined __USE_POSIX199506 || defined __USE_UNIX98)
358
/* Some of the functions for handling signals in threaded programs must
359
   be defined here.  */
360
# include <bits/sigthread.h>
361
#endif /* use Unix98 */
362
 
363
/* The following functions are used internally in the C library and in
364
   other code which need deep insights.  */
365
 
366
/* Return number of available real-time signal with highest priority.  */
367
extern int __libc_current_sigrtmin (void) __THROW;
368
/* Return number of available real-time signal with lowest priority.  */
369
extern int __libc_current_sigrtmax (void) __THROW;
370
 
371
#endif /* signal.h  */
372
 
373
__END_DECLS
374
 
375
#endif /* not signal.h */

powered by: WebSVN 2.1.0

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