clsync
Loading...
Searching...
No Matches
main.h
Go to the documentation of this file.
1/*
2 clsync - file tree sync utility based on fanotify and inotify
3
4 Copyright (C) 2013 Dmitry Yu Okunev <dyokunev@ut.mephi.ru> 0x8E30679C
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20extern int ncpus;
21extern pid_t parent_pid;
22extern int argc;
23extern char *argv[];
24
25extern int main_rehash ( ctx_t *ctx_p );
26extern int main_status_update ( ctx_t *ctx_p );
27extern int ctx_set ( ctx_t *ctx_p, const char *const parameter_name, const char *const parameter_value );
28extern int config_block_parse ( ctx_t *ctx_p, const char *const config_block_name );
29extern int rules_count ( ctx_t *ctx_p );
30/* Parameter exception flags */
31#define PEF_NONE 0
32#define PEF_UNEXPECTED_END 1
33#define PEF_UNSET_VARIABLE 2
34#define PEF_LAZY_SUBSTITUTION 4
35extern char *parameter_expand (
36 ctx_t *ctx_p,
37 char *arg,
38 int exceptionflags,
39 int *macros_count_p,
40 int *expand_count_p,
41 const char * ( *parameter_get ) ( const char *variable_name, void *arg ),
42 void *parameter_get_arg
43);
44extern pid_t fork_helper();
45extern int parent_isalive();
46extern int sethandler_sigchld ( void ( *handler ) () );
47extern pid_t waitpid_timed ( pid_t child_pid, int *status_p, long sec, long nsec );
48
49#define exit_on(cond) { debug(30, "exit_on: checking: %s", TOSTR(cond)); if (unlikely(cond)) { debug(1, "Exiting due to: "TOSTR(cond)); exit(0); } }
50
const char * parameter_get(const char *variable_name, void *_ctx_p)
Gets raw (string) an option value by an option name.
Definition main.c:565
pid_t fork_helper()
Definition main.c:463
char * parameter_expand(ctx_t *ctx_p, char *arg, int exceptionflags, int *macros_count_p, int *expand_count_p, const char *(*parameter_get)(const char *variable_name, void *arg), void *parameter_get_arg)
Expands option values, e. g. "/var/log/clsync-%label%.pid" -> "/var/log/clsync-clone....
Definition main.c:693
int ctx_set(ctx_t *ctx_p, const char *const parameter_name, const char *const parameter_value)
Definition main.c:2560
int ncpus
Definition main.c:385
int config_block_parse(ctx_t *ctx_p, const char *const config_block_name)
Definition main.c:2547
pid_t parent_pid
Definition main.c:386
int rules_count(ctx_t *ctx_p)
int parent_isalive()
Definition main.c:415
pid_t waitpid_timed(pid_t child_pid, int *status_p, long sec, long nsec)
Definition main.c:388
char * argv[]
Definition main.c:2725
int argc
Definition main.c:2724
int main_status_update(ctx_t *ctx_p)
Definition main.c:2673
int main_rehash(ctx_t *ctx_p)
Definition main.c:2653
int sethandler_sigchld(void(*handler)())
Definition main.c:440
ctx_t * ctx_p
Definition mon_kqueue.c:85
Definition ctx.h:315