update it
This commit is contained in:
parent
746d9c8871
commit
5557c9b948
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "core_debug.h"
|
#include "core_debug.h"
|
||||||
#include "core_lib.h"
|
#include "core_lib.h"
|
||||||
|
#include "core_signal.h"
|
||||||
|
|
||||||
#include "s6a_app.h"
|
#include "s6a_app.h"
|
||||||
#include "s6a_lib.h"
|
#include "s6a_lib.h"
|
||||||
|
@ -13,7 +14,9 @@
|
||||||
static void s6a_gnutls_log_func(int level, const char *str);
|
static void s6a_gnutls_log_func(int level, const char *str);
|
||||||
static void s6a_fd_logger(int printlevel, const char *format, va_list ap);
|
static void s6a_fd_logger(int printlevel, const char *format, va_list ap);
|
||||||
|
|
||||||
status_t s6a_fd_init(const char *conffile)
|
static int check_signal(int signum);
|
||||||
|
|
||||||
|
static status_t s6a_fd_init_internal(const char *conffile)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -66,6 +69,32 @@ error:
|
||||||
return CORE_ERROR;
|
return CORE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status_t s6a_fd_init()
|
||||||
|
{
|
||||||
|
status_t rv;
|
||||||
|
|
||||||
|
pid_t pid;
|
||||||
|
pid = fork();
|
||||||
|
|
||||||
|
d_assert(pid != -1, _exit(EXIT_FAILURE), "fork() failed");
|
||||||
|
|
||||||
|
if (pid == 0)
|
||||||
|
{
|
||||||
|
/* Child */
|
||||||
|
rv = s6a_fd_init_internal(s6a_fd_hss_config());
|
||||||
|
d_assert(rv == CORE_OK, _exit(EXIT_FAILURE), "s6a_fd_init() failed");
|
||||||
|
signal_thread(check_signal);
|
||||||
|
s6a_fd_final();
|
||||||
|
|
||||||
|
_exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Parent */
|
||||||
|
rv = s6a_fd_init_internal(s6a_fd_mme_config());
|
||||||
|
if (rv != CORE_OK) return rv;
|
||||||
|
return CORE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void s6a_fd_final()
|
void s6a_fd_final()
|
||||||
{
|
{
|
||||||
s6a_app_final();
|
s6a_app_final();
|
||||||
|
@ -120,3 +149,25 @@ static void s6a_fd_logger(int printlevel, const char *format, va_list ap)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int check_signal(int signum)
|
||||||
|
{
|
||||||
|
switch (signum)
|
||||||
|
{
|
||||||
|
case SIGTERM:
|
||||||
|
case SIGINT:
|
||||||
|
{
|
||||||
|
d_info("%s received",
|
||||||
|
signum == SIGTERM ? "SIGTERM" : "SIGINT");
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
d_error("Unknown Signal Number = %d\n", signum);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct s6a_fd_config_t {
|
||||||
|
|
||||||
extern struct s6a_fd_config_t *s6a_fd_config;
|
extern struct s6a_fd_config_t *s6a_fd_config;
|
||||||
|
|
||||||
CORE_DECLARE(status_t) s6a_fd_init(const char *conffile);
|
CORE_DECLARE(status_t) s6a_fd_init();
|
||||||
CORE_DECLARE(void) s6a_fd_final();
|
CORE_DECLARE(void) s6a_fd_final();
|
||||||
|
|
||||||
CORE_DECLARE(char *) s6a_fd_hss_config();
|
CORE_DECLARE(char *) s6a_fd_hss_config();
|
||||||
|
|
22
main.c
22
main.c
|
@ -154,6 +154,7 @@ int main(int argc, char *argv[])
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
{
|
{
|
||||||
/* Child */
|
/* Child */
|
||||||
|
setsid();
|
||||||
umask(027);
|
umask(027);
|
||||||
|
|
||||||
core_signal(SIGINT, logger_signal);
|
core_signal(SIGINT, logger_signal);
|
||||||
|
@ -166,27 +167,6 @@ int main(int argc, char *argv[])
|
||||||
/* Parent */
|
/* Parent */
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
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 */
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
extern int _mme_sm;
|
extern int _mme_sm;
|
||||||
extern int _enb_s1_sm;
|
extern int _enb_s1_sm;
|
||||||
|
|
|
@ -26,8 +26,9 @@ status_t cellwire_initialize(char *config_path)
|
||||||
rv = context_init();
|
rv = context_init();
|
||||||
if (rv != CORE_OK) return rv;
|
if (rv != CORE_OK) return rv;
|
||||||
|
|
||||||
rv = s6a_fd_init(s6a_fd_mme_config());
|
rv = s6a_fd_init();
|
||||||
if (rv != CORE_OK) return rv;
|
if (rv != CORE_OK) return rv;
|
||||||
|
|
||||||
return CORE_OK;
|
return CORE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue