|
clsync
|
#include "common.h"#include "main.h"#include "error.h"#include "fileutils.h"#include "malloc.h"#include "cluster.h"#include "sync.h"#include "glibex.h"#include "control.h"#include "indexes.h"#include "privileged.h"#include "rules.h"#include <stdio.h>#include <dlfcn.h>
Go to the source code of this file.
Data Structures | |
| struct | trylocked_arg |
| struct | sync_dump_arg |
Macros | |
| #define | SEQID_WINDOW (((unsigned int)~0)>>1) |
| #define | SEQID_EQ(a, b) |
| #define | SEQID_GE(a, b) |
| #define | SEQID_LE(a, b) |
| #define | SEQID_GT(a, b) |
| #define | SEQID_LT(a, b) |
| #define | SHOULD_THREAD(ctx_p) |
| #define | SYNC_EXEC_ARGV(...) |
| #define | debug_argv_dump(level, argv) |
| #define | _sync_exec_getargv(argv, firstarg, COPYARG) |
| #define | SYNC_LOOP_IDLE |
| #define | SYNC_LOOP_CONTINUE_UNLOCK |
Enumerations | |
| enum | dump_dirfd_obj { DUMP_DIRFD_ROOT = 0 , DUMP_DIRFD_QUEUE , DUMP_DIRFD_THREAD , DUMP_DIRFD_MAX } |
| enum | dump_ltype { DUMP_LTYPE_INCLUDE , DUMP_LTYPE_EXCLUDE , DUMP_LTYPE_EVINFO } |
Functions | |
| static unsigned int | sync_seqid () |
| static void | setenv_iteration (uint32_t iteration_num) |
| static void | finish_iteration (ctx_t *ctx_p) |
| gpointer | eidup (gpointer ei_gp) |
| static void | evinfo_merge (ctx_t *ctx_p, eventinfo_t *evinfo_dst, eventinfo_t *evinfo_src) |
| static int | _exitcode_process (ctx_t *ctx_p, int exitcode) |
| int | exitcode_process (ctx_t *ctx_p, int exitcode) |
| threadsinfo_t * | thread_info () |
| int | exec_argv (char **argv, int *child_pid) |
| static void | so_call_sync_finished (int n, api_eventinfo_t *ei) |
| static int | so_call_sync (ctx_t *ctx_p, indexes_t *indexes_p, int n, api_eventinfo_t *ei) |
| static int | so_call_rsync_finished (ctx_t *ctx_p, const char *inclistfile, const char *exclistfile) |
| static int | so_call_rsync (ctx_t *ctx_p, indexes_t *indexes_p, const char *inclistfile, const char *exclistfile) |
| static void | argv_dump (int debug_level, char **argv) |
| char * | sync_path_rel2abs (ctx_t *ctx_p, const char *path_rel, ssize_t path_rel_len, size_t *path_abs_len_p, char *path_abs_oldptr) |
| char * | sync_path_abs2rel (ctx_t *ctx_p, const char *path_abs, ssize_t path_abs_len, size_t *path_rel_len_p, char *path_rel_oldptr) |
| pid_t | clsyncapi_fork (ctx_t *ctx_p) |
| clsync's wrapper for function "fork()". Should be used instead of "fork()" directly, to notify clsync about child's pid. | |
| int | sync_exec_argv (ctx_t *ctx_p, indexes_t *indexes_p, thread_callbackfunct_t callback, thread_callbackfunct_arg_t *callback_arg_p, char **argv) |
| static int | sync_queuesync (const char *fpath_rel, eventinfo_t *evinfo, ctx_t *ctx_p, indexes_t *indexes_p, queue_id_t queue_id) |
| static void | evinfo_initialevmask (ctx_t *ctx_p, eventinfo_t *evinfo_p, int isdir) |
| static void | api_evinfo_initialevmask (ctx_t *ctx_p, api_eventinfo_t *evinfo_p, int isdir) |
| int | sync_dosync (const char *fpath, uint32_t evmask, ctx_t *ctx_p, indexes_t *indexes_p) |
| int | sync_initialsync_walk (ctx_t *ctx_p, const char *dirpath, indexes_t *indexes_p, queue_id_t queue_id, initsync_t initsync) |
| const char * | sync_parameter_get (const char *variable_name, void *_dosync_arg_p) |
| static char ** | sync_customargv (ctx_t *ctx_p, struct dosync_arg *dosync_arg_p, synchandler_args_t *args_p) |
| static void | argv_free (char **argv) |
| static int | sync_initialsync_finish (ctx_t *ctx_p, initsync_t initsync, int ret) |
| int | sync_initialsync (const char *path, ctx_t *ctx_p, indexes_t *indexes_p, initsync_t initsync) |
| int | sync_notify_mark (ctx_t *ctx_p, const char *accpath, const char *path, size_t pathlen, indexes_t *indexes_p) |
| int | sync_mark_walk (ctx_t *ctx_p, const char *dirpath, indexes_t *indexes_p) |
| int | sync_notify_init (ctx_t *ctx_p) |
| static int | sync_dosync_exec (ctx_t *ctx_p, indexes_t *indexes_p, const char *evmask_str, const char *fpath) |
| int | fileischanged (ctx_t *ctx_p, indexes_t *indexes_p, const char *path_rel, stat64_t *lst_p, int is_deleted) |
| static int | sync_indexes_fpath2ei_addfixed (ctx_t *ctx_p, indexes_t *indexes_p, const char *fpath, eventinfo_t *evinfo) |
| int | sync_prequeue_loadmark (int monitored, ctx_t *ctx_p, indexes_t *indexes_p, const char *path_full, const char *path_rel, stat64_t *lst_p, eventobjtype_t objtype_old, eventobjtype_t objtype_new, uint32_t event_mask, int event_wd, mode_t st_mode, off_t st_size, char **path_buf_p, size_t *path_buf_len_p, eventinfo_t *evinfo) |
| void | _sync_idle_dosync_collectedexcludes (gpointer fpath_gp, gpointer flags_gp, gpointer arg_gp) |
| eventinfo_t * | ht_fpath_isincluded (GHashTable *ht, const char *const fpath) |
| int | _sync_islocked (threadinfo_t *threadinfo_p, void *_fpath) |
| static int | sync_islocked (const char *const fpath) |
| void | _sync_idle_dosync_collectedevents (gpointer fpath_gp, gpointer evinfo_gp, gpointer arg_gp) |
| gboolean | sync_trylocked (gpointer fpath_gp, gpointer evinfo_gp, gpointer arg_gp) |
| int | sync_idle_dosync_collectedevents_cleanup (ctx_t *ctx_p, thread_callbackfunct_arg_t *arg_p) |
| void | sync_queuesync_wrapper (gpointer fpath_gp, gpointer evinfo_gp, gpointer arg_gp) |
| int | sync_prequeue_unload (ctx_t *ctx_p, indexes_t *indexes_p) |
| int | sync_idle_dosync_collectedevents_aggrqueue (queue_id_t queue_id, ctx_t *ctx_p, indexes_t *indexes_p, struct dosync_arg *dosync_arg) |
| int | sync_idle_dosync_collectedevents_uniqfname (ctx_t *ctx_p, char *fpath, char *name) |
| int | sync_idle_dosync_collectedevents_listcreate (struct dosync_arg *dosync_arg_p, char *name) |
| void | rsync_escape_cleanup () |
| const char * | rsync_escape (const char *path) |
| static int | rsync_outline (FILE *outf, char *outline, eventinfo_flags_t flags) |
| gboolean | rsync_aggrout (gpointer outline_gp, gpointer flags_gp, gpointer arg_gp) |
| static int | rsync_listpush (indexes_t *indexes_p, const char *fpath, size_t fpath_len, eventinfo_flags_t flags, unsigned int *linescount_p) |
| gboolean | sync_idle_dosync_collectedevents_rsync_exclistpush (gpointer fpath_gp, gpointer flags_gp, gpointer arg_gp) |
| int | sync_idle_dosync_collectedevents_commitpart (struct dosync_arg *dosync_arg_p) |
| void | sync_inclist_rotate (ctx_t *ctx_p, struct dosync_arg *dosync_arg_p) |
| void | sync_idle_dosync_collectedevents_listpush (gpointer fpath_gp, gpointer evinfo_gp, gpointer arg_gp) |
| int | sync_idle_dosync_collectedevents (ctx_t *ctx_p, indexes_t *indexes_p) |
| int | apievinfo2rsynclist (indexes_t *indexes_p, FILE *listfile, int n, api_eventinfo_t *apievinfo) |
| Writes the list to list-file for "--include-from" option of rsync using array of api_eventinfo_t. | |
| int | sync_idle (ctx_t *ctx_p, indexes_t *indexes_p) |
| int | notify_wait (ctx_t *ctx_p, indexes_t *indexes_p) |
| void | hook_preexit (ctx_t *ctx_p) |
| int | sync_loop (ctx_t *ctx_p, indexes_t *indexes_p) |
| void | sync_sig_int (int signal) |
| int | sync_tryforcecycle (ctx_t *ctx_p, pthread_t pthread_parent) |
| int | sync_switch_state (ctx_t *ctx_p, pthread_t pthread_parent, int newstate) |
| void | sync_dump_liststep (gpointer fpath_gp, gpointer evinfo_gp, gpointer arg_gp) |
| int | sync_dump_thread (threadinfo_t *threadinfo_p, void *_arg) |
| int | sync_dump (ctx_t *ctx_p, const char *const dir_path) |
| void | sync_sigchld () |
| int | sync_sighandler (sighandler_arg_t *sighandler_arg_p) |
| int | sync_term (int exitcode) |
| __extension__ int | sync_run (ctx_t *ctx_p) |
Variables | |
| pthread_t | pthread_sighandler |
| static unsigned int | _sync_seqid_value = 0 |
| volatile state_t * | state_p = NULL |
| volatile int | exitcode = 0 |
| size_t | rsync_escape_result_size = 0 |
| char * | rsync_escape_result = NULL |
| int * | sync_sighandler_exitcode_p = NULL |
| #define _sync_exec_getargv | ( | argv, | |
| firstarg, | |||
| COPYARG ) |
| #define SEQID_GE | ( | a, | |
| b ) |
| #define SEQID_GT | ( | a, | |
| b ) |
| #define SEQID_LE | ( | a, | |
| b ) |
| #define SEQID_LT | ( | a, | |
| b ) |
| #define SHOULD_THREAD | ( | ctx_p | ) |
| #define SYNC_EXEC_ARGV | ( | ... | ) |
| #define SYNC_LOOP_CONTINUE_UNLOCK |
| #define SYNC_LOOP_IDLE |
| enum dump_dirfd_obj |
| enum dump_ltype |
|
inlinestatic |
| void _sync_idle_dosync_collectedevents | ( | gpointer | fpath_gp, |
| gpointer | evinfo_gp, | ||
| gpointer | arg_gp ) |
| void _sync_idle_dosync_collectedexcludes | ( | gpointer | fpath_gp, |
| gpointer | flags_gp, | ||
| gpointer | arg_gp ) |
| int _sync_islocked | ( | threadinfo_t * | threadinfo_p, |
| void * | _fpath ) |
|
inlinestatic |
| int apievinfo2rsynclist | ( | struct indexes * | indexes_p, |
| FILE * | listfile, | ||
| int | n, | ||
| api_eventinfo_t * | apievinfo ) |
Writes the list to list-file for "--include-from" option of rsync using array of api_eventinfo_t.
| [in] | indexes_p | Pointer to "indexes" |
| [in] | listfile | File identifier to write to |
| [in] | n | Number of records in apievinfo |
| [in] | apievinfo | Pointer to api_eventinfo_t records |
| zero | Successful |
| non-zero | If got error while deleting the message. The error-code is placed into returned value. |
Definition at line 3171 of file sync.c.

