aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <goliath@infraroot.at>2020-04-24 12:24:19 +0200
committerDavid Oberhollenzer <goliath@infraroot.at>2020-04-24 12:26:26 +0200
commit70ea16b0b4423f02e4f0c265320c336341363793 (patch)
tree53dd43046b11d099131b39853f428a1273f6beae /lib
parent5f282897317df38bbd96ba567f3a4f1d2f259039 (diff)
Cleanup: remove rdsvc flags
With the previous changes, there were only used by the status command. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/include/service.h12
-rw-r--r--lib/init/rdsvc.c32
-rw-r--r--lib/init/svcscan.c4
3 files changed, 14 insertions, 34 deletions
diff --git a/lib/include/service.h b/lib/include/service.h
index a05c7ee..a01c6bb 100644
--- a/lib/include/service.h
+++ b/lib/include/service.h
@@ -36,14 +36,6 @@ enum {
};
enum {
- RDSVC_NO_FNAME = 0x01, /* do not store a copy of the filename */
- RDSVC_NO_EXEC = 0x02, /* do not store executable script */
- RDSVC_NO_CTTY = 0x04, /* do not store the controlling tty */
- RDSVC_NO_DEPS = 0x08, /* do not store dependencies */
- RDSVC_NO_DESC = 0x10, /* do not store description */
-};
-
-enum {
/* truncate stdout */
SVC_FLAG_TRUNCATE_OUT = 0x01,
@@ -87,7 +79,7 @@ typedef struct {
/*
Read a service from a file.
*/
-service_t *rdsvc(int dirfd, const char *filename, int flags);
+service_t *rdsvc(int dirfd, const char *filename);
void delsvc(service_t *svc);
@@ -98,7 +90,7 @@ void delsvc(service_t *svc);
Returns 0 on success, -1 on failure. The function takes care of
printing error messages on failure.
*/
-int svcscan(const char *directory, service_list_t *list, int flags);
+int svcscan(const char *directory, service_list_t *list);
void del_svc_list(service_list_t *list);
diff --git a/lib/init/rdsvc.c b/lib/init/rdsvc.c
index 40e73bc..7d70232 100644
--- a/lib/init/rdsvc.c
+++ b/lib/init/rdsvc.c
@@ -46,9 +46,7 @@ static int try_pack_argv(char *str, rdline_t *rd)
static int svc_desc(void *user, char *arg, rdline_t *rd, int flags)
{
service_t *svc = user;
-
- if (flags & RDSVC_NO_DESC)
- return 0;
+ (void)flags;
if (try_unescape(arg, rd))
return -1;
@@ -59,9 +57,7 @@ static int svc_desc(void *user, char *arg, rdline_t *rd, int flags)
static int svc_tty(void *user, char *arg, rdline_t *rd, int flags)
{
service_t *svc = user;
-
- if (flags & RDSVC_NO_CTTY)
- return 0;
+ (void)flags;
if (strncmp(arg, "truncate", 8) == 0 && isspace(arg[8])) {
svc->flags |= SVC_FLAG_TRUNCATE_OUT;
@@ -81,12 +77,10 @@ static int svc_exec(void *user, char *arg, rdline_t *rd, int flags)
{
service_t *svc = user;
exec_t *e, *end;
+ (void)flags;
svc->flags |= SVC_FLAG_HAS_EXEC;
- if (flags & RDSVC_NO_EXEC)
- return 0;
-
e = calloc(1, sizeof(*e) + strlen(arg) + 1);
if (e == NULL) {
fprintf(stderr, "%s: %zu: out of memory\n",
@@ -113,9 +107,7 @@ static int svc_exec(void *user, char *arg, rdline_t *rd, int flags)
static int svc_before(void *user, char *arg, rdline_t *rd, int flags)
{
service_t *svc = user;
-
- if (flags & RDSVC_NO_DEPS)
- return 0;
+ (void)flags;
if (svc->before != NULL) {
fprintf(stderr, "%s: %zu: 'before' dependencies respecified\n",
@@ -134,9 +126,7 @@ static int svc_before(void *user, char *arg, rdline_t *rd, int flags)
static int svc_after(void *user, char *arg, rdline_t *rd, int flags)
{
service_t *svc = user;
-
- if (flags & RDSVC_NO_DEPS)
- return 0;
+ (void)flags;
if (svc->after != NULL) {
fprintf(stderr, "%s: %zu: 'after' dependencies respecified\n",
@@ -231,7 +221,7 @@ static const cfg_param_t svc_params[] = {
{ "after", 0, svc_after },
};
-service_t *rdsvc(int dirfd, const char *filename, int flags)
+service_t *rdsvc(int dirfd, const char *filename)
{
const char *arg, *args[1];
service_t *svc = NULL;
@@ -255,17 +245,15 @@ service_t *rdsvc(int dirfd, const char *filename, int flags)
if (svc == NULL)
goto fail_oom;
- if (!(flags & RDSVC_NO_FNAME)) {
- svc->fname = strdup(filename);
- if (svc->fname == NULL)
- goto fail_oom;
- }
+ svc->fname = strdup(filename);
+ if (svc->fname == NULL)
+ goto fail_oom;
memcpy(svc->name, filename, nlen);
svc->id = -1;
if (rdcfg(svc, &rd, svc_params,
- sizeof(svc_params) / sizeof(svc_params[0]), flags)) {
+ sizeof(svc_params) / sizeof(svc_params[0]), 0)) {
goto fail;
}
diff --git a/lib/init/svcscan.c b/lib/init/svcscan.c
index 840d819..9fdf0bb 100644
--- a/lib/init/svcscan.c
+++ b/lib/init/svcscan.c
@@ -11,7 +11,7 @@
#include "service.h"
-int svcscan(const char *directory, service_list_t *list, int flags)
+int svcscan(const char *directory, service_list_t *list)
{
int i, dfd, type, ret = 0;
struct dirent *ent;
@@ -66,7 +66,7 @@ int svcscan(const char *directory, service_list_t *list, int flags)
if (type != S_IFREG && type != S_IFLNK)
continue;
- svc = rdsvc(dfd, ent->d_name, flags);
+ svc = rdsvc(dfd, ent->d_name);
if (svc == NULL) {
ret = -1;
continue;