diff options
author | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-11-04 14:27:28 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-11-04 14:30:16 +0100 |
commit | 34f542b7cc6e84403326acf145487a7d83175a11 (patch) | |
tree | f63accb7d3f22e5cae61dcdeb3b65add403d28cf | |
parent | 1ffc240b3f7668ff2fb4e72b6e15937824a6cf3e (diff) |
Seperate init specific code from utility code
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
-rw-r--r-- | cmd/Makemodule.am | 6 | ||||
-rw-r--r-- | crond/Makemodule.am | 2 | ||||
-rw-r--r-- | initd/Makemodule.am | 2 | ||||
-rw-r--r-- | lib/Makemodule.am | 16 | ||||
-rw-r--r-- | lib/include/service.h | 10 | ||||
-rw-r--r-- | lib/include/util.h | 10 | ||||
-rw-r--r-- | lib/init/del_svc_list.c (renamed from lib/util/del_svc_list.c) | 0 | ||||
-rw-r--r-- | lib/init/delsvc.c (renamed from lib/util/delsvc.c) | 0 | ||||
-rw-r--r-- | lib/init/opensock.c (renamed from lib/util/opensock.c) | 0 | ||||
-rw-r--r-- | lib/init/rdsvc.c (renamed from lib/util/rdsvc.c) | 0 | ||||
-rw-r--r-- | lib/init/svc_tsort.c (renamed from lib/util/svc_tsort.c) | 0 | ||||
-rw-r--r-- | lib/init/svcmap.c (renamed from lib/util/svcmap.c) | 0 | ||||
-rw-r--r-- | lib/init/svcscan.c (renamed from lib/util/svcscan.c) | 0 |
13 files changed, 25 insertions, 21 deletions
diff --git a/cmd/Makemodule.am b/cmd/Makemodule.am index 30e9619..f2c7d5f 100644 --- a/cmd/Makemodule.am +++ b/cmd/Makemodule.am @@ -2,13 +2,13 @@ shutdown_SOURCES = cmd/shutdown.c shutdown_CPPFLAGS = $(AM_CPPFLAGS) shutdown_CFLAGS = $(AM_CFLAGS) shutdown_LDFLAGS = $(AM_LDFLAGS) -shutdown_LDADD = libinit.a +shutdown_LDADD = libinit.a libutil.a runsvc_SOURCES = cmd/runsvc/runsvc.c cmd/runsvc/env.c cmd/runsvc/runsvc.h runsvc_CPPFLAGS = $(AM_CPPFLAGS) runsvc_CFLAGS = $(AM_CFLAGS) runsvc_LDFLAGS = $(AM_LDFLAGS) -runsvc_LDADD = libinit.a libcfg.a +runsvc_LDADD = libinit.a libutil.a libcfg.a killall5_SOURCES = cmd/killall5.c killall5_CPPFLAGS = $(AM_CPPFLAGS) @@ -24,7 +24,7 @@ service_SOURCES += $(SRVHEADERS) service_CPPFLAGS = $(AM_CPPFLAGS) service_CFLAGS = $(AM_CFLAGS) service_LDFLAGS = $(AM_LDFLAGS) -service_LDADD = libinit.a libcfg.a +service_LDADD = libinit.a libutil.a libcfg.a if GCROND service_SOURCES += cmd/service/schedule.c diff --git a/crond/Makemodule.am b/crond/Makemodule.am index 51960e9..6beeff1 100644 --- a/crond/Makemodule.am +++ b/crond/Makemodule.am @@ -3,7 +3,7 @@ gcrond_SOURCES = crond/main.c crond/gcrond.h crond/runjob.c gcrond_CPPFLAGS = $(AM_CPPFLAGS) gcrond_CFLAGS = $(AM_CFLAGS) gcrond_LDFLAGS = $(AM_LDFLAGS) -gcrond_LDADD = libcron.a libinit.a libcfg.a +gcrond_LDADD = libcron.a libutil.a libcfg.a sbin_PROGRAMS += gcrond endif diff --git a/initd/Makemodule.am b/initd/Makemodule.am index 54ae43d..e6260f5 100644 --- a/initd/Makemodule.am +++ b/initd/Makemodule.am @@ -3,6 +3,6 @@ init_SOURCES += initd/status.c initd/supervisor.c init_CPPFLAGS = $(AM_CPPFLAGS) init_CFLAGS = $(AM_CFLAGS) init_LDFLAGS = $(AM_LDFLAGS) -init_LDADD = libinit.a libcfg.a +init_LDADD = libinit.a libutil.a libcfg.a sbin_PROGRAMS += init diff --git a/lib/Makemodule.am b/lib/Makemodule.am index 51bce72..66652bc 100644 --- a/lib/Makemodule.am +++ b/lib/Makemodule.am @@ -1,13 +1,17 @@ HEADRS = lib/include/util.h lib/include/service.h lib/include/telinit.h -libinit_a_SOURCES = lib/util/delsvc.c lib/util/svcmap.c lib/util/enum_by_name.c -libinit_a_SOURCES += lib/util/rdsvc.c lib/util/svcscan.c lib/util/mksock.c -libinit_a_SOURCES += lib/util/del_svc_list.c lib/util/svc_tsort.c -libinit_a_SOURCES += lib/util/opensock.c lib/util/enum_to_name.c -libinit_a_SOURCES += lib/util/print_version.c lib/util/argv_exec.c $(HEADRS) +libinit_a_SOURCES = lib/init/delsvc.c lib/init/svcmap.c lib/init/rdsvc.c +libinit_a_SOURCES += lib/init/svcscan.c lib/init/del_svc_list.c +libinit_a_SOURCES += lib/init/svc_tsort.c lib/init/opensock.c $(HEADRS) libinit_a_CPPFLAGS = $(AM_CPPFLAGS) libinit_a_CFLAGS = $(AM_CFLAGS) +libutil_a_SOURCES = lib/util/argv_exec.c lib/util/enum_by_name.c +libutil_a_SOURCES += lib/util/enum_to_name.c lib/util/mksock.c +libutil_a_SOURCES += lib/util/print_version.c $(HEADRS) +libutil_a_CPPFLAGS = $(AM_CPPFLAGS) +libutil_a_CFLAGS = $(AM_CFLAGS) + libcfg_a_SOURCES = lib/libcfg/rdline.c lib/libcfg/unescape.c lib/libcfg/rdcfg.c libcfg_a_SOURCES += lib/libcfg/pack_argv.c lib/include/libcfg.h libcfg_a_CPPFLAGS = $(AM_CPPFLAGS) @@ -20,4 +24,4 @@ libcron_a_CFLAGS = $(AM_CFLAGS) EXTRA_DIST += $(HEADRS) lib/include/libcfg.h lib/include/crontab.h -noinst_LIBRARIES += libinit.a libcfg.a libcron.a +noinst_LIBRARIES += libinit.a libcfg.a libcron.a libutil.a diff --git a/lib/include/service.h b/lib/include/service.h index abe4968..ca96e58 100644 --- a/lib/include/service.h +++ b/lib/include/service.h @@ -57,12 +57,6 @@ enum { SVC_FLAG_TRUNCATE_OUT = 0x01, }; -typedef struct exec_t { - struct exec_t *next; - int argc; /* number of elements in argument vector */ - char args[]; /* argument vectot string blob */ -} exec_t; - typedef struct service_t { struct service_t *next; @@ -125,9 +119,5 @@ const char *svc_target_to_string(int target); int svc_target_from_string(const char *target); -int setup_tty(const char *tty, bool truncate); - -NORETURN void argv_exec(exec_t *e); - #endif /* SERVICE_H */ diff --git a/lib/include/util.h b/lib/include/util.h index 6d2bf5d..925a1f0 100644 --- a/lib/include/util.h +++ b/lib/include/util.h @@ -35,6 +35,12 @@ typedef struct { int value; } enum_map_t; +typedef struct exec_t { + struct exec_t *next; + int argc; /* number of elements in argument vector */ + char args[]; /* argument vectot string blob */ +} exec_t; + enum { /* only allow root to connect */ SOCK_FLAG_ROOT_ONLY = 0x01, @@ -73,5 +79,9 @@ int mksock(const char *path, int flags); /* print a default version info and license string */ NORETURN void print_version(const char *program); +int setup_tty(const char *tty, bool truncate); + +NORETURN void argv_exec(exec_t *e); + #endif /* UTIL_H */ diff --git a/lib/util/del_svc_list.c b/lib/init/del_svc_list.c index 553a701..553a701 100644 --- a/lib/util/del_svc_list.c +++ b/lib/init/del_svc_list.c diff --git a/lib/util/delsvc.c b/lib/init/delsvc.c index 9ab51f1..9ab51f1 100644 --- a/lib/util/delsvc.c +++ b/lib/init/delsvc.c diff --git a/lib/util/opensock.c b/lib/init/opensock.c index 0c2bf56..0c2bf56 100644 --- a/lib/util/opensock.c +++ b/lib/init/opensock.c diff --git a/lib/util/rdsvc.c b/lib/init/rdsvc.c index ca60731..ca60731 100644 --- a/lib/util/rdsvc.c +++ b/lib/init/rdsvc.c diff --git a/lib/util/svc_tsort.c b/lib/init/svc_tsort.c index 5f83fa0..5f83fa0 100644 --- a/lib/util/svc_tsort.c +++ b/lib/init/svc_tsort.c diff --git a/lib/util/svcmap.c b/lib/init/svcmap.c index 41fb950..41fb950 100644 --- a/lib/util/svcmap.c +++ b/lib/init/svcmap.c diff --git a/lib/util/svcscan.c b/lib/init/svcscan.c index f4c7ef1..f4c7ef1 100644 --- a/lib/util/svcscan.c +++ b/lib/init/svcscan.c |