|
inlinestatic |
|
static |
| pid_t clsyncapi_fork | ( | struct ctx * | ctx_p | ) |
clsync's wrapper for function "fork()". Should be used instead of "fork()" directly, to notify clsync about child's pid.
| [in] | ctx_p | Pointer to "ctx" |
| -1 | If error (see "man 2 fork", added error code "ECANCELED" if too many children) |
| 0 | If child |
| pid | Pid of child of parent. (see "man 2 fork") |
| gpointer eidup | ( | gpointer | ei_gp | ) |
|
inlinestatic |
|
inlinestatic |
| int exec_argv | ( | char ** | argv, |
| int * | child_pid ) |
| int exitcode_process | ( | ctx_t * | ctx_p, |
| int | exitcode ) |
|
inlinestatic |
| void hook_preexit | ( | ctx_t * | ctx_p | ) |
| eventinfo_t * ht_fpath_isincluded | ( | GHashTable * | ht, |
| const char *const | fpath ) |
| gboolean rsync_aggrout | ( | gpointer | outline_gp, |
| gpointer | flags_gp, | ||
| gpointer | arg_gp ) |
| const char * rsync_escape | ( | const char * | path | ) |
| void rsync_escape_cleanup | ( | ) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
| int sync_dump | ( | ctx_t * | ctx_p, |
| const char *const | dir_path ) |
| void sync_dump_liststep | ( | gpointer | fpath_gp, |
| gpointer | evinfo_gp, | ||
| gpointer | arg_gp ) |
| int sync_dump_thread | ( | threadinfo_t * | threadinfo_p, |
| void * | _arg ) |
| int sync_exec_argv | ( | ctx_t * | ctx_p, |
| indexes_t * | indexes_p, | ||
| thread_callbackfunct_t | callback, | ||
| thread_callbackfunct_arg_t * | callback_arg_p, | ||
| char ** | argv ) |
| int sync_idle_dosync_collectedevents_aggrqueue | ( | queue_id_t | queue_id, |
| ctx_t * | ctx_p, | ||
| indexes_t * | indexes_p, | ||
| struct dosync_arg * | dosync_arg ) |
| int sync_idle_dosync_collectedevents_cleanup | ( | ctx_t * | ctx_p, |
| thread_callbackfunct_arg_t * | arg_p ) |
| int sync_idle_dosync_collectedevents_commitpart | ( | struct dosync_arg * | dosync_arg_p | ) |
| int sync_idle_dosync_collectedevents_listcreate | ( | struct dosync_arg * | dosync_arg_p, |
| char * | name ) |
| void sync_idle_dosync_collectedevents_listpush | ( | gpointer | fpath_gp, |
| gpointer | evinfo_gp, | ||
| gpointer | arg_gp ) |
| gboolean sync_idle_dosync_collectedevents_rsync_exclistpush | ( | gpointer | fpath_gp, |
| gpointer | flags_gp, | ||
| gpointer | arg_gp ) |
| int sync_idle_dosync_collectedevents_uniqfname | ( | ctx_t * | ctx_p, |
| char * | fpath, | ||
| char * | name ) |
| void sync_inclist_rotate | ( | ctx_t * | ctx_p, |
| struct dosync_arg * | dosync_arg_p ) |
|
inlinestatic |
| int sync_initialsync | ( | const char * | path, |
| ctx_t * | ctx_p, | ||
| indexes_t * | indexes_p, | ||
| initsync_t | initsync ) |
|
inlinestatic |
| int sync_initialsync_walk | ( | ctx_t * | ctx_p, |
| const char * | dirpath, | ||
| indexes_t * | indexes_p, | ||
| queue_id_t | queue_id, | ||
| initsync_t | initsync ) |
|
inlinestatic |
| int sync_notify_init | ( | ctx_t * | ctx_p | ) |
| const char * sync_parameter_get | ( | const char * | variable_name, |
| void * | _dosync_arg_p ) |
| char * sync_path_abs2rel | ( | ctx_t * | ctx_p, |
| const char * | path_abs, | ||
| ssize_t | path_abs_len, | ||
| size_t * | path_rel_len_p, | ||
| char * | path_rel_oldptr ) |
| char * sync_path_rel2abs | ( | ctx_t * | ctx_p, |
| const char * | path_rel, | ||
| ssize_t | path_rel_len, | ||
| size_t * | path_abs_len_p, | ||
| char * | path_abs_oldptr ) |
| int sync_prequeue_loadmark | ( | int | monitored, |
| ctx_t * | ctx_p, | ||
| indexes_t * | indexes_p, | ||
| const char * | path_full, | ||
| const char * | path_rel, | ||
| stat64_t * | lst_p, | ||
| eventobjtype_t | objtype_old, | ||
| eventobjtype_t | objtype_new, | ||
| uint32_t | event_mask, | ||
| int | event_wd, | ||
| mode_t | st_mode, | ||
| off_t | st_size, | ||
| char ** | path_buf_p, | ||
| size_t * | path_buf_len_p, | ||
| eventinfo_t * | evinfo ) |
|
static |
| void sync_queuesync_wrapper | ( | gpointer | fpath_gp, |
| gpointer | evinfo_gp, | ||
| gpointer | arg_gp ) |
| __extension__ int sync_run | ( | ctx_t * | ctx_p | ) |
|
inlinestatic |
| void sync_sig_int | ( | int | signal | ) |
| void sync_sigchld | ( | ) |
| int sync_sighandler | ( | sighandler_arg_t * | sighandler_arg_p | ) |
| int sync_switch_state | ( | ctx_t * | ctx_p, |
| pthread_t | pthread_parent, | ||
| int | newstate ) |
| int sync_term | ( | int | exitcode | ) |
| int sync_tryforcecycle | ( | ctx_t * | ctx_p, |
| pthread_t | pthread_parent ) |
| gboolean sync_trylocked | ( | gpointer | fpath_gp, |
| gpointer | evinfo_gp, | ||
| gpointer | arg_gp ) |
| threadsinfo_t * thread_info | ( | ) |