summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-11-29 14:10:00 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-11-30 09:53:47 +0100
commit1542738826dd0ed26cfc8f5e2e37ffe80f1b9676 (patch)
tree7eb7a6bfdb7f4217449741942253c2115e6ad5d7
parent501c6d70a6a7357652e2a4fb1ad5856d90bde29b (diff)
downloadunitd-1542738826dd0ed26cfc8f5e2e37ffe80f1b9676.tar
unitd-1542738826dd0ed26cfc8f5e2e37ffe80f1b9676.zip
Rename to unitd, clean up CMakeLists.txt
-rw-r--r--.gitignore14
-rw-r--r--CMakeLists.txt33
-rw-r--r--askconsole.c5
-rw-r--r--cmake/FindJSON_C.cmake24
-rw-r--r--early.c8
-rw-r--r--log.h4
-rw-r--r--service/instance.c8
-rw-r--r--service/instance.h9
-rw-r--r--service/service.c6
-rw-r--r--service/service.h9
-rw-r--r--signal.c12
-rw-r--r--state.c22
-rw-r--r--system.c16
-rw-r--r--ubus.c10
-rw-r--r--unitd.c (renamed from procd.c)12
-rw-r--r--unitd.h (renamed from procd.h)35
-rw-r--r--utils/askfirst.c4
-rw-r--r--utils/utils.c4
-rw-r--r--utils/utils.h9
-rw-r--r--watchdog.c6
-rw-r--r--watchdog.h9
21 files changed, 142 insertions, 117 deletions
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 <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
@@ -11,7 +10,7 @@
* GNU General Public License for more details.
*/
-#include "procd.h"
+#include "unitd.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -22,7 +24,7 @@
#include <unistd.h>
#include <stdlib.h>
-#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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -29,7 +31,7 @@
#include <libubox/md5.h>
-#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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -13,8 +15,7 @@
* GNU General Public License for more details.
*/
-#ifndef __PROCD_INSTANCE_H
-#define __PROCD_INSTANCE_H
+#pragma once
#include <libubox/vlist.h>
#include <libubox/uloop.h>
@@ -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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -16,7 +18,7 @@
#include <libubox/blobmsg_json.h>
#include <libubox/avl-cmp.h>
-#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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -13,8 +15,7 @@
* GNU General Public License for more details.
*/
-#ifndef __PROCD_SERVICE_H
-#define __PROCD_SERVICE_H
+#pragma once
#include <libubox/avl.h>
#include <libubox/vlist.h>
@@ -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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -18,7 +20,7 @@
#include <unistd.h>
-#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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -21,7 +23,7 @@
#include <sys/types.h>
#include <signal.h>
-#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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -25,7 +27,7 @@
#include <libubox/uloop.h>
-#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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -18,7 +20,7 @@
#include <unistd.h>
#include <signal.h>
-#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/procd.c b/unitd.c
index a9dde95..19cfbed 100644
--- a/procd.c
+++ b/unitd.c
@@ -1,7 +1,9 @@
/*
+ * Copyright (C) 2015 Matthias Schiffer <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -22,7 +24,7 @@
#include <getopt.h>
#include <libgen.h>
-#include "procd.h"
+#include "unitd.h"
#include "watchdog.h"
unsigned int debug = 4;
@@ -45,7 +47,7 @@ int main(int argc, char **argv)
return 1;
}
- ulog_open(ULOG_KMSG, LOG_DAEMON, "procd");
+ ulog_open(ULOG_KMSG, LOG_DAEMON, "unitd");
while ((ch = getopt(argc, argv, "d:s:")) != -1) {
switch (ch) {
@@ -61,8 +63,8 @@ int main(int argc, char **argv)
}
setsid();
uloop_init();
- procd_signal();
- procd_state_next();
+ unitd_signal();
+ unitd_state_next();
uloop_run();
uloop_done();
diff --git a/procd.h b/unitd.h
index b68cba8..a4550e5 100644
--- a/procd.h
+++ b/unitd.h
@@ -1,7 +1,9 @@
/*
+ * Copyright (C) 2015 Matthias Schiffer <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -13,8 +15,7 @@
* GNU General Public License for more details.
*/
-#ifndef __PROCD_H
-#define __PROCD_H
+#pragma once
#include <libubox/uloop.h>
#include <libubox/utils.h>
@@ -30,22 +31,20 @@
extern char *ubus_socket;
extern int upgrade_running;
-void procd_early(void);
+void unitd_early(void);
-void procd_connect_ubus(void);
-void procd_reconnect_ubus(int reconnect);
+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 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
+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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -13,8 +15,7 @@
* GNU General Public License for more details.
*/
-#ifndef __PROCD_UTILS_H
-#define __PROCD_UTILS_H
+#pragma once
#include <libubox/avl.h>
#include <libubox/blob.h>
@@ -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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -24,7 +26,7 @@
#include <libubox/uloop.h>
-#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 <mschiffer@universe-factory.net>
+ *
+ * Based on "procd" by:
* 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
@@ -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