1 /*-
2  * Copyright (c) 1999-2003 Andrey Simonenko
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  *   @(#)$Id: ipa_main.h,v 1.2 2011/01/23 18:42:34 simon Exp $
27  */
28 
29 #ifndef IPA_MAIN_H
30 #define IPA_MAIN_H
31 
32 #include <signal.h>
33 
34 #define IPA_NAME	"ipa"
35 
36 #ifdef WITH_PTHREAD
37 extern int	Sigprocmask(int, const sigset_t *, sigset_t *);
38 # define SIGPROCMASK_NAME "pthread_sigmask"
39 # define MEMTYPE_FLAGS	IPA_MEMFUNC_FLAG_PTHREAD
40 #else
41 # define Sigprocmask sigprocmask
42 # define SIGPROCMASK_NAME "sigprocmask"
43 # define MEMTYPE_FLAGS	0
44 #endif /* WITH_PTHREAD */
45 
46 #define MARRAY_NAME(x)	IPA_NAME ":" #x
47 #define MZONE_NAME(x)	IPA_NAME ":" #x
48 #define MTYPE_NAME(x)	IPA_NAME ":m_" #x
49 
50 #define MEMFLAG_OPTIMIZE IPA_MEMFUNC_FLAG_OPTIMIZE
51 
52 extern ipa_mem_type *m_anon;
53 extern ipa_mem_type *m_tmp;
54 
55 extern unsigned int main_check_sec;
56 
57 extern const uint64_t uint64_zero;
58 extern const uint64_t uint64_max;
59 
60 extern sigset_t	sigmask;
61 extern sigset_t	zeromask;
62 
63 extern int	ipa_main(void);
64 
65 extern int	init_all(void);
66 extern int	deinit_all(void);
67 extern int	free_all(void);
68 
69 extern void	sig_chld(int);
70 extern void	sig_hup(int);
71 extern void	sig_term(int);
72 
73 extern int	stdout_read;
74 extern int	stderr_read;
75 
76 extern int	fd_set_nonblock(int);
77 
78 extern char	debug;
79 
80 extern uid_t	myuid;
81 extern gid_t	mygid;
82 
83 extern volatile sig_atomic_t need_check_flag;
84 
85 extern char	dump_flag;
86 extern char	freeze_flag;
87 
88 #if defined(WITH_THRESHOLDS) || defined(WITH_SUBLIMITS)
89 extern uint64_t	uint64_per_cent(const uint64_t *, unsigned int);
90 #endif
91 
92 #endif /* !IPA_MAIN_H */
93