aboutsummaryrefslogtreecommitdiff
path: root/src/librc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-04-11 07:15:02 +0000
committerRoy Marples <roy@marples.name>2007-04-11 07:15:02 +0000
commitf754c661f57225b92ab72ce8867607341efa0c53 (patch)
treebdab51fe000b4f254e9e936f460b92e11d99cb41 /src/librc.c
parentffc96d8d892cf5b5433eadb5a305d64ab23b274d (diff)
Add new service hooks, remove pmake stuff from our Makefile and fix rc_services_in_state for scheduled.
Diffstat (limited to 'src/librc.c')
-rw-r--r--src/librc.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/librc.c b/src/librc.c
index 60e5e1bd..a34702d4 100644
--- a/src/librc.c
+++ b/src/librc.c
@@ -47,6 +47,7 @@ static const char *rc_service_state_names[] = {
"wasinactive",
"coldplugged",
"failed",
+ "scheduled",
NULL
};
@@ -261,6 +262,7 @@ bool rc_mark_service (const char *service, const rc_service_state_t state)
if ((i != skip_state &&
i != rc_service_stopped &&
i != rc_service_coldplugged &&
+ i != rc_service_scheduled &&
i != rc_service_crashed) &&
(! skip_wasinactive || i != rc_service_wasinactive))
{
@@ -547,7 +549,8 @@ void rc_schedule_start_service (const char *service,
char *init;
char *file;
- if (! rc_service_exists (service) || ! rc_service_exists (service_to_start))
+ /* service may be a provided service, like net */
+ if (! service || ! rc_service_exists (service_to_start))
return;
dir = rc_strcatpaths (RC_SVCDIR, "scheduled", basename (service),
@@ -656,8 +659,34 @@ char **rc_services_in_state (rc_service_state_t state)
(char *) NULL);
char **list = NULL;
- if (rc_is_dir (dir))
- list = rc_ls_dir (list, dir, RC_LS_INITD);
+ if (state == rc_service_scheduled)
+ {
+ char **dirs = rc_ls_dir (NULL, dir, 0);
+ char *d;
+ int i;
+
+ STRLIST_FOREACH (dirs, d, i)
+ {
+ char *p = rc_strcatpaths (dir, d, (char *) NULL);
+ char **entries = rc_ls_dir (NULL, p, RC_LS_INITD);
+ char *e;
+ int j;
+
+ STRLIST_FOREACH (entries, e, j)
+ list = rc_strlist_addsortu (list, e);
+
+ if (entries)
+ free (entries);
+ }
+
+ if (dirs)
+ free (dirs);
+ }
+ else
+ {
+ if (rc_is_dir (dir))
+ list = rc_ls_dir (list, dir, RC_LS_INITD);
+ }
free (dir);
return (list);