clsync
Loading...
Searching...
No Matches
configuration.h
Go to the documentation of this file.
1#ifndef __CONFIGURATION_H
2#define __CONFIGURATION_H
3
4
5#ifndef BUFSIZ
6#define BUFSIZ (1<<16)
7#endif
8
9// don't do to much rules, it will degrade performance
10#define MAXRULES (1<<8)
11
12// there's no need in more than 256 arguments while running action-script, IMHO :)
13#define MAXARGUMENTS (1<<8)
14
15// clsync should be used, if there's more than 5-10 nodes. So the limit in 255 is quite enough. :)
16#define MAXNODES ((1<<8)-1)
17
18#define MAXSIGNALNUM (1<<9)
19
20// max user/group lengths
21#define USER_LEN (1<<8)
22#define GROUP_LEN USER_LEN
23
24// control socket listen backlog (man 2 listen)
25#define SOCKET_BACKLOG 2
26
27// control socket connections limit in clsync
28#define SOCKET_MAX_CLSYNC 8
29
30// control socket connections limit in libclsync
31#define SOCKET_MAX_LIBCLSYNC (1<<16)
32
33// children count limit
34#define MAXCHILDREN (1<<8)
35
36#define MAXMOUNTPOINTS (1<<8)
37#define MAXPERMITTEDHOOKFILES (1<<8)
38
39#ifndef PIC
40# ifdef __CLSYNC_COMMON_H
41# ifndef DEFAULT_NOTIFYENGINE
42# ifdef __linux__
43# ifdef INOTIFY_SUPPORT
44# define DEFAULT_NOTIFYENGINE NE_INOTIFY
45# endif
46# endif
47# endif
48# ifndef DEFAULT_NOTIFYENGINE
49# if __FreeBSD__ | __FreeBSD_kernel__
50# ifdef KQUEUE_SUPPORT
51# define DEFAULT_NOTIFYENGINE NE_KQUEUE
52# endif
53# endif
54# endif
55# ifndef DEFAULT_NOTIFYENGINE
56# ifdef INOTIFY_SUPPORT
57# define DEFAULT_NOTIFYENGINE NE_INOTIFY
58# endif
59# endif
60# ifndef DEFAULT_NOTIFYENGINE
61# ifdef GIO_SUPPORT
62# define DEFAULT_NOTIFYENGINE NE_GIO
63# endif
64# endif
65# ifndef DEFAULT_NOTIFYENGINE
66# ifdef KQUEUE_SUPPORT
67# define DEFAULT_NOTIFYENGINE NE_KQUEUE
68# endif
69# endif
70# ifndef DEFAULT_NOTIFYENGINE
71# ifdef BSM_SUPPORT
72# define DEFAULT_NOTIFYENGINE NE_BSM
73# endif
74# endif
75# ifndef DEFAULT_NOTIFYENGINE
76# error No monitor subsystem supported
77# define DEFAULT_NOTIFYENGINE NE_UNDEFINED
78# endif
79# endif
80#endif
81
82#define DEFAULT_RULES_PERM RA_ALL
83#define DEFAULT_COLLECTDELAY 30
84#define DEFAULT_SYNCDELAY (DEFAULT_COLLECTDELAY)
85#define DEFAULT_BFILETHRESHOLD (128 * 1024 * 1024)
86#define DEFAULT_BFILECOLLECTDELAY 1800
87#define DEFAULT_LABEL "nolabel"
88#define DEFAULT_RSYNCINCLUDELINESLIMIT 20000
89#define DEFAULT_SYNCTIMEOUT (3600 * 24)
90#define DEFAULT_CLUSTERTIMEOUT 1000
91#define DEFAULT_CLUSTERIPADDR "227.108.115.121"
92#define DEFAULT_CLUSTERIPPORT 40079
93#define DEFAULT_CLUSTERHDLMIN 1
94#define DEFAULT_CLUSTERHDLMAX 16
95#define DEFAULT_CLUSTERSDLMAX 32
96#define DEFAULT_CONFIG_BLOCK "default"
97#define DEFAULT_RETRIES 1
98#define DEFAULT_VERBOSE 3
99#define DEFAULT_DUMPDIR "/tmp/clsync-dump-%label%"
100#define DEFAULT_DETACH_IPC 1
101
102#define FANOTIFY_FLAGS (FAN_CLOEXEC|FAN_UNLIMITED_QUEUE|FAN_UNLIMITED_MARKS)
103#define FANOTIFY_EVFLAGS (O_LARGEFILE|O_RDONLY|O_CLOEXEC)
104
105#define FANOTIFY_MARKMASK (FAN_OPEN|FAN_MODIFY|FAN_CLOSE|FAN_ONDIR|FAN_EVENT_ON_CHILD)
106
107#define INOTIFY_FLAGS (IN_CLOEXEC)
108
109#define INOTIFY_MARKMASK (IN_ATTRIB|IN_CLOSE_WRITE|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_MOVED_FROM|IN_MOVED_TO|IN_MODIFY|IN_DONT_FOLLOW)
110
111#define COUNTER_LIMIT (1<<10)
112
113#define SLEEP_SECONDS 1
114
115#define KILL_TIMEOUT 60
116
117#define ALLOC_PORTION (1<<10) /* 1 KiX */
118#define CLUSTER_WINDOW_BUFSIZE_PORTION (1<<20) /* 1 MiB */
119#define CLUSTER_PACKET_MAXSIZE (1<<20) /* 1 MiB */
120#define CLUSTER_WINDOW_PCKTLIMIT (1<<20) /* 1 Ki packets */
121
122#define CONFIG_PATHS { ".clsync.conf", "/etc/clsync/clsync.conf", "/etc/clsync.conf", "/usr/local/etc/clsync/clsync.conf", "/usr/local/etc/clsync.conf", NULL } /* "~/.clsync.conf", "/etc/clsync/clsync.conf" ... */
123
124#define API_PREFIX "clsyncapi_"
125
126#define DUMP_DIRMODE 0750
127#define DUMP_FILEMODE 0644
128
129#define DEFAULT_CP_PATH "cp"
130#define DEFAULT_RSYNC_PATH "rsync"
131
132// size of event chain size to be processes at a time
133#define KQUEUE_EVENTLISTSIZE 256
134
135#define AUDITPIPE_PATH "/dev/auditpipe"
136#define AUDIT_CONTROL_PATH "/etc/security/audit_control"
137#define AUDIT_CONTROL_INITSCRIPT "/etc/rc.d/auditd"
138#define AUDIT_CONTROL_HEADER "#clsync\n"
139#define AUDIT_CONTROL_CONTENT "\n\
140dir:/var/audit\n\
141flags:fc,fd,fw,fm,cl\n\
142minfree:0\n\
143naflags:fc,fd,fw,fm,cl\n\
144policy:cnt\n\
145filesz:1M\n\
146expire-after:20M\n\
147"
148
149#define DTRACE_PATH "dtrace"
150
151#define PIVOT_AUTO_DIR "/dev/shm/clsync-rootfs"
152#define TMPDIR_PATH "/tmp"
153#define TMPDIR_TEMPLATE "/clsync-XXXXXX"
154
155#define SYSLOG_BUFSIZ (1<<16)
156#define SYSLOG_FLAGS (LOG_PID|LOG_CONS)
157#define SYSLOG_FACILITY LOG_DAEMON
158
159#define CLSYNCSOCK_WINDOW (1<<8)
160
161#define DEFAULT_SYNCHANDLER_ARGS_SIMPLE "sync %label% %EVENT-MASK% %INCLUDE-LIST%"
162#define DEFAULT_SYNCHANDLER_ARGS_DIRECT "%INCLUDE-LIST% %destination-dir%/"
163#define DEFAULT_SYNCHANDLER_ARGS_SHELL_NR "synclist %label% %INCLUDE-LIST-PATH%"
164#define DEFAULT_SYNCHANDLER_ARGS_SHELL_R "initialsync %label% %INCLUDE-LIST%"
165#define DEFAULT_SYNCHANDLER_ARGS_RDIRECT_E "-aH --delete --exclude-from %EXCLUDE-LIST-PATH% --include-from %INCLUDE-LIST-PATH% --exclude=* %watch-dir%/ %destination-dir%/"
166#define DEFAULT_SYNCHANDLER_ARGS_RDIRECT_I "-aH --delete --include-from %INCLUDE-LIST-PATH% --exclude=* %watch-dir%/ %destination-dir%/"
167#define DEFAULT_SYNCHANDLER_ARGS_RSHELL_E "rsynclist %label% %INCLUDE-LIST-PATH% %EXCLUDE-LIST-PATH%"
168#define DEFAULT_SYNCHANDLER_ARGS_RSHELL_I "rsynclist %label% %INCLUDE-LIST-PATH%"
169
170#define RSYNC_ARGS_E { \
171 "-aH", \
172 "--delete", \
173 "--exclude-from", \
174 "%EXCLUDE-LIST-PATH%", \
175 "--include-from", \
176 "%INCLUDE-LIST-PATH%", \
177 "--exclude=*", \
178 NULL }
179
180#define RSYNC_ARGS_I { \
181 "-aH", \
182 "--delete", \
183 "--include-from", \
184 "%INCLUDE-LIST-PATH%", \
185 "--exclude=*", \
186 NULL }
187
188#define DEFAULT_PRESERVE_CAPABILITIES ( CAP_TO_MASK(CAP_DAC_READ_SEARCH) | CAP_TO_MASK(CAP_SETUID) | CAP_TO_MASK(CAP_SETGID) | CAP_TO_MASK(CAP_KILL) )
189
190#define DEFAULT_USER "nobody"
191#define DEFAULT_GROUP "nogroup"
192#define DEFAULT_UID 65534
193#define DEFAULT_GID 65534
194#define DEFAULT_CAPS_INHERIT CI_EMPTY
195#define DEFAULT_PIVOT_MODE (PW_OFF)
196
197#define DEVZERO "/dev/zero"
198
199// How long to wait on highloaded locks before fallback to mutexes
200// See: doc/devel/thread-splitting/highload-locks/clsync-graph-comma.odc
201// But optimal value can be very different on different systems
202#define HL_LOCK_TRIES_INITIAL (1<<13)
203
204// Enable run-time auto-adjustment
205#define HL_LOCK_TRIES_AUTO
206// Iterations delay between adjustments (power of 2; 2^x)
207#define HL_LOCK_AUTO_INTERVAL 7 /* 128 */
208// Initial adjustment factor
209#define HL_LOCK_AUTO_K 1.1
210// Delay detection error threshold
211#define HL_LOCK_AUTO_THREADHOLD 0.2
212// Adjustment factor denominator
213#define HL_LOCK_AUTO_DECELERATION 1.1
214// Don't adjust if the factor is less than
215#define HL_LOCK_AUTO_K_FINISH 0.001
216// Upper limit
217#define HL_LOCK_AUTO_LIMIT_HIGH (1<<20)
218
219#define HL_LOCK_NONPRIV_TRIES (HL_LOCK_AUTO_LIMIT_HIGH << 5)
220
221//#define READWRITE_SIGNALLING
222
223#define CG_DEV_CONSOLE "c 5:1"
224#define CG_DEV_ZERO "c 1:5"
225#define CG_DEV_RANDOM "c 1:8"
226#define CG_DEV_URANDOM "c 1:9"
227#define CG_DEV_NULL "c 1:3"
228
229#define CG_ALLOWED_DEVICES { \
230 CG_DEV_CONSOLE " rw", \
231 CG_DEV_ZERO " r", \
232 CG_DEV_URANDOM " r", \
233 CG_DEV_RANDOM " r", \
234 CG_DEV_NULL " w", \
235 NULL \
236 }
237
238#define DEFAULT_CG_GROUPNAME "clsync/%PID%"
239
240// In nanoseconds
241#define OUTPUT_LOCK_TIMEOUT (100*1000*1000)
242#define WAITPID_TIMED_GRANULARITY (30*1000*1000)
243
244#define BSM_QUEUE_LENGTH_MAX (1024*1024)
245#define GIO_QUEUE_LENGTH_MAX BSM_QUEUE_LENGTH_MAX
246
247
248#endif