2012-02-15 19:10:50 +00:00
|
|
|
/**
|
2018-03-13 11:02:34 +00:00
|
|
|
* lsyncd.h Live (Mirror) Syncing Demon
|
|
|
|
*
|
|
|
|
* Interface between the core modules.
|
|
|
|
*
|
|
|
|
* License: GPLv2 (see COPYING) or any later version
|
|
|
|
* Authors: Axel Kittenberger <axkibe@gmail.com>
|
|
|
|
*
|
|
|
|
*/
|
2010-11-22 14:54:50 +00:00
|
|
|
#ifndef LSYNCD_H
|
|
|
|
#define LSYNCD_H
|
|
|
|
|
2012-02-15 19:10:50 +00:00
|
|
|
// some older machines need this to see pselect
|
2018-02-27 09:09:28 +00:00
|
|
|
#define _DEFAULT_SOURCE 1
|
2011-08-16 14:25:30 +00:00
|
|
|
#define _XOPEN_SOURCE 700
|
|
|
|
#define _DARWIN_C_SOURCE 1
|
2011-07-19 13:29:19 +00:00
|
|
|
|
2012-09-25 15:29:12 +00:00
|
|
|
#define LUA_COMPAT_ALL
|
2016-11-24 14:44:08 +00:00
|
|
|
#define LUA_COMPAT_5_1
|
2012-09-25 15:29:12 +00:00
|
|
|
|
2012-02-15 19:10:50 +00:00
|
|
|
// includes needed for headerfile
|
2010-11-22 14:54:50 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2010-11-22 21:06:02 +00:00
|
|
|
#include <signal.h>
|
|
|
|
#include <stdbool.h>
|
2010-11-22 14:54:50 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#define LUA_USE_APICHECK 1
|
|
|
|
#include <lua.h>
|
|
|
|
|
2018-03-13 11:02:34 +00:00
|
|
|
#define LSYNCD_CORE_LIBNAME "core"
|
2018-03-13 11:29:43 +00:00
|
|
|
#define LSYNCD_INOTIFY_LIBNAME "inotify"
|
2012-10-02 00:56:29 +00:00
|
|
|
|
2016-11-24 14:44:08 +00:00
|
|
|
/*
|
|
|
|
| Workaround to register a library for different lua versions.
|
|
|
|
*/
|
|
|
|
#if LUA_VERSION_NUM > 502
|
|
|
|
#define lua_compat_register( L, name, lib ) \
|
|
|
|
{ \
|
|
|
|
lua_newtable((L)); \
|
|
|
|
luaL_setfuncs((L), (lib), 0); \
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define lua_compat_register( L, name, lib ) \
|
|
|
|
{luaL_register( (L), (name), (lib) );}
|
|
|
|
#endif
|
|
|
|
|
2018-03-13 11:02:34 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Lsyncd runtime configuration
|
|
|
|
*/
|
2010-11-22 21:06:02 +00:00
|
|
|
extern struct settings {
|
2012-02-15 19:10:50 +00:00
|
|
|
char * log_file; // If not NULL Lsyncd logs into this file.
|
|
|
|
bool log_syslog; // If true Lsyncd sends log messages to syslog
|
|
|
|
char * log_ident; // If not NULL the syslog identity (otherwise "Lsyncd")
|
|
|
|
int log_facility; // The syslog facility
|
|
|
|
int log_level; // -1 logs everything, 0 normal mode, LOG_ERROR errors only.
|
2010-11-22 21:06:02 +00:00
|
|
|
} settings;
|
|
|
|
|
2018-03-13 11:02:34 +00:00
|
|
|
|
2018-03-30 07:36:26 +00:00
|
|
|
// Pushes a runner function and the runner error handler onto Lua stack
|
2018-03-15 08:27:14 +00:00
|
|
|
extern void load_mci(lua_State *L, const char *name);
|
2010-11-22 21:06:02 +00:00
|
|
|
|
2012-02-15 19:10:50 +00:00
|
|
|
// set to 1 on hup signal or term signal
|
2010-11-22 21:06:02 +00:00
|
|
|
extern volatile sig_atomic_t hup;
|
|
|
|
extern volatile sig_atomic_t term;
|
|
|
|
|
2018-03-13 11:02:34 +00:00
|
|
|
|
2010-11-22 14:54:50 +00:00
|
|
|
#endif
|