Blame view

configuration.h 7.24 KB
redmine authored
1 2
#ifndef __CONFIGURATION_H
#define __CONFIGURATION_H
redmine authored
3 4 5


#ifndef BUFSIZ
redmine authored
6
#define BUFSIZ				(1<<16)
redmine authored
7 8
#endif

redmine authored
9
// don't do to much rules, it will degrade performance
redmine authored
10
#define MAXRULES			(1<<8)
redmine authored
11 12

// there's no need in more than 256 arguments while running action-script, IMHO :)
redmine authored
13
#define MAXARGUMENTS			(1<<8)
redmine authored
14 15 16

// clsync should be used, if there's more than 5-10 nodes. So the limit in 255 is quite enough. :)
#define MAXNODES			((1<<8)-1)
redmine authored
17

redmine authored
18 19
#define MAXSIGNALNUM			(1<<9)

redmine authored
20 21 22 23 24 25 26
// max user/group lengths
#define USER_LEN			(1<<8)
#define GROUP_LEN			USER_LEN

// control socket listen backlog (man 2 listen)
#define SOCKET_BACKLOG			2

redmine authored
27 28 29 30 31
// control socket connections limit in clsync
#define SOCKET_MAX_CLSYNC		8

// control socket connections limit in libclsync
#define SOCKET_MAX_LIBCLSYNC		(1<<16)
redmine authored
32

redmine authored
33
// children count limit
redmine authored
34 35
#define MAXCHILDREN			(1<<8)

redmine authored
36
#define MAXMOUNTPOINTS			(1<<8)
redmine authored
37
#define MAXPERMITTEDHOOKFILES		(1<<8)
redmine authored
38

redmine authored
39 40 41 42 43 44 45 46 47 48
#ifndef PIC
#	ifdef __CLSYNC_COMMON_H
#		ifndef DEFAULT_NOTIFYENGINE
#			ifdef __linux__
#				ifdef INOTIFY_SUPPORT
#					define DEFAULT_NOTIFYENGINE	NE_INOTIFY
#				endif
#			endif
#		endif
#		ifndef DEFAULT_NOTIFYENGINE
redmine authored
49
#			if __FreeBSD__ | __FreeBSD_kernel__
redmine authored
50 51 52 53 54 55
#				ifdef KQUEUE_SUPPORT
#					define DEFAULT_NOTIFYENGINE	NE_KQUEUE
#				endif
#			endif
#		endif
#		ifndef DEFAULT_NOTIFYENGINE
redmine authored
56 57 58 59
#			ifdef INOTIFY_SUPPORT
#				define DEFAULT_NOTIFYENGINE	NE_INOTIFY
#			endif
#		endif
redmine authored
60 61 62 63 64 65
#		ifndef DEFAULT_NOTIFYENGINE
#			ifdef GIO_SUPPORT
#				define DEFAULT_NOTIFYENGINE	NE_GIO
#			endif
#		endif
#		ifndef DEFAULT_NOTIFYENGINE
redmine authored
66 67 68 69
#			ifdef KQUEUE_SUPPORT
#				define DEFAULT_NOTIFYENGINE	NE_KQUEUE
#			endif
#		endif
redmine authored
70 71 72 73
#		ifndef DEFAULT_NOTIFYENGINE
#			ifdef BSM_SUPPORT
#				define DEFAULT_NOTIFYENGINE	NE_BSM
#			endif
redmine authored
74
#		endif
redmine authored
75 76 77
#		ifndef DEFAULT_NOTIFYENGINE
#			error No monitor subsystem supported
#			define  DEFAULT_NOTIFYENGINE		NE_UNDEFINED
redmine authored
78 79
#		endif
#	endif
redmine authored
80
#endif
redmine authored
81

redmine authored
82
#define DEFAULT_RULES_PERM		RA_ALL
redmine authored
83
#define DEFAULT_COLLECTDELAY		30
redmine authored
84
#define DEFAULT_SYNCDELAY		(DEFAULT_COLLECTDELAY)
redmine authored
85 86 87
#define DEFAULT_BFILETHRESHOLD		(128 * 1024 * 1024)
#define DEFAULT_BFILECOLLECTDELAY	1800
#define DEFAULT_LABEL			"nolabel"
redmine authored
88
#define DEFAULT_RSYNCINCLUDELINESLIMIT	20000
redmine authored
89
#define DEFAULT_SYNCTIMEOUT		(3600 * 24)
redmine authored
90
#define DEFAULT_CLUSTERTIMEOUT		1000
redmine authored
91 92
#define DEFAULT_CLUSTERIPADDR		"227.108.115.121"
#define DEFAULT_CLUSTERIPPORT		40079
redmine authored
93 94 95
#define DEFAULT_CLUSTERHDLMIN		1
#define DEFAULT_CLUSTERHDLMAX		16
#define DEFAULT_CLUSTERSDLMAX		32
redmine authored
96
#define DEFAULT_CONFIG_BLOCK		"default"
redmine authored
97
#define DEFAULT_RETRIES			1
redmine authored
98
#define DEFAULT_VERBOSE			3
redmine authored
99
#define DEFAULT_DUMPDIR			"/tmp/clsync-dump-%label%"
redmine authored
100
#define DEFAULT_DETACH_IPC		1
redmine authored
101

