update it
This commit is contained in:
parent
0368486b0d
commit
d08911d23e
|
@ -21,7 +21,7 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir)/lib/core/include
|
||||
|
||||
AM_CFLAGS = \
|
||||
-Wall -Werror -Wno-unused -DSYSCONFDIR=\"$(sysconfdir)/\"
|
||||
-Wall -Werror -DSYSCONFDIR=\"$(sysconfdir)/\"
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
MOSTLYCLEANFILES = *.stackdump
|
||||
|
|
|
@ -66,47 +66,7 @@ error:
|
|||
return CORE_ERROR;
|
||||
}
|
||||
|
||||
status_t s6a_fd_hss_init()
|
||||
{
|
||||
status_t rv;
|
||||
int ret;
|
||||
|
||||
rv = s6a_fd_init(s6a_fd_hss_config());
|
||||
if (rv != CORE_OK)
|
||||
{
|
||||
d_error("s6a_fd_init() failed");
|
||||
return rv;
|
||||
}
|
||||
|
||||
CHECK_FCT_DO( fd_core_wait_shutdown_complete(), return CORE_ERROR; );
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
void s6a_fd_hss_final()
|
||||
{
|
||||
int ret;
|
||||
|
||||
s6a_app_final();
|
||||
|
||||
CHECK_FCT_DO( fd_core_shutdown(), d_error("fd_core_shutdown() failed") );
|
||||
}
|
||||
|
||||
status_t s6a_fd_mme_init()
|
||||
{
|
||||
status_t rv;
|
||||
|
||||
rv = s6a_fd_init(s6a_fd_mme_config());
|
||||
if (rv != CORE_OK)
|
||||
{
|
||||
d_error("s6a_fd_init() failed");
|
||||
return rv;
|
||||
}
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
void s6a_fd_mme_final()
|
||||
void s6a_fd_final()
|
||||
{
|
||||
s6a_app_final();
|
||||
|
||||
|
|
|
@ -27,14 +27,12 @@ struct s6a_fd_config_t {
|
|||
|
||||
extern struct s6a_fd_config_t *s6a_fd_config;
|
||||
|
||||
CORE_DECLARE(status_t) s6a_fd_hss_init();
|
||||
CORE_DECLARE(void) s6a_fd_hss_final();
|
||||
CORE_DECLARE(status_t) s6a_fd_mme_init();
|
||||
CORE_DECLARE(void) s6a_fd_mme_final();
|
||||
CORE_DECLARE(status_t) s6a_fd_init(const char *conffile);
|
||||
CORE_DECLARE(void) s6a_fd_final();
|
||||
|
||||
CORE_DECLARE(status_t) s6a_fd_config_apply();
|
||||
CORE_DECLARE(char *) s6a_fd_hss_config();
|
||||
CORE_DECLARE(char *) s6a_fd_mme_config();
|
||||
CORE_DECLARE(status_t) s6a_fd_config_apply();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
61
main.c
61
main.c
|
@ -55,8 +55,6 @@ static int check_signal(int signum)
|
|||
d_info("%s received",
|
||||
signum == SIGTERM ? "SIGTERM" : "SIGINT");
|
||||
|
||||
threads_stop();
|
||||
|
||||
return 1;
|
||||
}
|
||||
default:
|
||||
|
@ -82,19 +80,6 @@ void logger_signal(int signum)
|
|||
}
|
||||
}
|
||||
|
||||
void s6a_fd_hss_signal(int signum)
|
||||
{
|
||||
switch (signum)
|
||||
{
|
||||
case SIGTERM:
|
||||
case SIGINT:
|
||||
s6a_fd_hss_final();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int opt;
|
||||
|
@ -181,28 +166,6 @@ int main(int argc, char *argv[])
|
|||
/* Parent */
|
||||
}
|
||||
|
||||
{
|
||||
pid_t pid;
|
||||
pid = fork();
|
||||
|
||||
d_assert(pid != -1, return EXIT_FAILURE, "fork() failed");
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
/* Child */
|
||||
umask(027);
|
||||
|
||||
core_signal(SIGINT, s6a_fd_hss_signal);
|
||||
core_signal(SIGTERM, s6a_fd_hss_signal);
|
||||
|
||||
s6a_fd_hss_init();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* Parent */
|
||||
}
|
||||
|
||||
{
|
||||
extern int _mme_sm;
|
||||
extern int _enb_s1_sm;
|
||||
|
@ -215,6 +178,27 @@ int main(int argc, char *argv[])
|
|||
|
||||
signal_init();
|
||||
|
||||
{
|
||||
pid_t pid;
|
||||
pid = fork();
|
||||
|
||||
d_assert(pid != -1, return EXIT_FAILURE, "fork() failed");
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
/* Child */
|
||||
signal_init();
|
||||
|
||||
s6a_fd_init(s6a_fd_hss_config());
|
||||
signal_thread(check_signal);
|
||||
s6a_fd_final();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* Parent */
|
||||
}
|
||||
|
||||
if (cellwire_initialize(config_path) != CORE_OK)
|
||||
{
|
||||
d_fatal("CellWire initialization failed. Aborted");
|
||||
|
@ -225,13 +209,12 @@ int main(int argc, char *argv[])
|
|||
d_info("CellWire daemon start");
|
||||
|
||||
threads_start();
|
||||
|
||||
signal_thread(check_signal);
|
||||
|
||||
d_info("CellWire daemon terminating...");
|
||||
|
||||
threads_stop();
|
||||
cellwire_terminate();
|
||||
|
||||
core_terminate();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define TRACE_MODULE _init
|
||||
#include "core_debug.h"
|
||||
#include "core_thread.h"
|
||||
#include "core_signal.h"
|
||||
|
||||
#include "s6a_lib.h"
|
||||
|
||||
|
@ -26,15 +27,14 @@ status_t cellwire_initialize(char *config_path)
|
|||
rv = context_init();
|
||||
if (rv != CORE_OK) return rv;
|
||||
|
||||
rv = s6a_fd_mme_init();
|
||||
rv = s6a_fd_init(s6a_fd_mme_config());
|
||||
if (rv != CORE_OK) return rv;
|
||||
|
||||
return CORE_OK;
|
||||
}
|
||||
|
||||
void cellwire_terminate(void)
|
||||
{
|
||||
s6a_fd_mme_final();
|
||||
s6a_fd_final();
|
||||
|
||||
context_final();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue