1 |
786 |
skrzyp |
#ifndef CYGONCE_LIBC_SIGNALS_SIGNAL_H
|
2 |
|
|
#define CYGONCE_LIBC_SIGNALS_SIGNAL_H
|
3 |
|
|
//========================================================================
|
4 |
|
|
//
|
5 |
|
|
// signal.h
|
6 |
|
|
//
|
7 |
|
|
// Definitions for ISO C and POSIX 1003.1 signals
|
8 |
|
|
//
|
9 |
|
|
//========================================================================
|
10 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
18 |
|
|
// version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
21 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License
|
26 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use
|
30 |
|
|
// macros or inline functions from this file, or you compile this file
|
31 |
|
|
// and link it with other works to produce a work based on this file,
|
32 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
33 |
|
|
// the GNU General Public License. However the source code for this file
|
34 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
35 |
|
|
// General Public License v2.
|
36 |
|
|
//
|
37 |
|
|
// This exception does not invalidate any other reasons why a work based
|
38 |
|
|
// on this file might be covered by the GNU General Public License.
|
39 |
|
|
// -------------------------------------------
|
40 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
41 |
|
|
//========================================================================
|
42 |
|
|
//#####DESCRIPTIONBEGIN####
|
43 |
|
|
//
|
44 |
|
|
// Author(s): jlarmour
|
45 |
|
|
// Contributors:
|
46 |
|
|
// Date: 2000-04-18
|
47 |
|
|
// Purpose: Provides description of interface to ISO C and POSIX 1003.1
|
48 |
|
|
// signal functionality
|
49 |
|
|
// Description:
|
50 |
|
|
// Usage: Do not include this file directly - use #include <signal.h>
|
51 |
|
|
//
|
52 |
|
|
//####DESCRIPTIONEND####
|
53 |
|
|
//
|
54 |
|
|
//========================================================================
|
55 |
|
|
|
56 |
|
|
// CONFIGURATION
|
57 |
|
|
|
58 |
|
|
#include <pkgconf/libc_signals.h> // libc signals configuration
|
59 |
|
|
|
60 |
|
|
// INCLUDES
|
61 |
|
|
|
62 |
|
|
#include <cyg/infra/cyg_type.h> // Common type definitions and support
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
// TYPE DEFINITIONS
|
66 |
|
|
|
67 |
|
|
// Integral type that can be accessed atomically - from ISO C 7.7
|
68 |
|
|
typedef cyg_atomic sig_atomic_t;
|
69 |
|
|
|
70 |
|
|
// Type of signal handler functions
|
71 |
|
|
typedef void (*__sighandler_t)(int);
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
// CONSTANTS
|
76 |
|
|
|
77 |
|
|
// Signal handlers for use with signal(). We avoid 0 because in an embedded
|
78 |
|
|
// system this may be e.g. start of ROM and thus a possible function pointer
|
79 |
|
|
// for reset!
|
80 |
|
|
|
81 |
|
|
#define SIG_DFL ((__sighandler_t) 1) // Default action
|
82 |
|
|
#define SIG_IGN ((__sighandler_t) 2) // Ignore action
|
83 |
|
|
#define SIG_ERR ((__sighandler_t)-1) // Error return
|
84 |
|
|
|
85 |
|
|
// NB. We do not need to restrict SIG* definitions (e.g. by eliminating
|
86 |
|
|
// POSIX signals) when using strict ISO C (permitted in 7.7)
|
87 |
|
|
|
88 |
|
|
#define SIGNULL 0 // Reserved signal - do not use (POSIX 3.3.1.1)
|
89 |
|
|
#define SIGHUP 1 // Hangup on controlling terminal (POSIX)
|
90 |
|
|
#define SIGINT 2 // Interactive attention (ISO C)
|
91 |
|
|
#define SIGQUIT 3 // Interactive termination (POSIX)
|
92 |
|
|
#define SIGILL 4 // Illegal instruction (not reset when caught) (ISO C)
|
93 |
|
|
#define SIGTRAP 5 // Trace trap (not reset when caught)
|
94 |
|
|
#define SIGIOT 6 // IOT instruction
|
95 |
|
|
#define SIGABRT 6 // Abnormal termination - used by abort() (ISO C)
|
96 |
|
|
#define SIGEMT 7 // EMT instruction
|
97 |
|
|
#define SIGFPE 8 // Floating Point Exception e.g. div by 0 (ISO C)
|
98 |
|
|
#define SIGKILL 9 // Kill (cannot be caught or ignored) (POSIX)
|
99 |
|
|
#define SIGBUS 10 // Bus error (POSIX)
|
100 |
|
|
#define SIGSEGV 11 // Invalid memory reference (ISO C)
|
101 |
|
|
#define SIGSYS 12 // Bad argument to system call (used by anything?)
|
102 |
|
|
#define SIGPIPE 13 // Write on a pipe with no one to read it (POSIX)
|
103 |
|
|
#define SIGALRM 14 // Alarm timeout (POSIX)
|
104 |
|
|
#define SIGTERM 15 // Software termination request (ISO C)
|
105 |
|
|
#define SIGUSR1 16 // Application-defined signal 1 (POSIX)
|
106 |
|
|
#define SIGUSR2 17 // Application-defined signal 2 (POSIX)
|
107 |
|
|
|
108 |
|
|
#define CYGNUM_LIBC_SIGNALS 18 // Maximum signal number + 1
|
109 |
|
|
|
110 |
|
|
// FUNCTION PROTOTYPES
|
111 |
|
|
|
112 |
|
|
#ifdef __cplusplus
|
113 |
|
|
extern "C" {
|
114 |
|
|
#endif
|
115 |
|
|
|
116 |
|
|
//===========================================================================
|
117 |
|
|
|
118 |
|
|
// ISO C functions
|
119 |
|
|
|
120 |
|
|
//////////////////////////////
|
121 |
|
|
// signal() - ISO C 7.7.1 //
|
122 |
|
|
//////////////////////////////
|
123 |
|
|
//
|
124 |
|
|
// Installs a new signal handler for the specified signal, and returns
|
125 |
|
|
// the old handler
|
126 |
|
|
//
|
127 |
|
|
|
128 |
|
|
extern __sighandler_t
|
129 |
|
|
signal(int __sig, __sighandler_t __handler);
|
130 |
|
|
|
131 |
|
|
///////////////////////////
|
132 |
|
|
// raise() - ISO C 7.7.2 //
|
133 |
|
|
///////////////////////////
|
134 |
|
|
//
|
135 |
|
|
// Raises the signal, which will cause the current signal handler for
|
136 |
|
|
// that signal to be called
|
137 |
|
|
//
|
138 |
|
|
|
139 |
|
|
extern int
|
140 |
|
|
raise(int __sig);
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
#ifdef __cplusplus
|
144 |
|
|
} // extern "C"
|
145 |
|
|
#endif
|
146 |
|
|
|
147 |
|
|
#include <cyg/libc/signals/signal.inl>
|
148 |
|
|
|
149 |
|
|
#endif // CYGONCE_LIBC_SIGNALS_SIGNAL_H multiple inclusion protection
|
150 |
|
|
|
151 |
|
|
// EOF signal.h
|