diff options
author | dimitri staessens <[email protected]> | 2017-10-07 11:19:25 +0000 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2017-10-07 11:19:25 +0000 |
commit | 51fee46f023ecc05918c3b40cbef90af705b0fe8 (patch) | |
tree | 2d6d040eef0dd6aa88c03a082e469c54a51531d5 | |
parent | 7dcacfbc94386e155650aaaa1a8f56cfb6fc53f9 (diff) | |
parent | ffdfca4bdf98b571d6a472b1501c3b696807f558 (diff) | |
download | ouroboros-51fee46f023ecc05918c3b40cbef90af705b0fe8.tar.gz ouroboros-51fee46f023ecc05918c3b40cbef90af705b0fe8.zip |
Merged in dstaesse/ouroboros/be-irmd-version (pull request #623)
irmd: Add option to print version
-rw-r--r-- | src/irmd/config.h.in | 39 | ||||
-rw-r--r-- | src/irmd/main.c | 25 |
2 files changed, 37 insertions, 27 deletions
diff --git a/src/irmd/config.h.in b/src/irmd/config.h.in index 37e450c0..5a5462c5 100644 --- a/src/irmd/config.h.in +++ b/src/irmd/config.h.in @@ -20,31 +20,34 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#define IPCP_SHIM_UDP_EXEC "@IPCP_SHIM_UDP_TARGET@" -#define IPCP_SHIM_ETH_LLC_EXEC "@IPCP_SHIM_ETH_LLC_TARGET@" -#define IPCP_NORMAL_EXEC "@IPCP_NORMAL_TARGET@" -#define IPCP_LOCAL_EXEC "@IPCP_LOCAL_TARGET@" +#define IPCP_SHIM_UDP_EXEC "@IPCP_SHIM_UDP_TARGET@" +#define IPCP_SHIM_ETH_LLC_EXEC "@IPCP_SHIM_ETH_LLC_TARGET@" +#define IPCP_NORMAL_EXEC "@IPCP_NORMAL_TARGET@" +#define IPCP_LOCAL_EXEC "@IPCP_LOCAL_TARGET@" -#define INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" +#define INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" -#define PTHREAD_COND_CLOCK @PTHREAD_COND_CLOCK@ +#define OUROBOROS_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@ +#define OUROBOROS_VERSION_MINOR @PACKAGE_VERSION_MINOR@ -#define SOCKET_TIMEOUT @SOCKET_TIMEOUT@ +#define PTHREAD_COND_CLOCK @PTHREAD_COND_CLOCK@ -#define IRMD_ACCEPT_TIMEOUT @IRMD_ACCEPT_TIMEOUT@ -#define IRMD_REQ_ARR_TIMEOUT @IRMD_REQ_ARR_TIMEOUT@ -#define IRMD_FLOW_TIMEOUT @IRMD_FLOW_TIMEOUT@ +#define SOCKET_TIMEOUT @SOCKET_TIMEOUT@ -#define BOOTSTRAP_TIMEOUT @BOOTSTRAP_TIMEOUT@ -#define ENROLL_TIMEOUT @ENROLL_TIMEOUT@ -#define REG_TIMEOUT @REG_TIMEOUT@ -#define QUERY_TIMEOUT @QUERY_TIMEOUT@ -#define CONNECT_TIMEOUT @CONNECT_TIMEOUT@ +#define IRMD_ACCEPT_TIMEOUT @IRMD_ACCEPT_TIMEOUT@ +#define IRMD_REQ_ARR_TIMEOUT @IRMD_REQ_ARR_TIMEOUT@ +#define IRMD_FLOW_TIMEOUT @IRMD_FLOW_TIMEOUT@ -#define SYS_MAX_FLOWS @SYS_MAX_FLOWS@ +#define BOOTSTRAP_TIMEOUT @BOOTSTRAP_TIMEOUT@ +#define ENROLL_TIMEOUT @ENROLL_TIMEOUT@ +#define REG_TIMEOUT @REG_TIMEOUT@ +#define QUERY_TIMEOUT @QUERY_TIMEOUT@ +#define CONNECT_TIMEOUT @CONNECT_TIMEOUT@ -#define IRMD_MIN_THREADS @IRMD_MIN_THREADS@ -#define IRMD_ADD_THREADS @IRMD_ADD_THREADS@ +#define SYS_MAX_FLOWS @SYS_MAX_FLOWS@ + +#define IRMD_MIN_THREADS @IRMD_MIN_THREADS@ +#define IRMD_ADD_THREADS @IRMD_ADD_THREADS@ #cmakedefine HAVE_FUSE #ifdef HAVE_FUSE diff --git a/src/irmd/main.c b/src/irmd/main.c index 84c55e93..99a34af2 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -2272,8 +2272,10 @@ static int irm_init(void) static void usage(void) { - log_err("Usage: irmd \n\n" - " [--stdout (Print to stdout instead of logs)]\n"); + printf("Usage: irmd \n" + " [--stdout (Log to stdout instead of system log)]\n" + " [--version (Print version number and exit)]\n" + "\n"); } int main(int argc, @@ -2289,11 +2291,6 @@ int main(int argc, sigaddset(&sigset, SIGHUP); sigaddset(&sigset, SIGPIPE); - if (geteuid() != 0) { - log_err("IPC Resource Manager must be run as root."); - exit(EXIT_FAILURE); - } - argc--; argv++; while (argc > 0) { @@ -2301,12 +2298,22 @@ int main(int argc, use_stdout = true; argc--; argv++; + } else if (strcmp(*argv, "--version") == 0) { + printf("Ouroboros version %d.%d\n", + OUROBOROS_VERSION_MAJOR, + OUROBOROS_VERSION_MINOR); + exit(EXIT_SUCCESS); } else { usage(); exit(EXIT_FAILURE); } } + if (geteuid() != 0) { + printf("IPC Resource Manager must be run as root.\n"); + exit(EXIT_FAILURE); + } + /* Init sig_act. */ memset(&sig_act, 0, sizeof sig_act); @@ -2369,10 +2376,10 @@ int main(int argc, pthread_sigmask(SIG_UNBLOCK, &sigset, NULL); - log_fini(); - log_info("Bye."); + log_fini(); + exit(EXIT_SUCCESS); fail_acceptor: |