redmine authored
102 103
#define FANOTIFY_FLAGS			(FAN_CLOEXEC|FAN_UNLIMITED_QUEUE|FAN_UNLIMITED_MARKS)
#define FANOTIFY_EVFLAGS		(O_LARGEFILE|O_RDONLY|O_CLOEXEC)
redmine authored
104

redmine authored
105
#define FANOTIFY_MARKMASK		(FAN_OPEN|FAN_MODIFY|FAN_CLOSE|FAN_ONDIR|FAN_EVENT_ON_CHILD)
redmine authored
106

redmine authored
107
#define INOTIFY_FLAGS			(IN_CLOEXEC)
redmine authored
108

redmine authored
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)
redmine authored
110

redmine authored
111
#define COUNTER_LIMIT			(1<<10)
redmine authored
112

redmine authored
113
#define SLEEP_SECONDS			1
redmine authored
114 115 116

#define KILL_TIMEOUT			60

redmine authored
117 118
#define ALLOC_PORTION			(1<<10) /* 1  KiX */
#define CLUSTER_WINDOW_BUFSIZE_PORTION	(1<<20) /* 1  MiB */
redmine authored
119
#define CLUSTER_PACKET_MAXSIZE		(1<<20) /* 1  MiB */
redmine authored
120
#define CLUSTER_WINDOW_PCKTLIMIT	(1<<20) /* 1  Ki packets */
redmine authored
121

redmine authored
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" ... */
redmine authored
123

redmine authored
124
#define API_PREFIX			"clsyncapi_"
redmine authored
125

redmine authored
126
#define DUMP_DIRMODE			0750
redmine authored
127
#define DUMP_FILEMODE			0644
redmine authored
128

redmine authored
129 130 131
#define DEFAULT_CP_PATH			"cp"
#define	DEFAULT_RSYNC_PATH		"rsync"

redmine authored
132 133 134
// size of event chain size to be processes at a time
#define KQUEUE_EVENTLISTSIZE		256

redmine authored
135
#define AUDITPIPE_PATH "/dev/auditpipe"
redmine authored
136 137
#define AUDIT_CONTROL_PATH "/etc/security/audit_control"
#define AUDIT_CONTROL_INITSCRIPT "/etc/rc.d/auditd"
redmine authored
138
#define AUDIT_CONTROL_HEADER "#clsync\n"
redmine authored
139 140
#define AUDIT_CONTROL_CONTENT "\n\
dir:/var/audit\n\
redmine authored
141
flags:fc,fd,fw,fm,cl\n\
redmine authored
142
minfree:0\n\
redmine authored
143
naflags:fc,fd,fw,fm,cl\n\
redmine authored
144 145
policy:cnt\n\
filesz:1M\n\
redmine authored
146
expire-after:20M\n\
redmine authored
147 148
"

redmine authored
149 150
#define DTRACE_PATH			"dtrace"

redmine authored
151
#define PIVOT_AUTO_DIR			"/dev/shm/clsync-rootfs"
redmine authored
152
#define	TMPDIR_TEMPLATE			"/tmp/clsync-XXXXXX"
redmine authored
153

redmine authored
154
#define SYSLOG_BUFSIZ			(1<<16)
redmine authored
155 156
#define SYSLOG_FLAGS			(LOG_PID|LOG_CONS)
#define SYSLOG_FACILITY			LOG_DAEMON
redmine authored
157

redmine authored
158 159
#define CLSYNCSOCK_WINDOW		(1<<8)

