[Initng-svn] r3188 - in initng/trunk: plugins/bash_launcher plugins/dllaunch plugins/simple_launcher plugins/stcmd src

svn at initng.thinktux.net svn at initng.thinktux.net
Sat Mar 4 01:35:44 CET 2006


Author: jimmy
Date: Sat Mar  4 01:35:43 2006
New Revision: 3188

Modified:
   initng/trunk/plugins/bash_launcher/initng_bash_launcher.c
   initng/trunk/plugins/dllaunch/initng_dllaunch.c
   initng/trunk/plugins/simple_launcher/initng_simple_launcher.c
   initng/trunk/plugins/stcmd/print_service.c
   initng/trunk/src/initng.h
   initng/trunk/src/initng_fork.c
   initng/trunk/src/initng_kill_handler.c
   initng/trunk/src/initng_process_db.h
Log:
Insert a process state identifyer.
Also set pid in process_h in initng_fork.c instead of in plugins.


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	Sat Mar  4 01:35:43 2006
@@ -166,10 +166,7 @@
     D_("FROM_FORK Forkstarted pid %i.\n", pid_fork);
 
     if (pid_fork > 1)
-    {
-        process_to_exec->pid = pid_fork;
         return (TRUE);
-    }
 
     F_("bash_exec, did not get a pid!\n");
     process_to_exec->pid = 0;

Modified: initng/trunk/plugins/dllaunch/initng_dllaunch.c
==============================================================================
--- initng/trunk/plugins/dllaunch/initng_dllaunch.c	(original)
+++ initng/trunk/plugins/dllaunch/initng_dllaunch.c	Sat Mar  4 01:35:43 2006
@@ -115,7 +115,6 @@
 
     /* save pid of fork */
     D_("FROM_FORK Forkstarted pid %i.\n", pid_fork);
-    p->pid = pid_fork;
     return pid_fork;
 
 }

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	Sat Mar  4 01:35:43 2006
@@ -197,10 +197,7 @@
     D_("FROM_FORK Forkstarted pid %i.\n", pid_fork);
 
     if (pid_fork > 0)
-    {
-        process_to_exec->pid = pid_fork;
         return (TRUE);
-    }
 
     process_to_exec->pid = 0;
     return FALSE;

Modified: initng/trunk/plugins/stcmd/print_service.c
==============================================================================
--- initng/trunk/plugins/stcmd/print_service.c	(original)
+++ initng/trunk/plugins/stcmd/print_service.c	Sat Mar  4 01:35:43 2006
@@ -200,6 +200,7 @@
     fprintf(fd, "\t\tR_code: %i\n", p->r_code);
     fprintf(fd, "\t\tFds read: %i, write: %i\n", p->out_pipe[0],
             p->out_pipe[1]);
+    fprintf(fd, "\t\tpst: %i\n", p->pst);
     if (p->buffer)
     {
         fprintf(fd, "\t\tBuffer (%i): \"%s\"\n", p->buffer_allocated, p->buffer);

Modified: initng/trunk/src/initng.h
==============================================================================
--- initng/trunk/src/initng.h	(original)
+++ initng/trunk/src/initng.h	Sat Mar  4 01:35:43 2006
@@ -40,7 +40,7 @@
 #define INITNG_CREATOR "Jimmy Wennlund (jimmy.wennlund at gmail.com)"
 
 /* Add to this counter everytime the api changes, and plugins need to recompile */
-#define API_VERSION 3
+#define API_VERSION 4
 
 /* unset this in an production environment */
 /* this is set in config.h */

Modified: initng/trunk/src/initng_fork.c
==============================================================================
--- initng/trunk/src/initng_fork.c	(original)
+++ initng/trunk/src/initng_fork.c	Sat Mar  4 01:35:43 2006
@@ -166,7 +166,11 @@
         /* close the receiving end on pipe, on parent */
         close(process->out_pipe[1]);
         process->out_pipe[1] = -1;
-
+	if(pid_fork>0)
+	{
+	    process->pid = pid_fork;
+	    process->pst = P_RUNNING;
+	}
     }
 
     return (pid_fork);

Modified: initng/trunk/src/initng_kill_handler.c
==============================================================================
--- initng/trunk/src/initng_kill_handler.c	(original)
+++ initng/trunk/src/initng_kill_handler.c	Sat Mar  4 01:35:43 2006
@@ -112,6 +112,11 @@
 	close(process->out_pipe[1]);
 	process->out_pipe[1]=0;
     }
+    
+    /*
+     * Set process state.
+     */
+    process->pst = P_RETURNED;
 
     /* launch a kill_handler if any */
     if (process->pt && process->pt->kill_handler)

Modified: initng/trunk/src/initng_process_db.h
==============================================================================
--- initng/trunk/src/initng_process_db.h	(original)
+++ initng/trunk/src/initng_process_db.h	Sat Mar  4 01:35:43 2006
@@ -38,6 +38,14 @@
 typedef struct t_ptype_h ptype_h;
 typedef struct t_process_h process_h;
 
+/* process state */
+typedef enum
+{
+    P_NEW = 0,
+    P_RUNNING = 1,
+    P_RETURNED = 2,
+} e_pst;
+
 struct t_process_h
 {
     ptype_h *pt;
@@ -46,6 +54,7 @@
     int out_pipe[2];            /* pipes of process */
     char *buffer;               /* stdout buffer ## THE BEGINNING ## */
     int buffer_allocated;
+    e_pst pst;
 
     struct list_head list;      /* this process should be in a list */
 };


More information about the Initng-svn mailing list