From 1542738826dd0ed26cfc8f5e2e37ffe80f1b9676 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 29 Nov 2015 14:10:00 +0100 Subject: Rename to unitd, clean up CMakeLists.txt --- .gitignore | 14 +--------- CMakeLists.txt | 33 ++++++++++------------- askconsole.c | 5 ++-- cmake/FindJSON_C.cmake | 24 +++++++++++++++++ early.c | 8 +++--- log.h | 4 ++- procd.c | 70 ------------------------------------------------ procd.h | 51 ----------------------------------- service/instance.c | 8 +++--- service/instance.h | 9 +++---- service/service.c | 6 +++-- service/service.h | 9 +++---- signal.c | 12 +++++---- state.c | 22 ++++++++------- system.c | 16 ++++++----- ubus.c | 10 ++++--- unitd.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++ unitd.h | 50 +++++++++++++++++++++++++++++++++++ utils/askfirst.c | 4 ++- utils/utils.c | 4 ++- utils/utils.h | 9 +++---- watchdog.c | 6 +++-- watchdog.h | 9 +++---- 23 files changed, 240 insertions(+), 215 deletions(-) create mode 100644 cmake/FindJSON_C.cmake delete mode 100644 procd.c delete mode 100644 procd.h create mode 100644 unitd.c create mode 100644 unitd.h diff --git a/.gitignore b/.gitignore index 9d80a74..b25c15b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1 @@ -procd -askfirst -udevtrigger -init -.* -Makefile -CMakeCache.txt -CMakeFiles -utrace -ujail -*.so -*.cmake -install_manifest.txt +*~ diff --git a/CMakeLists.txt b/CMakeLists.txt index 26f7854..7d2443c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,29 +1,24 @@ cmake_minimum_required(VERSION 2.6) -PROJECT(procd C) -INCLUDE(GNUInstallDirs) -ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations) +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +project(unitd C) +include(GNUInstallDirs) -SET(SOURCES procd.c signal.c watchdog.c state.c askconsole.c ubus.c system.c early.c - service/service.c service/instance.c utils/utils.c) +find_package(JSON_C REQUIRED) -SET(LIBS ubox ubus json-c blobmsg_json) -IF(DEBUG) - ADD_DEFINITIONS(-DDEBUG -g3) -ENDIF() +add_executable(init unitd.c signal.c watchdog.c state.c askconsole.c ubus.c system.c early.c + service/service.c service/instance.c utils/utils.c) +set_property(TARGET init PROPERTY COMPILE_FLAGS "${JSON_C_CFLAGS_OTHER}") +set_property(TARGET init PROPERTY LINK_FLAGS "${JSON_C_LDFLAGS_OTHER}") +set_property(TARGET init PROPERTY INCLUDE_DIRECTORIES ${JSON_C_INCLUDE_DIR}) +target_link_libraries(init ubox ubus blobmsg_json ${JSON_C_LIBRARIES}) -ADD_EXECUTABLE(init ${SOURCES}) -TARGET_LINK_LIBRARIES(init ${LIBS}) -INSTALL(TARGETS init - RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR} -) +install(TARGETS init RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) -ADD_EXECUTABLE(askfirst utils/askfirst.c) -INSTALL(TARGETS askfirst - RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR} -) +add_executable(askfirst utils/askfirst.c) + +install(TARGETS askfirst RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}) diff --git a/askconsole.c b/askconsole.c index 703024e..eba4959 100644 --- a/askconsole.c +++ b/askconsole.c @@ -1,5 +1,4 @@ /* - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -11,7 +10,7 @@ * GNU General Public License for more details. */ -#include "procd.h" +#include "unitd.h" #include #include @@ -57,7 +56,7 @@ static void child_exit(struct uloop_process *proc, int ret) askconsole(proc); } -void procd_askconsole(void) { +void unitd_askconsole(void) { struct uloop_process *proc = malloc(sizeof(*proc)); proc->cb = child_exit; askconsole(proc); diff --git a/cmake/FindJSON_C.cmake b/cmake/FindJSON_C.cmake new file mode 100644 index 0000000..e31a8b9 --- /dev/null +++ b/cmake/FindJSON_C.cmake @@ -0,0 +1,24 @@ +# Defines the following variables: +# JSON_C_FOUND +# JSON_C_INCLUDE_DIR +# JSON_C_LIBRARIES +# JSON_C_CFLAGS_OTHER +# JSON_C_LDFLAGS_OTHER + + +if(ANDROID) + find_host_package(PkgConfig REQUIRED QUIET) +else(ANDROID) + find_package(PkgConfig REQUIRED QUIET) +endif(ANDROID) + +pkg_check_modules(_JSON_C json-c) + +find_path(JSON_C_INCLUDE_DIR NAMES json-c/json.h HINTS ${_JSON_C_INCLUDE_DIRS}) +find_library(JSON_C_LIBRARIES NAMES json-c HINTS ${_JSON_C_LIBRARY_DIRS}) + +set(JSON_C_CFLAGS_OTHER "${_JSON_C_CFLAGS_OTHER}" CACHE STRING "Additional compiler flags for json-c") +set(JSON_C_LDFLAGS_OTHER "${_JSON_C_LDFLAGS_OTHER}" CACHE STRING "Additional linker flags for json-c") + +find_package_handle_standard_args(JSON_C REQUIRED_VARS JSON_C_LIBRARIES JSON_C_INCLUDE_DIR) +mark_as_advanced(JSON_C_INCLUDE_DIR JSON_C_LIBRARIES JSON_C_CFLAGS_OTHER JSON_C_LDFLAGS_OTHER) diff --git a/early.c b/early.c index c2c366b..cc5a17c 100644 --- a/early.c +++ b/early.c @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -22,7 +24,7 @@ #include #include -#include "procd.h" +#include "unitd.h" static void early_console(const char *dev) @@ -83,7 +85,7 @@ early_env(void) } void -procd_early(void) +unitd_early(void) { early_mounts(); early_console("/dev/console"); diff --git a/log.h b/log.h index c8c3929..3ad6a8c 100644 --- a/log.h +++ b/log.h @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 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 - * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer - * - * 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 -#include -#include -#include - -#include -#include -#include - -#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 \tPath to ubus socket\n" - "\t-d \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; -} diff --git a/procd.h b/procd.h deleted file mode 100644 index b68cba8..0000000 --- a/procd.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2013 Felix Fietkau - * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer - * - * 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. - */ - -#ifndef __PROCD_H -#define __PROCD_H - -#include -#include -#include - -#include -#include - -#include "log.h" - -#define __init __attribute__((constructor)) - -extern char *ubus_socket; -extern int upgrade_running; - -void procd_early(void); - -void procd_connect_ubus(void); -void procd_reconnect_ubus(int reconnect); -void ubus_init_service(struct ubus_context *ctx); -void ubus_init_system(struct ubus_context *ctx); - -void procd_state_next(void); -void procd_state_ubus_connect(void); -void procd_shutdown(int event); -void procd_early(void); -void procd_preinit(void); -void procd_coldplug(void); -void procd_signal(void); -void procd_signal_preinit(void); -void procd_askconsole(void); -void procd_bcast_event(char *event, struct blob_attr *msg); - -#endif diff --git a/service/instance.c b/service/instance.c index 7c902f9..3641369 100644 --- a/service/instance.c +++ b/service/instance.c @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -29,7 +31,7 @@ #include -#include "../procd.h" +#include "../unitd.h" #include "service.h" #include "instance.h" @@ -308,7 +310,7 @@ instance_stdio(struct ustream *s, int prio, struct service_instance *in) ustream_consume(s, len); } while (1); - ulog_open(ULOG_SYSLOG, LOG_DAEMON, "procd"); + ulog_open(ULOG_SYSLOG, LOG_DAEMON, "unitd"); } static void diff --git a/service/instance.h b/service/instance.h index 4970dca..22f4ae5 100644 --- a/service/instance.h +++ b/service/instance.h @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -13,8 +15,7 @@ * GNU General Public License for more details. */ -#ifndef __PROCD_INSTANCE_H -#define __PROCD_INSTANCE_H +#pragma once #include #include @@ -76,5 +77,3 @@ bool instance_update(struct service_instance *in, struct service_instance *in_ne void instance_init(struct service_instance *in, struct service *s, struct blob_attr *config); void instance_free(struct service_instance *in); void instance_dump(struct blob_buf *b, struct service_instance *in, int debug); - -#endif diff --git a/service/service.c b/service/service.c index 8d5dd95..a57d470 100644 --- a/service/service.c +++ b/service/service.c @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -16,7 +18,7 @@ #include #include -#include "../procd.h" +#include "../unitd.h" #include "service.h" #include "instance.h" diff --git a/service/service.h b/service/service.h index e346058..2b6071c 100644 --- a/service/service.h +++ b/service/service.h @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -13,8 +15,7 @@ * GNU General Public License for more details. */ -#ifndef __PROCD_SERVICE_H -#define __PROCD_SERVICE_H +#pragma once #include #include @@ -39,5 +40,3 @@ struct service { int service_start_early(char *name, char *cmdline); void service_init(void); void service_event(const char *type, const char *service, const char *instance); - -#endif diff --git a/signal.c b/signal.c index 60b8f82..9d5b3fc 100644 --- a/signal.c +++ b/signal.c @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -18,7 +20,7 @@ #include -#include "procd.h" +#include "unitd.h" static void do_reboot(void) { @@ -51,7 +53,7 @@ static void signal_shutdown(int signal, siginfo_t *siginfo, void *data) DEBUG(1, "Triggering %s\n", msg); if (event) - procd_shutdown(event); + unitd_shutdown(event); } struct sigaction sa_shutdown = { @@ -61,7 +63,7 @@ struct sigaction sa_shutdown = { static void signal_crash(int signal, siginfo_t *siginfo, void *data) { - ERROR("Rebooting as procd has crashed\n"); + ERROR("Rebooting as unitd has crashed\n"); do_reboot(); } @@ -80,7 +82,7 @@ struct sigaction sa_dummy = { .sa_flags = SA_SIGINFO }; -void procd_signal(void) +void unitd_signal(void) { signal(SIGPIPE, SIG_IGN); if (getpid() != 1) diff --git a/state.c b/state.c index 4455d2f..a16ec36 100644 --- a/state.c +++ b/state.c @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -21,7 +23,7 @@ #include #include -#include "procd.h" +#include "unitd.h" #include "syslog.h" #include "watchdog.h" #include "service/service.h" @@ -98,18 +100,18 @@ static void state_enter(void) case STATE_EARLY: watchdog_init(0); LOG("- early -\n"); - procd_early(); - procd_connect_ubus(); + unitd_early(); + unitd_connect_ubus(); service_init(); service_start_early("ubus", ubus_cmd); break; case STATE_RUNNING: LOG("- init -\n"); - procd_askconsole(); + unitd_askconsole(); // switch to syslog log channel - ulog_open(ULOG_SYSLOG, LOG_DAEMON, "procd"); + ulog_open(ULOG_SYSLOG, LOG_DAEMON, "unitd"); LOG("- init complete -\n"); break; @@ -155,20 +157,20 @@ static void state_enter(void) }; } -void procd_state_next(void) +void unitd_state_next(void) { DEBUG(4, "Change state %d -> %d\n", state, state + 1); state++; state_enter(); } -void procd_state_ubus_connect(void) +void unitd_state_ubus_connect(void) { if (state == STATE_EARLY) - procd_state_next(); + unitd_state_next(); } -void procd_shutdown(int event) +void unitd_shutdown(int event) { if (state >= STATE_SHUTDOWN) return; diff --git a/system.c b/system.c index 5f0b9bb..786312f 100644 --- a/system.c +++ b/system.c @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -25,7 +27,7 @@ #include -#include "procd.h" +#include "unitd.h" #include "watchdog.h" static struct blob_buf b; @@ -338,7 +340,7 @@ static const struct blobmsg_policy nand_policy[__NAND_MAX] = { }; static void -procd_spawn_upgraded(char *path) +unitd_spawn_upgraded(char *path) { char *wdt_fd = watchdog_fd(); char *argv[] = { "/tmp/upgraded", NULL, NULL}; @@ -366,13 +368,13 @@ static int nand_set(struct ubus_context *ctx, struct ubus_object *obj, if (!tb[NAND_PATH]) return UBUS_STATUS_INVALID_ARGUMENT; - procd_spawn_upgraded(blobmsg_get_string(tb[NAND_PATH])); + unitd_spawn_upgraded(blobmsg_get_string(tb[NAND_PATH])); fprintf(stderr, "Yikees, something went wrong. no /sbin/upgraded ?\n"); return 0; } static void -procd_subscribe_cb(struct ubus_context *ctx, struct ubus_object *obj) +unitd_subscribe_cb(struct ubus_context *ctx, struct ubus_object *obj) { notify = obj->has_subscribers; } @@ -397,11 +399,11 @@ static struct ubus_object system_object = { .type = &system_object_type, .methods = system_methods, .n_methods = ARRAY_SIZE(system_methods), - .subscribe_cb = procd_subscribe_cb, + .subscribe_cb = unitd_subscribe_cb, }; void -procd_bcast_event(char *event, struct blob_attr *msg) +unitd_bcast_event(char *event, struct blob_attr *msg) { int ret; diff --git a/ubus.c b/ubus.c index 6f15055..f1cb51f 100644 --- a/ubus.c +++ b/ubus.c @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -18,7 +20,7 @@ #include #include -#include "procd.h" +#include "unitd.h" char *ubus_socket = NULL; static struct ubus_context *ctx; @@ -57,11 +59,11 @@ ubus_connect_cb(struct uloop_timeout *timeout) DEBUG(2, "Connected to ubus, id=%08x\n", ctx->local_id); ubus_add_uloop(ctx); - procd_state_ubus_connect(); + unitd_state_ubus_connect(); } void -procd_connect_ubus(void) +unitd_connect_ubus(void) { ubus_timer.cb = ubus_connect_cb; uloop_timeout_set(&ubus_timer, 1000); diff --git a/unitd.c b/unitd.c new file mode 100644 index 0000000..19cfbed --- /dev/null +++ b/unitd.c @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: + * Copyright (C) 2013 Felix Fietkau + * Copyright (C) 2013 John Crispin + * + * 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 +#include +#include +#include + +#include +#include +#include + +#include "unitd.h" +#include "watchdog.h" + +unsigned int debug = 4; + +static int usage(const char *prog) +{ + ERROR("Usage: %s [options]\n" + "Options:\n" + "\t-s \tPath to ubus socket\n" + "\t-d \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, "unitd"); + + 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(); + unitd_signal(); + unitd_state_next(); + uloop_run(); + uloop_done(); + + return 0; +} diff --git a/unitd.h b/unitd.h new file mode 100644 index 0000000..a4550e5 --- /dev/null +++ b/unitd.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: + * Copyright (C) 2013 Felix Fietkau + * Copyright (C) 2013 John Crispin + * + * 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. + */ + +#pragma once + +#include +#include +#include + +#include +#include + +#include "log.h" + +#define __init __attribute__((constructor)) + +extern char *ubus_socket; +extern int upgrade_running; + +void unitd_early(void); + +void unitd_connect_ubus(void); +void unitd_reconnect_ubus(int reconnect); +void ubus_init_service(struct ubus_context *ctx); +void ubus_init_system(struct ubus_context *ctx); + +void unitd_state_next(void); +void unitd_state_ubus_connect(void); +void unitd_shutdown(int event); +void unitd_early(void); +void unitd_preinit(void); +void unitd_coldplug(void); +void unitd_signal(void); +void unitd_signal_preinit(void); +void unitd_askconsole(void); +void unitd_bcast_event(char *event, struct blob_attr *msg); diff --git a/utils/askfirst.c b/utils/askfirst.c index cdd2883..cdb5074 100644 --- a/utils/askfirst.c +++ b/utils/askfirst.c @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 diff --git a/utils/utils.c b/utils/utils.c index 8dbbbd2..1f7d604 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 diff --git a/utils/utils.h b/utils/utils.h index c371678..6ab19ed 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -13,8 +15,7 @@ * GNU General Public License for more details. */ -#ifndef __PROCD_UTILS_H -#define __PROCD_UTILS_H +#pragma once #include #include @@ -53,5 +54,3 @@ void blobmsg_list_free(struct blobmsg_list *list); bool blobmsg_list_equal(struct blobmsg_list *l1, struct blobmsg_list *l2); void blobmsg_list_move(struct blobmsg_list *list, struct blobmsg_list *src); char* get_cmdline_val(const char* name, char* out, int len); - -#endif diff --git a/watchdog.c b/watchdog.c index 0eae9c8..04f682e 100644 --- a/watchdog.c +++ b/watchdog.c @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -24,7 +26,7 @@ #include -#include "procd.h" +#include "unitd.h" #include "watchdog.h" #define WDT_PATH "/dev/watchdog" diff --git a/watchdog.h b/watchdog.h index 8d64895..6c4bc6a 100644 --- a/watchdog.h +++ b/watchdog.h @@ -1,7 +1,9 @@ /* + * Copyright (C) 2015 Matthias Schiffer + * + * Based on "procd" by: * Copyright (C) 2013 Felix Fietkau * Copyright (C) 2013 John Crispin - * Copyright (C) 2015 Matthias Schiffer * * 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 @@ -13,8 +15,7 @@ * GNU General Public License for more details. */ -#ifndef __PROCD_WATCHDOG_H -#define __PROCD_WATCHDOG_H +#pragma once void watchdog_init(int preinit); char* watchdog_fd(void); @@ -24,5 +25,3 @@ void watchdog_set_stopped(bool val); bool watchdog_get_stopped(void); void watchdog_no_cloexec(void); void watchdog_ping(void); - -#endif -- cgit v1.2.3