From 33f9b577149c1cf91e231d74d4be3df52438f8ab Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sat, 31 Oct 2015 00:08:58 +0100 Subject: [PATCH] occtl: move ctl.h in occtl/ and fixed args.def to include version.inc --- src/Makefile.am | 2 +- src/config.c | 2 +- src/main-ctl.h | 12 +----------- src/main.h | 10 ++++++++++ src/occtl/args.def | 2 +- src/{ => occtl}/ctl.h | 0 6 files changed, 14 insertions(+), 14 deletions(-) rename src/{ => occtl}/ctl.h (100%) diff --git a/src/Makefile.am b/src/Makefile.am index b1d3a49b..44156769 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -74,7 +74,7 @@ ocserv_SOURCES = main.c main-auth.c worker-vpn.c worker-auth.c tlslib.c \ sec-mod-sup-config.c sec-mod-sup-config.h \ sup-config/file.c sup-config/file.h main-sec-mod-cmd.c \ sup-config/radius.c sup-config/radius.h \ - worker-bandwidth.c worker-bandwidth.h ctl.h main-ctl.h \ + worker-bandwidth.c worker-bandwidth.h main-ctl.h \ vasprintf.c vasprintf.h worker-proxyproto.c \ proc-search.c proc-search.h http-heads.h ip-util.c ip-util.h \ main-ban.c main-ban.h common-config.h base64-helper.c base64-helper.h \ diff --git a/src/config.c b/src/config.c index fff5a86b..f327f3cf 100644 --- a/src/config.c +++ b/src/config.c @@ -50,8 +50,8 @@ #include #include #include -#include #include +#include #include "common-config.h" #define OLD_DEFAULT_CFG_FILE "/etc/ocserv.conf" diff --git a/src/main-ctl.h b/src/main-ctl.h index 65d6d1af..7297dd24 100644 --- a/src/main-ctl.h +++ b/src/main-ctl.h @@ -1,7 +1,7 @@ #ifndef MAIN_CTL_HANDLER_H # define MAIN_CTL_HANDLER_H -#include +#include int ctl_handler_init(main_server_st* s); void ctl_handler_deinit(main_server_st* s); @@ -9,14 +9,4 @@ void ctl_handler_deinit(main_server_st* s); int ctl_handler_set_fds(main_server_st* s, fd_set *rd_set, fd_set *wr_set); void ctl_handler_run_pending(main_server_st* s, fd_set *rd_set, fd_set *wr_set); -inline static void terminate_proc(main_server_st *s, proc_st *proc) -{ - /* if it has an IP, send a signal so that we cleanup - * and get stats properly */ - if (proc->pid != -1 && proc->pid != 0) - kill(proc->pid, SIGTERM); - else - remove_proc(s, proc, RPROC_KILL); -} - #endif diff --git a/src/main.h b/src/main.h index 9542c40c..9b98dbbb 100644 --- a/src/main.h +++ b/src/main.h @@ -281,6 +281,16 @@ struct proc_st *new_proc(main_server_st * s, pid_t pid, int cmd_fd, void remove_proc(main_server_st* s, struct proc_st *proc, unsigned flags); void proc_to_zombie(main_server_st* s, struct proc_st *proc); +inline static void terminate_proc(main_server_st *s, proc_st *proc) +{ + /* if it has an IP, send a signal so that we cleanup + * and get stats properly */ + if (proc->pid != -1 && proc->pid != 0) + kill(proc->pid, SIGTERM); + else + remove_proc(s, proc, RPROC_KILL); +} + void put_into_cgroup(main_server_st * s, const char* cgroup, pid_t pid); inline static diff --git a/src/occtl/args.def b/src/occtl/args.def index 626b9c2f..4fdf5746 100644 --- a/src/occtl/args.def +++ b/src/occtl/args.def @@ -10,7 +10,7 @@ long-opts; no-misuse-usage; short-usage = "Usage: occtl [options] [command]\nocctl --help for usage instructions.\n"; explain = ""; -#include version.inc +#include ../version.inc detail = "Openconnect VPN server control (occtl) is a tool to control the ocserv VPN server."; diff --git a/src/ctl.h b/src/occtl/ctl.h similarity index 100% rename from src/ctl.h rename to src/occtl/ctl.h