/usr/include/wibble/sys/signal.test.h is in libwibble-dev 1.1-1.
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 | /* -*- C++ -*- (c) 2009 Enrico Zini <enrico@enricozini.org> */
#include <wibble/sys/signal.h>
#include <set>
#include <cstdlib>
#include <unistd.h>
#include <wibble/test.h>
using namespace std;
using namespace wibble::sys;
static int counter;
static void test_signal_action(int signum)
{
++counter;
}
struct TestSignal {
Test sigAction() {
#ifdef POSIX
struct sigaction a;
a.sa_handler = test_signal_action;
sigemptyset(&a.sa_mask);
a.sa_flags = 0;
counter = 0;
sig::Action act(SIGUSR1, a);
kill(getpid(), SIGUSR1);
assert_eq(counter, 1);
#endif
}
Test sigProcMask() {
#ifdef POSIX
sigset_t blocked;
struct sigaction a;
a.sa_handler = test_signal_action;
sigemptyset(&a.sa_mask);
a.sa_flags = 0;
sigemptyset(&blocked);
sigaddset(&blocked, SIGUSR1);
counter = 0;
sig::Action act(SIGUSR1, a);
{
sig::ProcMask mask(blocked);
kill(getpid(), SIGUSR1);
assert_eq(counter, 0);
}
assert_eq(counter, 1);
#endif
}
};
// vim:set ts=4 sw=4:
|