diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-11-29 14:10:00 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-11-30 09:53:47 +0100 |
commit | 1542738826dd0ed26cfc8f5e2e37ffe80f1b9676 (patch) | |
tree | 7eb7a6bfdb7f4217449741942253c2115e6ad5d7 /procd.c | |
parent | 501c6d70a6a7357652e2a4fb1ad5856d90bde29b (diff) | |
download | unitd-1542738826dd0ed26cfc8f5e2e37ffe80f1b9676.tar unitd-1542738826dd0ed26cfc8f5e2e37ffe80f1b9676.zip |
Rename to unitd, clean up CMakeLists.txt
Diffstat (limited to 'procd.c')
-rw-r--r-- | procd.c | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/procd.c b/procd.c deleted file mode 100644 index a9dde95..0000000 --- a/procd.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org> - * Copyright (C) 2013 John Crispin <blogic@openwrt.org> - * Copyright (C) 2015 Matthias Schiffer <mschiffer@universe-factory.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1 - * as published by the Free Software Foundation - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include <sys/wait.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/reboot.h> - -#include <unistd.h> -#include <getopt.h> -#include <libgen.h> - -#include "procd.h" -#include "watchdog.h" - -unsigned int debug = 4; - -static int usage(const char *prog) -{ - ERROR("Usage: %s [options]\n" - "Options:\n" - "\t-s <path>\tPath to ubus socket\n" - "\t-d <level>\tEnable debug messages\n" - "\n", prog); - return 1; -} - -int main(int argc, char **argv) -{ - int ch; - if (getpid() != 1) { - fprintf(stderr, "error: must run as PID 1\n"); - return 1; - } - - ulog_open(ULOG_KMSG, LOG_DAEMON, "procd"); - - while ((ch = getopt(argc, argv, "d:s:")) != -1) { - switch (ch) { - case 's': - ubus_socket = optarg; - break; - case 'd': - debug = atoi(optarg); - break; - default: - return usage(argv[0]); - } - } - setsid(); - uloop_init(); - procd_signal(); - procd_state_next(); - uloop_run(); - uloop_done(); - - return 0; -} |