1 //--------------------------------------------------------------------------
2 // Copyright (C) 2014-2021 Cisco and/or its affiliates. All rights reserved.
3 //
4 // This program is free software; you can redistribute it and/or modify it
5 // under the terms of the GNU General Public License Version 2 as published
6 // by the Free Software Foundation.  You may not use, modify or distribute
7 // this program under any other version of the GNU General Public License.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License along
15 // with this program; if not, write to the Free Software Foundation, Inc.,
16 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 //--------------------------------------------------------------------------
18 
19 #ifndef PROCESS_H
20 #define PROCESS_H
21 
22 // process oriented services like signal handling, heap info, etc.
23 
24 enum PigSignal
25 {
26     PIG_SIG_NONE,
27     PIG_SIG_QUIT,
28     PIG_SIG_TERM,
29     PIG_SIG_INT,
30     PIG_SIG_RELOAD_CONFIG,
31     PIG_SIG_RELOAD_HOSTS,
32     PIG_SIG_DUMP_STATS,
33     PIG_SIG_ROTATE_STATS,
34     PIG_SIG_MAX
35 };
36 
37 PigSignal get_pending_signal();
38 const char* get_signal_name(PigSignal);
39 
40 void init_signals();
41 void term_signals();
42 void install_oops_handler();
43 void remove_oops_handler();
44 void help_signals();
45 
46 void daemonize();
47 void set_quick_exit(bool);
48 void set_main_thread();
49 
50 void trim_heap();
51 
52 #endif
53 
54