COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
covise_signal.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef _EC_SIGNAL_H_
9 #define _EC_SIGNAL_H_
10 
11 /*
12  $Log$
13 */
14 
15 /**************************************************************************\
16  ** **
17  ** **
18  ** Description: Signal manager class for the COVISE **
19  ** software environment **
20  ** **
21  ** **
22  ** **
23  ** **
24  ** **
25  ** **
26  ** (C) 1995 **
27  ** Computer Center University of Stuttgart **
28  ** Allmandring 30 **
29  ** 70550 Stuttgart **
30  ** **
31  ** Author: D. Rantzau, A. Wierse **
32  ** **
33  ** Date: 12.12.95 V1.0 **
34  ** Last: **
35 \**************************************************************************/
36 
37 #include <util/coTypes.h>
38 
39 #ifndef _WIN32
40 #include <signal.h>
41 
42 #ifdef __sgi
43 
44 /*
45 extern "C" void (*signal(int,void (*)(int)))(int);
46 */
47 
48 // #define SIG_IGN (void (*)())0 /* ignore */
49 #define SIGHUP 1 /* hangup */
50 #define SIGINT 2 /* interrupt (rubout) */
51 #define SIGQUIT 3 /* quit (ASCII FS) */
52 #define SIGILL 4 /* illegal instruction (not reset when caught)*/
53 #define SIGTRAP 5 /* trace trap (not reset when caught) */
54 #define SIGIOT 6 /* IOT instruction */
55 #define SIGABRT 6 /* used by abort, replace SIGIOT in the future */
56 #define SIGEMT 7 /* EMT instruction */
57 #define SIGFPE 8 /* floating point exception */
58 #define SIGKILL 9 /* kill (cannot be caught or ignored) */
59 #define SIGBUS 10 /* bus error */
60 #define SIGSEGV 11 /* segmentation violation */
61 #define SIGSYS 12 /* bad argument to system call */
62 #define SIGPIPE 13 /* write on a pipe with no one to read it */
63 #define SIGALRM 14 /* alarm clock */
64 #define SIGTERM 15 /* software termination signal from kill */
65 #define SIGUSR1 16 /* user defined signal 1 */
66 #define SIGUSR2 17 /* user defined signal 2 */
67 #define SIGCLD 18 /* death of a child */
68 #define SIGCHLD 18 /* 4.3BSD's/POSIX name */
69 #define SIGPWR 19 /* power-fail restart */
70 #define SIGWINCH 20 /* window size changes */
71 #define SIGURG 21 /* urgent condition on IO channel */
72 #define SIGPOLL 22 /* pollable event occurred */
73 #define SIGIO 22 /* input/output possible signal */
74 #define SIGSTOP 23 /* sendable stop signal not from tty */
75 #define SIGTSTP 24 /* stop signal from tty */
76 #define SIGCONT 25 /* continue a stopped process */
77 #define SIGTTIN 26 /* to readers pgrp upon background tty read */
78 #define SIGTTOU 27 /* like TTIN for output if (tp->t_local&LTOSTOP) */
79 #define SIGVTALRM 28 /* virtual time alarm */
80 #define SIGPROF 29 /* profiling alarm */
81 #define SIGXCPU 30 /* Cpu time limit exceeded */
82 #define SIGXFSZ 31 /* Filesize limit exceeded */
83 #define SIG32 32 /* Reserved for kernel usage */
84 #define SIGRTMIN 49 /* Posix 1003.1b signals */
85 #define SIGRTMAX 64 /* Posix 1003.1b signals */
86 
87 #include <signal.h>
88 
89 #else
90 
91 #include <signal.h>
92 #endif
93 #endif
94 
95 #ifdef __linux__
96 #define SignalHandler CO_SignalHandler
97 #endif
98 
99 namespace covise
100 {
101 
103 {
104 
105 public:
106  typedef void SigFunctVoid(int, void *);
107 
108 private:
109  void *oldData;
110  static void *userdata[65];
111  static void *doHandle(int sig);
112  static void *handler[65];
113  int sigNr;
114 #ifndef _WIN32
115  sigset_t oldmask, newmask, pendmask;
116 #endif
118  char *tmp_env;
119 
120 public:
121  SignalHandler();
122  void addSignal(int signo, void *handlerFunc, void *udata);
123  void removeSignal(int signo);
124  // void blockSignal(int signo);
125  // void unblockSignal(int signo);
126  void blockSignals(void);
127  void unblockSignals(void);
128  int isPending(int signo);
129  ~SignalHandler(void);
130 };
131 
132 void (*my_signal(int sig, void (*func)(int)))(int);
133 }
134 #endif
int sigNr
Definition: covise_signal.h:113
sigset_t pendmask
Definition: covise_signal.h:115
void SigFunctVoid(int, void *)
Definition: covise_signal.h:106
int use_signals
Definition: covise_signal.h:117
GLenum func
Definition: khronos-glext.h:6719
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
#define COVISEEXPORT
Definition: coExport.h:188
Definition: covise_signal.h:102
void * oldData
Definition: covise_signal.h:109
char * tmp_env
Definition: covise_signal.h:118
void(*)(int) my_signal(int signo, void(*func)(int))
Definition: covise_signal.cpp:157