OPTION(ENABLE_LUA "Enable lua support [default: OFF]" OFF) | OPTION(ENABLE_LUA "Enable lua support [default: OFF]" OFF) | ||||
OPTION(SKIP_RELINK_RPATH "Skip relinking and full RPATH for the install tree" OFF) | OPTION(SKIP_RELINK_RPATH "Skip relinking and full RPATH for the install tree" OFF) | ||||
OPTION(ENABLE_REDIRECTOR "Enable redirector install [default: OFF]" OFF) | OPTION(ENABLE_REDIRECTOR "Enable redirector install [default: OFF]" OFF) | ||||
OPTION(ENABLE_PROFILING "Enable profiling [default: OFF]" OFF) | |||||
# Build optimized code for following CPU (default i386) | # Build optimized code for following CPU (default i386) | ||||
#SET(CPU_TUNE "i686") | #SET(CPU_TUNE "i686") | ||||
MESSAGE(FATAL_ERROR "libevent is required for building rspamd") | MESSAGE(FATAL_ERROR "libevent is required for building rspamd") | ||||
ENDIF(NOT LIBEVENT_LIBRARY) | ENDIF(NOT LIBEVENT_LIBRARY) | ||||
IF(ENABLE_PROFILING MATCHES "ON") | |||||
SET(WITH_PROFILER 1) | |||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg") | |||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") | |||||
ENDIF(ENABLE_PROFILING MATCHES "ON") | |||||
FIND_PATH(LIBEVENT_INCLUDE event.h PATHS /opt/include | FIND_PATH(LIBEVENT_INCLUDE event.h PATHS /opt/include | ||||
/usr/include | /usr/include | ||||
/usr/local/include | /usr/local/include |
#cmakedefine WITH_LUA 1 | #cmakedefine WITH_LUA 1 | ||||
#cmakedefine WITH_PROFILER 1 | |||||
#define RVERSION "${RSPAMD_VERSION}" | #define RVERSION "${RSPAMD_VERSION}" | ||||
#define RSPAMD_MASTER_SITE_URL "${RSPAMD_MASTER_SITE_URL}" | #define RSPAMD_MASTER_SITE_URL "${RSPAMD_MASTER_SITE_URL}" | ||||
} | } | ||||
msg_info ("main: terminating..."); | msg_info ("main: terminating..."); | ||||
if (rspamd->cfg->bind_family == AF_UNIX) { | if (rspamd->cfg->bind_family == AF_UNIX) { | ||||
unlink (rspamd->cfg->bind_host); | unlink (rspamd->cfg->bind_host); | ||||
} | } |
switch (signo) { | switch (signo) { | ||||
case SIGINT: | case SIGINT: | ||||
case SIGTERM: | case SIGTERM: | ||||
#ifdef WITH_PROFILER | |||||
exit (0); | |||||
#else | |||||
_exit (1); | _exit (1); | ||||
#endif | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
{ | { | ||||
struct sigaction signals; | struct sigaction signals; | ||||
int i; | int i; | ||||
#ifdef WITH_PROFILER | |||||
extern void _start (void), etext (void); | |||||
monstartup ((u_long) &_start, (u_long) &etext); | |||||
#endif | |||||
#if 0 | |||||
/* Try to create temp directory for gmon.out and chdir to it */ | |||||
char prof_dir[PATH_MAX]; | |||||
snprintf (prof_dir, sizeof (prof_dir), "%s/rspamd-prof-%d", worker->srv->cfg->temp_dir, (int)getpid ()); | |||||
if (mkdir (prof_dir, S_IRUSR | S_IWUSR | S_IXUSR | S_IXOTH | S_IROTH | S_IXGRP | S_IRGRP) != -1) { | |||||
chdir (prof_dir); | |||||
} | |||||
#endif | |||||
worker->srv->pid = getpid (); | worker->srv->pid = getpid (); | ||||
worker->srv->type = TYPE_WORKER; | worker->srv->type = TYPE_WORKER; |