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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [language/] [c/] [libc/] [signals/] [v2_0/] [include/] [signal.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#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 Red Hat, 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 version.
18
//
19
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22
// for more details.
23
//
24
// You should have received a copy of the GNU General Public License along
25
// with eCos; if not, write to the Free Software Foundation, Inc.,
26
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27
//
28
// As a special exception, if other files instantiate templates or use macros
29
// or inline functions from this file, or you compile this file and link it
30
// with other works to produce a work based on this file, this file does not
31
// by itself cause the resulting work to be covered by the GNU General Public
32
// License. However the source code for this file must still be made available
33
// in accordance with section (3) of the GNU General Public License.
34
//
35
// This exception does not invalidate any other reasons why a work based on
36
// this file might be covered by the GNU General Public License.
37
//
38
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39
// at http://sources.redhat.com/ecos/ecos-license/
40
// -------------------------------------------
41
//####ECOSGPLCOPYRIGHTEND####
42
//========================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):     jlarmour
46
// Contributors:  
47
// Date:          2000-04-18
48
// Purpose:       Provides description of interface to ISO C and POSIX 1003.1
49
//                signal functionality
50
// Description:   
51
// Usage:         Do not include this file directly - use #include <signal.h>
52
//
53
//####DESCRIPTIONEND####
54
//
55
//========================================================================
56
 
57
// CONFIGURATION
58
 
59
#include <pkgconf/libc_signals.h>  // libc signals configuration
60
 
61
// INCLUDES
62
 
63
#include <cyg/infra/cyg_type.h>    // Common type definitions and support
64
 
65
#ifdef CYGSEM_LIBC_SIGNALS_POSIX
66
# include <unistd.h>               // _POSIX_* macros
67
#endif
68
 
69
 
70
// TYPE DEFINITIONS
71
 
72
// Integral type that can be accessed atomically - from ISO C 7.7
73
typedef cyg_atomic sig_atomic_t;
74
 
75
// Type of signal handler functions
76
typedef void (*__sighandler_t)(int);
77
 
78
#ifdef CYGSEM_LIBC_SIGNALS_POSIX
79
 
80
// Signal sets from POSIX 1003.1 chap 3.3.3 and other chaps
81
typedef cyg_uint32 sigset_t;
82
 
83
// POSIX 1003.1 chap 3.3.1.2
84
union sigval {
85
    int   sival_int;    // used when application-defined value is an int
86
    void *sival_ptr;    // used when application-defined value is a pointer
87
};
88
 
89
// Signal information structure passed to a __siginfoaction_t style handler
90
// from POSIX 1003.1 chap 3.3.1.3
91
typedef struct {
92
    int si_signo;           // signal number
93
    int si_code;            // cause of signal
94
    union sigval si_value;  // signal value
95
} siginfo_t;
96
 
97
 
98
// Type of signal handler used if SA_SIGINFO is set in flags to sigaction
99
// from POSIX 1003.1 chap 3.3.1.3
100
typedef void (*__siginfoaction_t)(int __signo, siginfo_t *__info,
101
                                  void *__context);
102
 
103
// struct sigaction describes the action to be taken when we get a signal
104
// From POSIX 1003.1 chap. 3.3.4.2
105
struct sigaction {
106
    sigset_t sa_mask;                   // Additional signals to be blocked
107
    int sa_flags;                       // Special flags
108
    union {
109
        __sighandler_t sa_handler;      // signal handler
110
        __siginfoaction_t sa_sigaction; // Function to call instead of
111
                                        // sa_handler if SA_SIGINFO is
112
                                        // set in sa_flags
113
    } __sigactionhandler;
114
#define sa_handler   __sigactionhandler.sa_handler
115
#define sa_sigaction __sigactionhandler.sa_sigaction
116
};
117
 
118
 
119
#endif // ifdef CYGSEM_LIBC_SIGNALS_POSIX
120
 
121
 
122
// CONSTANTS
123
 
124
// Signal handlers for use with signal(). We avoid 0 because in an embedded
125
// system this may be e.g. start of ROM and thus a possible function pointer
126
// for reset!
127
 
128
#define SIG_DFL ((__sighandler_t) 1)      // Default action
129
#define SIG_IGN ((__sighandler_t) 2)      // Ignore action
130
#define SIG_ERR ((__sighandler_t)-1)      // Error return
131
 
132
// NB. We do not need to restrict SIG* definitions (e.g. by eliminating
133
// POSIX signals) when using strict ISO C (permitted in 7.7)
134
 
135
#define SIGNULL   0    // Reserved signal - do not use (POSIX 3.3.1.1)
136
#define SIGHUP    1    // Hangup on controlling terminal (POSIX)
137
#define SIGINT    2    // Interactive attention (ISO C)
138
#define SIGQUIT   3    // Interactive termination (POSIX)
139
#define SIGILL    4    // Illegal instruction (not reset when caught) (ISO C)
140
#define SIGTRAP   5    // Trace trap (not reset when caught)
141
#define SIGIOT    6    // IOT instruction
142
#define SIGABRT   6    // Abnormal termination - used by abort() (ISO C)
143
#define SIGEMT    7    // EMT instruction
144
#define SIGFPE    8    // Floating Point Exception e.g. div by 0 (ISO C)
145
#define SIGKILL   9    // Kill (cannot be caught or ignored) (POSIX)
146
#if 1 // FIXME - should be #ifdef _POSIX_MEMORY_PROTECTION?
147
# define SIGBUS   10   // Bus error (POSIX)
148
#endif
149
#define SIGSEGV   11   // Invalid memory reference (ISO C)
150
#define SIGSYS    12   // Bad argument to system call (used by anything?)
151
#define SIGPIPE   13   // Write on a pipe with no one to read it (POSIX)
152
#define SIGALRM   14   // Alarm timeout (POSIX)
153
#define SIGTERM   15   // Software termination request (ISO C)
154
#define SIGUSR1   16   // Application-defined signal 1 (POSIX)
155
#define SIGUSR2   17   // Application-defined signal 2 (POSIX)
156
 
157
#define CYGNUM_LIBC_SIGNALS 18  // Maximum signal number + 1
158
 
159
#ifdef _POSIX_JOB_CONTROL
160
# define SIGCHLD  18   // Child process terminated or stopped (POSIX)
161
# define SIGCONT  19   // Continue if stopped (POSIX)
162
# define SIGSTOP  20   // Stop (cannot be caught or ignored) (POSIX)
163
# define SIGTSTP  21   // Interactive stop (POSIX)
164
# define SIGTTIN  22   // Terminal read attempted by backgrounded
165
                       // process (POSIX)
166
# define SIGTTOU  23   // Terminal write attempted by backgrounded
167
                       // process (POSIX)
168
#undef CYGNUM_LIBC_SIGNALS
169
#define CYGNUM_LIBC_SIGNALS 24
170
#endif
171
 
172
// FIXME - strictly by POSIX in 3.3.1.1 we should define SIGRTMIN/SIGRTMAX
173
// But if so, to what value if it _isn't_ supported?!
174
 
175
#ifdef CYGSEM_LIBC_SIGNALS_POSIX
176
// sa_flag bits in struct sigaction
177
#define SA_NOCLDSTOP 1   // Don't generate SIGCHLD when children stop
178
#define SA_SIGINFO   2   // Use the __siginfoaction_t style signal
179
                         // handler, instead of the single argument handler
180
#endif // ifdef CYGSEM_LIBC_SIGNALS_POSIX
181
 
182
 
183
// FUNCTION PROTOTYPES
184
 
185
#ifdef __cplusplus
186
extern "C" {
187
#endif
188
 
189
//===========================================================================
190
 
191
// ISO C functions
192
 
193
//////////////////////////////
194
// signal() - ISO C 7.7.1   //
195
//////////////////////////////
196
//
197
// Installs a new signal handler for the specified signal, and returns
198
// the old handler
199
//
200
 
201
extern __sighandler_t
202
signal(int __sig, __sighandler_t __handler);
203
 
204
///////////////////////////
205
// raise() - ISO C 7.7.2 //
206
///////////////////////////
207
//
208
// Raises the signal, which will cause the current signal handler for
209
// that signal to be called
210
//
211
 
212
extern int
213
raise(int __sig);
214
 
215
 
216
#ifdef __cplusplus
217
} // extern "C"
218
#endif 
219
 
220
#include <cyg/libc/signals/signal.inl>
221
 
222
#endif // CYGONCE_LIBC_SIGNALS_SIGNAL_H multiple inclusion protection
223
 
224
// EOF signal.h

powered by: WebSVN 2.1.0

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