[Initng-svn] r4059 - initng/trunk/src
svn at initng.thinktux.net
svn at initng.thinktux.net
Mon May 8 11:30:39 CEST 2006
Author: jimmy
Date: Mon May 8 11:30:38 2006
New Revision: 4059
Modified:
initng/trunk/src/initng_depend.c
Log:
Cleanup and commenting in initng_depend.c, also put the new REQ_NOT_FOUND state on a service when a required file is not found, instead of just deleting that service.
Modified: initng/trunk/src/initng_depend.c
==============================================================================
--- initng/trunk/src/initng_depend.c (original)
+++ initng/trunk/src/initng_depend.c Mon May 8 11:30:38 2006
@@ -67,6 +67,7 @@
return (TRUE);
}
+ /* No, "service" was not depending on "check" */
return (FALSE);
}
@@ -83,7 +84,6 @@
int initng_depend_deep(active_db_h * service, active_db_h * check)
{
int stack = 0;
-
return (initng_depend_deep2(service, check, &stack));
}
@@ -93,6 +93,7 @@
active_db_h *current = NULL;
int result = FALSE;
+ /* avoid cirular */
if (current == service)
return (FALSE);
@@ -116,7 +117,9 @@
break;
}
}
- return result;
+
+ /* return with the result found at last */
+ return(result);
}
/* check if any service in list, that is starting, running, or stopping
@@ -161,6 +164,7 @@
assert(service);
assert(check);
+ /* check if "service" requires "check" */
while ((string = get_next_string(&REQUIRE, service, ¤t)))
{
str = fix_variables( string, service);
@@ -171,6 +175,8 @@
}
fix_free( str, string);
}
+
+ /* check if "service" needs "check" */
current = NULL;
while ((string = get_next_string(&NEED, service, ¤t)))
{
@@ -182,6 +188,8 @@
}
fix_free( str, string);
}
+
+ /* check if "service" uses "check" */
current = NULL;
while ((string = get_next_string(&USE, service, ¤t)))
{
@@ -193,6 +201,8 @@
}
fix_free( str, string);
}
+
+ /* No, it did not */
return (FALSE);
}
@@ -467,8 +477,9 @@
assert(service);
assert(service->name);
- /* TODO, make this one while loop, using active_db_get_next */
+ /* TODO, make REQUIRE and NEED one while loop, using active_db_get_next to save cpu-time */
+ /* start every REQUIRED service */
while ((tmp = get_next_string(&REQUIRE, service, ¤t)))
{
str = fix_variables( tmp, service);
@@ -483,13 +494,13 @@
continue;
}
- /* OKAY, start the service */
+ /* OKAY, start the service. This is a REQUIRED service so fail if not found. */
if (!initng_handler_start_new_service_named(str))
{
F_("%s required dep \"%s\" could not start!\n", service->name,
str);
- initng_handler_stop_service(service);
+ initng_common_mark_service(service, &REQ_NOT_FOUND);
fix_free( str, tmp);
return (FALSE);
}
@@ -497,6 +508,7 @@
fix_free( str, tmp);
}
+ /* start every NEEDED service */
current = NULL;
while ((tmp = get_next_string(&NEED, service, ¤t)))
{
@@ -520,5 +532,6 @@
fix_free( str, tmp);
}
+ /* if we got here, its a sucess */
return (TRUE);
}
More information about the Initng-svn
mailing list