Merged changes on `processes.c', `collectd.c' and `collectd.h' from quota-branch...
[collectd.git] / src / collectd.h
1 #ifndef COLLECTD_H
2 #define COLLECTD_H
3
4 #if HAVE_CONFIG_H
5 # include <config.h>
6 #endif
7
8 #include <stdio.h>
9 #if HAVE_SYS_TYPES_H
10 # include <sys/types.h>
11 #endif
12 #if HAVE_SYS_STAT_H
13 # include <sys/stat.h>
14 #endif
15 #if STDC_HEADERS
16 #include <stdlib.h>
17 #include <stddef.h>
18 #else
19 # if HAVE_STDLIB_H
20 #  include <stdlib.h>
21 # endif
22 #endif
23 #if HAVE_STRING_H
24 # if !STDC_HEADERS && HAVE_MEMORY_H
25 #  include <memory.h>
26 # endif
27 # include <string.h>
28 #endif
29 #if HAVE_STRINGS_H
30 # include <strings.h>
31 #endif
32 #if HAVE_INTTYPES_H
33 # include <inttypes.h>
34 #endif
35 #if HAVE_STDINT_H
36 # include <stdint.h>
37 #endif
38 #if HAVE_UNISTD_H
39 # include <unistd.h>
40 #endif
41 #if HAVE_SYS_WAIT_H
42 # include <sys/wait.h>
43 #endif
44 #ifndef WEXITSTATUS
45 # define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
46 #endif
47 #ifndef WIFEXITED
48 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
49 #endif
50 #if HAVE_SIGNAL_H
51 # include <signal.h>
52 #endif
53 #if HAVE_FCNTL_H
54 # include <fcntl.h>
55 #endif
56 #if HAVE_ERRNO_H
57 # include <errno.h>
58 #endif
59 #if HAVE_SYSLOG_H
60 # include <syslog.h>
61 #endif
62 #if HAVE_LIMITS_H
63 # include <limits.h>
64 #endif
65 #if TIME_WITH_SYS_TIME
66 # include <sys/time.h>
67 # include <time.h>
68 #else
69 # if HAVE_SYS_TIME_H
70 #  include <sys/time.h>
71 # else
72 #  include <time.h>
73 # endif
74 #endif
75
76 #if HAVE_DIRENT_H
77 # include <dirent.h>
78 # define NAMLEN(dirent) strlen((dirent)->d_name)
79 #else
80 # define dirent direct
81 # define NAMLEN(dirent) (dirent)->d_namlen
82 # if HAVE_SYS_NDIR_H
83 #  include <sys/ndir.h>
84 # endif
85 # if HAVE_SYS_DIR_H
86 #  include <sys/dir.h>
87 # endif
88 # if HAVE_NDIR_H
89 #  include <ndir.h>
90 # endif
91 #endif
92
93 #if HAVE_STDARG_H
94 # include <stdarg.h>
95 #endif
96 #if HAVE_CTYPE_H
97 # include <ctype.h>
98 #endif
99
100 #ifndef HAVE_RRD_H
101 #undef HAVE_LIBRRD
102 #endif
103
104 #ifdef HAVE_LIBRRD
105 #include <rrd.h>
106 #endif /* HAVE_LIBRRD */
107
108 /* Won't work without the header file */
109 #ifndef HAVE_KSTAT_H
110 #undef HAVE_LIBKSTAT
111 #endif
112
113 #ifdef HAVE_LIBKSTAT
114 #include <kstat.h>
115 #include <sys/param.h>
116 #endif /* HAVE_LIBKSTAT */
117
118 /* Won't work without the header file */
119 #ifndef HAVE_STATGRAB_H
120 #undef HAVE_LIBSTATGRAB
121 #endif
122
123 #ifdef HAVE_LIBSTATGRAB
124 #include <statgrab.h>
125 #endif
126
127 #ifndef LOCALSTATEDIR
128 #define LOCALSTATEDIR "/opt/collectd/var"
129 #endif
130
131 #ifndef DATADIR
132 #define DATADIR LOCALSTATEDIR"/lib/collectd"
133 #endif
134
135 #ifndef PLUGINDIR
136 #define PLUGINDIR "/opt/collectd/lib/collectd"
137 #endif
138
139 #ifndef PIDFILE
140 #define PIDFILE LOCALSTATEDIR"/run/collectd.pid"
141 #endif
142
143 #define MODE_SERVER 0x01
144 #define MODE_CLIENT 0x02
145 #define MODE_LOCAL  0x03
146
147 extern time_t curtime;
148 extern int operating_mode;
149
150 #endif /* COLLECTD_H */