]> git.ipfire.org Git - thirdparty/squid.git/blob - tools/purge/signal.hh
Merge from trunk
[thirdparty/squid.git] / tools / purge / signal.hh
1 //
2 // $Id$
3 //
4 // Author: Jens-S. V?ckler <voeckler@rvs.uni-hannover.de>
5 // File: signal.hh
6 // Date: Sat Feb 28 1998
7 // Compiler: gcc 2.7.2.x series
8 //
9 // Books: W. Richard Steven, "Advanced Programming in the UNIX Environment",
10 // Addison-Wesley, 1992.
11 //
12 // (c) 1998 Lehrgebiet Rechnernetze und Verteilte Systeme
13 // Universit?t Hannover, Germany
14 //
15 // Permission to use, copy, modify, distribute, and sell this software
16 // and its documentation for any purpose is hereby granted without fee,
17 // provided that (i) the above copyright notices and this permission
18 // notice appear in all copies of the software and related documentation,
19 // and (ii) the names of the Lehrgebiet Rechnernetze und Verteilte
20 // Systeme and the University of Hannover may not be used in any
21 // advertising or publicity relating to the software without the
22 // specific, prior written permission of Lehrgebiet Rechnernetze und
23 // Verteilte Systeme and the University of Hannover.
24 //
25 // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
27 // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
28 //
29 // IN NO EVENT SHALL THE LEHRGEBIET RECHNERNETZE UND VERTEILTE SYSTEME OR
30 // THE UNIVERSITY OF HANNOVER BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
31 // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
32 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
33 // ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
34 // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
35 // SOFTWARE.
36 //
37 // Revision 1.4 2000/09/21 10:59:27 cached
38 // introduced extern "C" to function pointer type.
39 //
40 // Revision 1.3 1999/01/19 11:53:49 voeckler
41 // added bool compatibility definitions.
42 //
43 // Revision 1.2 1999/01/19 11:00:50 voeckler
44 // added psignal(int,const char*) compatibility function declaration.
45 //
46 // Revision 1.1 1998/08/13 21:51:58 voeckler
47 // Initial revision
48 //
49 //
50 #ifndef _SIGNAL_HH
51 #define _SIGNAL_HH
52
53 #if defined(__GNUC__) || defined(__GNUG__)
54 #pragma interface
55 #else
56 #ifndef HAS_BOOL
57 #define HAS_BOOL
58 typedef int bool;
59 #define false 0
60 #define true 1
61 #endif
62 #endif
63
64 #if 1 // so far, all systems I know use void
65 # define SIGRETTYPE void
66 #else
67 # define SIGRETTYPE int
68 #endif
69
70 #if defined(SUNOS) && defined(SUN)
71 # define SIGPARAM void
72 #else // SOLARIS, LINUX, IRIX, AIX, SINIXY
73 # define SIGPARAM int
74 #endif
75
76 extern "C" {
77 typedef SIGRETTYPE SigFunc( SIGPARAM );
78 }
79
80 #ifndef HAS_PSIGNAL
81 void
82 psignal( int sig, const char* msg );
83 // purpose: print message, colon, space, signal name and LF.
84 // paramtr: sig (IN): signal number
85 // msg (IN): message to prepend
86 #endif // ! HAS_PSIGNAL
87
88 SigFunc*
89 Signal( int signo, SigFunc* newhandler, bool doInterrupt );
90 // purpose: install reliable signals
91 // paramtr: signo (IN): signal for which a handler is to be installed
92 // newhandler (IN): function pointer to the signal handler
93 // doInterrupt (IN): interrupted system calls wanted!
94 // returns: the old signal handler, or SIG_ERR in case of error.
95
96 SIGRETTYPE
97 sigChild( int signo );
98 // purpose: supply ad hoc child handler with output on stderr
99 // paramtr: signo (IN): == SIGCHLD
100 // returns: only if OS uses a return type for signal handler
101
102 #endif // _SIGNAL_HH