1
0
Fork 0
mirror of https://github.com/pygos/init.git synced 2024-11-24 20:10:42 +01:00

Seperate init specific code from utility code

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-11-04 14:27:28 +01:00
parent 1ffc240b3f
commit 34f542b7cc
13 changed files with 25 additions and 21 deletions

View file

@ -2,13 +2,13 @@ shutdown_SOURCES = cmd/shutdown.c
shutdown_CPPFLAGS = $(AM_CPPFLAGS) shutdown_CPPFLAGS = $(AM_CPPFLAGS)
shutdown_CFLAGS = $(AM_CFLAGS) shutdown_CFLAGS = $(AM_CFLAGS)
shutdown_LDFLAGS = $(AM_LDFLAGS) 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_SOURCES = cmd/runsvc/runsvc.c cmd/runsvc/env.c cmd/runsvc/runsvc.h
runsvc_CPPFLAGS = $(AM_CPPFLAGS) runsvc_CPPFLAGS = $(AM_CPPFLAGS)
runsvc_CFLAGS = $(AM_CFLAGS) runsvc_CFLAGS = $(AM_CFLAGS)
runsvc_LDFLAGS = $(AM_LDFLAGS) runsvc_LDFLAGS = $(AM_LDFLAGS)
runsvc_LDADD = libinit.a libcfg.a runsvc_LDADD = libinit.a libutil.a libcfg.a
killall5_SOURCES = cmd/killall5.c killall5_SOURCES = cmd/killall5.c
killall5_CPPFLAGS = $(AM_CPPFLAGS) killall5_CPPFLAGS = $(AM_CPPFLAGS)
@ -24,7 +24,7 @@ service_SOURCES += $(SRVHEADERS)
service_CPPFLAGS = $(AM_CPPFLAGS) service_CPPFLAGS = $(AM_CPPFLAGS)
service_CFLAGS = $(AM_CFLAGS) service_CFLAGS = $(AM_CFLAGS)
service_LDFLAGS = $(AM_LDFLAGS) service_LDFLAGS = $(AM_LDFLAGS)
service_LDADD = libinit.a libcfg.a service_LDADD = libinit.a libutil.a libcfg.a
if GCROND if GCROND
service_SOURCES += cmd/service/schedule.c service_SOURCES += cmd/service/schedule.c

View file

@ -3,7 +3,7 @@ gcrond_SOURCES = crond/main.c crond/gcrond.h crond/runjob.c
gcrond_CPPFLAGS = $(AM_CPPFLAGS) gcrond_CPPFLAGS = $(AM_CPPFLAGS)
gcrond_CFLAGS = $(AM_CFLAGS) gcrond_CFLAGS = $(AM_CFLAGS)
gcrond_LDFLAGS = $(AM_LDFLAGS) gcrond_LDFLAGS = $(AM_LDFLAGS)
gcrond_LDADD = libcron.a libinit.a libcfg.a gcrond_LDADD = libcron.a libutil.a libcfg.a
sbin_PROGRAMS += gcrond sbin_PROGRAMS += gcrond
endif endif

View file

@ -3,6 +3,6 @@ init_SOURCES += initd/status.c initd/supervisor.c
init_CPPFLAGS = $(AM_CPPFLAGS) init_CPPFLAGS = $(AM_CPPFLAGS)
init_CFLAGS = $(AM_CFLAGS) init_CFLAGS = $(AM_CFLAGS)
init_LDFLAGS = $(AM_LDFLAGS) init_LDFLAGS = $(AM_LDFLAGS)
init_LDADD = libinit.a libcfg.a init_LDADD = libinit.a libutil.a libcfg.a
sbin_PROGRAMS += init sbin_PROGRAMS += init

View file

@ -1,13 +1,17 @@
HEADRS = lib/include/util.h lib/include/service.h lib/include/telinit.h 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/init/delsvc.c lib/init/svcmap.c lib/init/rdsvc.c
libinit_a_SOURCES += lib/util/rdsvc.c lib/util/svcscan.c lib/util/mksock.c libinit_a_SOURCES += lib/init/svcscan.c lib/init/del_svc_list.c
libinit_a_SOURCES += lib/util/del_svc_list.c lib/util/svc_tsort.c libinit_a_SOURCES += lib/init/svc_tsort.c lib/init/opensock.c $(HEADRS)
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_CPPFLAGS = $(AM_CPPFLAGS) libinit_a_CPPFLAGS = $(AM_CPPFLAGS)
libinit_a_CFLAGS = $(AM_CFLAGS) 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/rdline.c lib/libcfg/unescape.c lib/libcfg/rdcfg.c
libcfg_a_SOURCES += lib/libcfg/pack_argv.c lib/include/libcfg.h libcfg_a_SOURCES += lib/libcfg/pack_argv.c lib/include/libcfg.h
libcfg_a_CPPFLAGS = $(AM_CPPFLAGS) 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 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

View file

@ -57,12 +57,6 @@ enum {
SVC_FLAG_TRUNCATE_OUT = 0x01, 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 { typedef struct service_t {
struct service_t *next; 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 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 */ #endif /* SERVICE_H */

View file

@ -35,6 +35,12 @@ typedef struct {
int value; int value;
} enum_map_t; } 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 { enum {
/* only allow root to connect */ /* only allow root to connect */
SOCK_FLAG_ROOT_ONLY = 0x01, SOCK_FLAG_ROOT_ONLY = 0x01,
@ -73,5 +79,9 @@ int mksock(const char *path, int flags);
/* print a default version info and license string */ /* print a default version info and license string */
NORETURN void print_version(const char *program); 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 */ #endif /* UTIL_H */