[Initng-svn] r4384 - in initng/trunk: plugins/simple_launcher src

svn at initng.thinktux.net svn at initng.thinktux.net
Wed Jun 7 11:11:24 CEST 2006


Author: jimmy
Date: Wed Jun  7 11:11:22 2006
New Revision: 4384

Modified:
   initng/trunk/plugins/bash_launcher/initng_bash_launcher.c
   initng/trunk/plugins/simple_launcher/initng_simple_launcher.c
   initng/trunk/src/initng_fork.c
   initng/trunk/src/initng_fork.h

Log:
Do a special call for callong g.AFTER_FORK


Modified: initng/trunk/plugins/bash_launcher/initng_bash_launcher.c
==============================================================================
--- initng/trunk/plugins/bash_launcher/initng_bash_launcher.c	(original)
+++ initng/trunk/plugins/bash_launcher/initng_bash_launcher.c	Wed Jun  7 11:11:22 2006
@@ -159,6 +159,9 @@
 
 	if ((pid_fork = initng_fork(s, process_to_exec)) == 0)
 	{
+		/* run afterfork hooks from other plugins */
+		initng_fork_aforkhooks(s, process_to_exec);
+	
 		/* execute code */
 		bash_this(script, s, args);
 

Modified: initng/trunk/plugins/simple_launcher/initng_simple_launcher.c
==============================================================================
--- initng/trunk/plugins/simple_launcher/initng_simple_launcher.c	(original)
+++ initng/trunk/plugins/simple_launcher/initng_simple_launcher.c	Wed Jun  7 11:11:22 2006
@@ -172,7 +172,9 @@
 
 	if ((pid_fork = initng_fork(s, process_to_exec)) == 0)
 	{
-
+		/* run g.AFTER_FORK from other plugins */
+		initng_fork_aforkhooks(s, process_to_exec);
+		
 #ifdef DEBUG
 		D_("FROM_FORK simple_exec(%i,%s, ...);\n", argc, argv[0]);
 		/*D_argv("simple_exec: ", argv); */

Modified: initng/trunk/src/initng_fork.c
==============================================================================
--- initng/trunk/src/initng_fork.c	(original)
+++ initng/trunk/src/initng_fork.c	Wed Jun  7 11:11:22 2006
@@ -44,13 +44,26 @@
 
 #include "initng_fork.h"
 
+void initng_fork_aforkhooks(active_db_h * service, process_h * process)
+{
+	s_call *current = NULL;
+		/* There might be plug-ins that will work here */
+		while_list(current, &g.A_FORK)
+		{
+			if (((*current->c.af_launcher) (service, process)) == FALSE)
+			{
+				F_("Some plugin did fail (from:%s), in after fork launch.\n",
+				   current->from_file);
+				_exit(1);
+			}
+		}
+}
 
 pid_t initng_fork(active_db_h * service, process_h * process)
 {
 	/* This is the real service kicker */
 	pid_t pid_fork;				/* pid got from fork() */
 	int try_count = 0;			/* Count tryings */
-	s_call *current = NULL;
 	pipe_h *current_pipe = NULL;	/* used while walking */
 
 	assert(service);
@@ -165,18 +178,6 @@
 			}
 		}
 
-		/* There might be plug-ins that will work here */
-		while_list(current, &g.A_FORK)
-		{
-			if (((*current->c.af_launcher) (service, process)) == FALSE)
-			{
-				F_("Some plugin did fail (from:%s), in after fork launch.\n",
-				   current->from_file);
-				_exit(1);
-			}
-		}
-
-
 		/* TODO, what does this do? */
 		if (g.i_am == I_AM_INIT)
 			tcsetpgrp(0, getpgrp());		/* run this in foreground on fd 0 */

Modified: initng/trunk/src/initng_fork.h
==============================================================================
--- initng/trunk/src/initng_fork.h	(original)
+++ initng/trunk/src/initng_fork.h	Wed Jun  7 11:11:22 2006
@@ -24,5 +24,6 @@
 #include "initng_process_db.h"				/* process_h */
 
 pid_t initng_fork(active_db_h * service, process_h * process);
+void initng_fork_aforkhooks(active_db_h * service, process_h * process);
 
 #endif


More information about the Initng-svn mailing list