From 8821c36a7798fd1c16d85ce63bcf519618975800 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Mon, 12 Apr 1999 06:44:42 +0000 Subject: [PATCH] add debugging messages about waiting for children at exit --- pppd/main.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/pppd/main.c b/pppd/main.c index 8fab864..31828a7 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -18,7 +18,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: main.c,v 1.74 1999/04/12 06:24:46 paulus Exp $"; +static char rcsid[] = "$Id: main.c,v 1.75 1999/04/12 06:44:42 paulus Exp $"; #endif #include @@ -126,6 +126,20 @@ int link_stats_valid; static int charshunt_pid; /* Process ID for charshunt */ +/* + * We maintain a list of child process pids and + * functions to call when they exit. + */ +struct subprocess { + pid_t pid; + char *prog; + void (*done) __P((void *)); + void *arg; + struct subprocess *next; +}; + +static struct subprocess *children; + /* Prototypes for procedures local to this file. */ static void create_pidfile __P((void)); @@ -809,8 +823,15 @@ main(argc, argv) } /* Wait for scripts to finish */ - while (n_children > 0) + while (n_children > 0) { + if (debug) { + struct subprocess *chp; + dbglog("Waiting for %d child processes...", n_children); + for (chp = children; chp != NULL; chp = chp->next) + dbglog(" script %s, pid %d", chp->prog, chp->pid); + } reap_kids(1); + } die(0); return 0; @@ -1382,20 +1403,6 @@ device_script(program, in, out, dont_wait) } -/* - * We maintain a list of child process pids and - * functions to call when they exit. - */ -struct subprocess { - pid_t pid; - char *prog; - void (*done) __P((void *)); - void *arg; - struct subprocess *next; -}; - -struct subprocess *children; - /* * run-program - execute a program with given arguments, * but don't wait for it. -- 2.39.2