Permalink
Browse files

modified 'count_init_children' to allow filtering by process flags

  • Loading branch information...
1 parent f85d2ed commit bb54860f67d7688a40ad1a96dc3a58f31ef49415 razvancrainea committed Jul 2, 2012
Showing with 5 additions and 5 deletions.
  1. +1 −1 daemonize.c
  2. +3 −3 pt.c
  3. +1 −1 pt.h
View
@@ -159,7 +159,7 @@ int wait_for_all_children(void)
int procs_no,i,ret;
char rc;
- procs_no = count_init_children();
+ procs_no = count_init_children(PROC_FLAG_INITCHILD);
for (i=0;i<procs_no;i++) {
ret = wait_status_code(&rc);
if (ret < 0 || rc < 0)
View
@@ -193,11 +193,11 @@ pid_t internal_fork(char *proc_desc)
}
/* returns the number of child processes
- * that are going to run child_init()
+ * filter all processes that have set the flags set
*
* used for proper status return code
*/
-int count_init_children(void)
+int count_init_children(int flags)
{
int ret=0,i;
struct sr_module *m;
@@ -232,7 +232,7 @@ int count_init_children(void)
if (!m->exports->procs[i].no || !m->exports->procs[i].function)
continue;
- if (m->exports->procs[i].flags & PROC_FLAG_INITCHILD)
+ if (!flags || (m->exports->procs[i].flags & flags))
ret+=m->exports->procs[i].no;
}
}
View
@@ -59,7 +59,7 @@ extern unsigned int counted_processes;
int init_multi_proc_support();
void set_proc_attrs( char *fmt, ...);
pid_t internal_fork(char *proc_desc);
-int count_init_children(void);
+int count_init_children(int flags);
/* return processes pid */
inline static int my_pid(void)

0 comments on commit bb54860

Please sign in to comment.