This file is indexed.

/usr/include/assa-3.5/assa/Handlers.h is in libassa-3.5-5-dev 3.5.1-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
// -*- c++ -*-
//------------------------------------------------------------------------------
//                            Handlers.h
//------------------------------------------------------------------------------
//  Copyright (c) 2000,2005 by Vladislav Grinchenko
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Library General Public
//  License as published by the Free Software Foundation; either
//  version 2 of the License, or (at your option) any later version.
//------------------------------------------------------------------------

#ifndef _Handlers_h
#define _Handlers_h

#include <sys/types.h>

#if !defined(WIN32)
#    include <sys/wait.h>
#endif

#include "assa/EventHandler.h"
#include "assa/Assure.h"

namespace ASSA {

#if !defined(WIN32)

/** @file Handlers.h

    A collection of various most popular signal handlers.
 */


#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__) || defined (__NetBSD__)
#   define ASSAIOSIG SIGIO
#else
#   define ASSAIOSIG SIGPOLL
#endif

/**
   SIGINTHandler handles SIGINT signal.
*/

class SIGINTHandler : public EventHandler
{
public:
	/// constructor
	SIGINTHandler();

	/** Receive SIGINT signal
	    @return 0 if valid signum_ was used, -1 otherwise.
	*/
	int handle_signal (int signum_);

	/** Indicates whether graceful quit signal has been raised by
	    the signal handler.
	    @return 0 if not, 1 othewise.
	*/
	sig_atomic_t graceful_quit();

	///  Reset state of the object to initial
	void resetState();

private:
	/// flag that indicates whether signal was caught.
	sig_atomic_t m_graceful_quit;
};
 
inline
SIGINTHandler::
SIGINTHandler ()
	: m_graceful_quit (0)
{
	trace_with_mask("SIGINTHandler::SIGINTHandler", SIGHAND);
}

inline int
SIGINTHandler::
handle_signal (int signum_)
{
	trace_with_mask("SIGINTHandler::handle_signal", SIGHAND);

	if (signum_ == SIGINT) {
		m_graceful_quit = 1;
		return 0;
	}
	return -1;
}

inline sig_atomic_t
SIGINTHandler::
graceful_quit ()
{
	return m_graceful_quit;
}

inline void
SIGINTHandler::
resetState()
{
	trace_with_mask("SIGINTHandler::resetState", SIGHAND);

	m_graceful_quit = 0;
}

/** 
	Class SIGUSR1Handler.
	Handle SIGUSR1 signal.
*/

class SIGUSR1Handler : public EventHandler
{
public:
	/** Constructor 
	 */
	SIGUSR1Handler() : m_count(0) {
		trace_with_mask("SIGUSR1Handler::SIGUSR1Handler", SIGHAND);
	}
    
	/** Catch USR1 signal and increment count.
	 */
	int handle_signal(int signum_) {
		trace_with_mask("SIGUSR1Handler::handle_signal()", SIGHAND);
	    
		if (signum_ == SIGUSR1) { 
			m_count++; 
			DL((TRACE, "signal count = %d\n", m_count));
			return 0; 
		}
		return -1;
	}
    
	/** Report count of received signals.
	 */
	sig_atomic_t received_count() const { return m_count; }
    
	/** Set received signals count back to 0.
	 */
	void resetState() { m_count = 0; }

private:
	/// Received signals count
	sig_atomic_t m_count;
};


/** Class SIGUSR2Handler handles SIGUSR2 signal.
 */
class SIGUSR2Handler : public EventHandler
{
public:
	/** Constructor 
	 */
	SIGUSR2Handler() : m_count(0) {
		trace_with_mask("SIGUSR2Handler::SIGUSR2Handler", SIGHAND);
	}
    
	/** Catch USR2 signal and increment count.
	 */
	int handle_signal(int signum_) {
		trace_with_mask("SIGUSR2Handler::handle_signal()", SIGHAND);
	    
		if (signum_ == SIGUSR2) { 
			m_count++; 
			DL((TRACE, "signal count = %d\n", m_count));
			return 0; 
		}
		return -1;
	}
    
	/** Report count of received signals.
	 */
	sig_atomic_t received_count() const { return m_count; }
    
	/** Set received signals count back to 0.
	 */
	void resetState() { m_count = 0; }

private:
	/// Received signals count
	sig_atomic_t m_count;
};

/** Class SIGCHLDHandler handles SIGCHLD signal.
 */
class SIGCHLDHandler : public EventHandler
{
public:
	/// Constructor
	SIGCHLDHandler() : m_child_exit_flag(0) {
		trace_with_mask("SIGCHLDHandler::SIGCHLDHandler", SIGHAND);
	}

	/** Receive CHLD signal
	 */
	int handle_signal(int signum_) {
		trace_with_mask("SIGCHLDHandler::handle_signal", SIGHAND);

		if (signum_ == SIGCHLD && wait(NULL) != -1) { 
			m_child_exit_flag = 1;
			return 0;
		}
		return -1;
	}
	/** Did child exit?
	 */
	sig_atomic_t child_exited() { return m_child_exit_flag; }

	/** Reset child's exit state
	 */
	void resetState() { m_child_exit_flag = 0; }

private:
	/// Child exit's state
	sig_atomic_t m_child_exit_flag;
};

/** Class SIGALRMHandler handles SIGALRM signal.
 */
class SIGALRMHandler : public EventHandler
{
public:
	/// Constructor
	SIGALRMHandler() : m_alarm_flag(0) {
		trace_with_mask("SIGALRMHandler::SIGALRMHandler", SIGHAND);
	}

	/** Receive ALRM signal
	 */
	int handle_signal(int signum_) {
		trace_with_mask("SIGALRMHandler::handle_signal", SIGHAND);

		if (signum_ == SIGALRM) {
			m_alarm_flag = 1; // notice that we have seen alarm
			return 0;
		}
		return -1;
	}

	/// Has alarm gone off?
	sig_atomic_t alarmed () { return m_alarm_flag; }

	/// Reset internal state
	void resetState () { m_alarm_flag = 0; }

private:
	/// Indicator whether alarm gone off yet.
	sig_atomic_t m_alarm_flag;
};


/** Class SIGPOLLHandler handles SIGPOLL signal.

SIGPOLLHandler Implementations of dummy handler to *swallow* SIGPOLL caused
sometimes by select(3) being called on false socket file descriptor.

NOTE: FreeBSD uses SIGIO instead.
*/

class SIGPOLLHandler : public EventHandler
{
public:
	/** Constructor
	 */
	SIGPOLLHandler () {
		trace_with_mask("SIGPOLLHandler", SIGHAND);
	}
	/** Catch and absorb SIGPOLL signal.
	 */
	int handle_signal ( int signum_ ) { 
		trace_with_mask("SIGPOLLHandler::handle_signal", SIGHAND);
			
		return (signum_ == ASSAIOSIG) ? 0 : -1; 
	}
};

#endif // !defined(WIN32)

} // end namespace ASSA

#endif