redmine authored
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
#define DEFAULT_SYNCHANDLER_ARGS_SIMPLE		"sync \%label\% \%EVENT-MASK\% \%INCLUDE-LIST\%"
#define DEFAULT_SYNCHANDLER_ARGS_DIRECT		"\%INCLUDE-LIST\% \%destination-dir\%/"
#define DEFAULT_SYNCHANDLER_ARGS_SHELL_NR	"synclist \%label\% \%INCLUDE-LIST-PATH\%"
#define DEFAULT_SYNCHANDLER_ARGS_SHELL_R	"initialsync \%label\% \%INCLUDE-LIST\%"
#define DEFAULT_SYNCHANDLER_ARGS_RDIRECT_E	"-aH --delete --exclude-from \%EXCLUDE-LIST-PATH\% --include-from \%INCLUDE-LIST-PATH\% --exclude=* \%watch-dir\%/ \%destination-dir\%/"
#define DEFAULT_SYNCHANDLER_ARGS_RDIRECT_I	"-aH --delete --include-from \%INCLUDE-LIST-PATH\% --exclude=* \%watch-dir\%/ \%destination-dir\%/"
#define DEFAULT_SYNCHANDLER_ARGS_RSHELL_E	"rsynclist \%label% \%INCLUDE-LIST-PATH\% %EXCLUDE-LIST-PATH%"
#define DEFAULT_SYNCHANDLER_ARGS_RSHELL_I	"rsynclist \%label% \%INCLUDE-LIST-PATH\%"

#define RSYNC_ARGS_E	{ 		\
		"-aH", 			\
		"--delete", 		\
		"--exclude-from",	\
		"\%EXCLUDE-LIST-PATH\%",\
		"--include-from",	\
		"\%INCLUDE-LIST-PATH\%",\
		"--exclude=*",		\
		NULL }

#define RSYNC_ARGS_I	{ 		\
		"-aH", 			\
		"--delete", 		\
		"--include-from",	\
		"\%INCLUDE-LIST-PATH\%",\
		"--exclude=*",		\
		NULL }

redmine authored
187
#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) )
redmine authored
188

redmine authored
189 190 191 192 193
#define DEFAULT_USER			"nobody"
#define DEFAULT_GROUP			"nogroup"
#define DEFAULT_UID			65534
#define DEFAULT_GID			65534
#define DEFAULT_CAPS_INHERIT		CI_EMPTY
redmine authored
194
#define DEFAULT_PIVOT_MODE		(PW_OFF)
redmine authored
195

redmine authored
196 197
#define DEVZERO				"/dev/zero"

redmine authored
198 199
// How long to wait on highloaded locks before fallback to mutexes
// See: doc/devel/thread-splitting/highload-locks/clsync-graph-comma.odc
redmine authored
200
// But optimal value can be very different on different systems
redmine authored
201
#define HL_LOCK_TRIES_INITIAL		(1<<13)
redmine authored
202 203

// Enable run-time auto-adjustment
redmine authored
204
#define HL_LOCK_TRIES_AUTO
redmine authored
205
// Iterations delay between adjustments (power of 2; 2^x)
redmine authored
206
#define HL_LOCK_AUTO_INTERVAL		7	/* 128 */
redmine authored
207 208 209 210 211 212 213
// Initial adjustment factor
#define HL_LOCK_AUTO_K			1.1
// Delay detection error threshold
#define HL_LOCK_AUTO_THREADHOLD		0.2
// Adjustment factor denominator
#define HL_LOCK_AUTO_DECELERATION	1.1
// Don't adjust if the factor is less than
redmine authored
214
#define HL_LOCK_AUTO_K_FINISH		0.001
redmine authored
215 216
// Upper limit
#define HL_LOCK_AUTO_LIMIT_HIGH		(1<<20)
redmine authored
217

redmine authored
218
#define HL_LOCK_NONPRIV_TRIES		(HL_LOCK_AUTO_LIMIT_HIGH << 8)
redmine authored
219

redmine authored
220 221
//#define READWRITE_SIGNALLING

redmine authored
222 223 224 225 226 227 228 229 230 231 232 233 234 235
#define CG_DEV_CONSOLE	"c 5:1"
#define CG_DEV_ZERO	"c 1:5"
#define CG_DEV_RANDOM	"c 1:8"
#define CG_DEV_URANDOM	"c 1:9"
#define CG_DEV_NULL	"c 1:3"

#define CG_ALLOWED_DEVICES {		\
		CG_DEV_CONSOLE	" rw",	\
		CG_DEV_ZERO	" r",	\
		CG_DEV_URANDOM	" r",	\
		CG_DEV_RANDOM	" r",	\
		CG_DEV_NULL	" w",	\
		NULL			\
	}
redmine authored
236 237

#define DEFAULT_CG_GROUPNAME	"clsync/%PID%"
redmine authored
238

redmine authored
239 240
// In nanoseconds
#define OUTPUT_LOCK_TIMEOUT		(100*1000*1000)
redmine authored
241
#define WAITPID_TIMED_GRANULARITY	 (30*1000*1000)
redmine authored
242 243

#define BSM_QUEUE_LENGTH_MAX		(1024*1024)
redmine authored
244
#define GIO_QUEUE_LENGTH_MAX		BSM_QUEUE_LENGTH_MAX
redmine authored
245

redmine authored
246

redmine authored
247
#endif