From: Davin McCall Date: Fri, 12 Jan 2018 16:17:25 +0000 (+0000) Subject: Pull some commonly occurring declarations into a new header file. X-Git-Tag: v0.08~52 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=88ce13a9be568b24a03903b707246be36030cdf9;p=oweals%2Fdinit.git Pull some commonly occurring declarations into a new header file. Adds a new header file, dinit.h, which includes declarations for some types and functions exported from dinit.cc. --- diff --git a/src/control.h b/src/control.h index 7111d5f..bf0e372 100644 --- a/src/control.h +++ b/src/control.h @@ -11,6 +11,7 @@ #include "dasynq.h" +#include "dinit.h" #include "dinit-log.h" #include "control-cmds.h" #include "service-listener.h" @@ -18,8 +19,6 @@ // Control connection for dinit -using eventloop_t = dasynq::event_loop; - class control_conn_t; class control_conn_watcher; diff --git a/src/dinit.cc b/src/dinit.cc index fd946e7..1054032 100644 --- a/src/dinit.cc +++ b/src/dinit.cc @@ -18,6 +18,7 @@ #include #endif +#include "dinit.h" #include "dasynq.h" #include "service.h" #include "control.h" @@ -49,9 +50,6 @@ static void wait_for_user_input() noexcept; static void control_socket_cb(eventloop_t *loop, int fd); -void open_control_socket(bool report_ro_failure = true) noexcept; -void setup_external_log() noexcept; - // Variables diff --git a/src/dinit.h b/src/dinit.h new file mode 100644 index 0000000..ef6b962 --- /dev/null +++ b/src/dinit.h @@ -0,0 +1,21 @@ +#ifndef DINIT_H_INCLUDED +#define DINIT_H_INCLUDED 1 + +#include "dasynq.h" + +/* + * General Dinit definitions. + */ + +using eventloop_t = dasynq::event_loop; + +using clock_type = dasynq::clock_type; +using rearm = dasynq::rearm; +using time_val = dasynq::time_val; + +void open_control_socket(bool report_ro_failure = true) noexcept; +void setup_external_log() noexcept; + +extern eventloop_t event_loop; + +#endif diff --git a/src/proc-service.cc b/src/proc-service.cc index 25885d2..64341f6 100644 --- a/src/proc-service.cc +++ b/src/proc-service.cc @@ -1,6 +1,7 @@ #include #include +#include "dinit.h" #include "dinit-socket.h" #include "dinit-util.h" #include "proc-service.h" @@ -11,12 +12,6 @@ * See proc-service.h header for interface details. */ -extern eventloop_t event_loop; - -using clock_type = dasynq::clock_type; -using rearm = dasynq::rearm; -using time_val = dasynq::time_val; - // Given a string and a list of pairs of (start,end) indices for each argument in that string, // store a null terminator for the argument. Return a `char *` vector containing the beginning // of each argument and a trailing nullptr. (The returned array is invalidated if the string is later modified). diff --git a/src/service.cc b/src/service.cc index 8e06719..04149db 100644 --- a/src/service.cc +++ b/src/service.cc @@ -14,6 +14,7 @@ #include #include +#include "dinit.h" #include "service.h" #include "dinit-log.h" #include "dinit-socket.h" @@ -24,14 +25,6 @@ * See service.h for details. */ -// from dinit.cc: -void open_control_socket(bool report_ro_failure = true) noexcept; -void setup_external_log() noexcept; - -using clock_type = dasynq::clock_type; -using rearm = dasynq::rearm; -using time_val = dasynq::time_val; - // Find the requested service by name static service_record * find_service(const std::list & records, const char *name) noexcept