[Crash-utility] [PATCH] remove busy-wait loop in cmdline.c

Jean-Marc Saffroy saffroy at gmail.com
Sun Sep 24 22:38:05 UTC 2006


Hello,

While using crash I found that it would suck all my CPU when external 
commands are invoked (eg. bt piped to $PAGER). The patch below works for 
me.


Cheers,

-- 
saffroy at gmail.com

Index: crash-4.0-3.4/cmdline.c
===================================================================
--- crash-4.0-3.4.orig/cmdline.c	2006-09-25 00:28:11.000000000 +0200
+++ crash-4.0-3.4/cmdline.c	2006-09-25 00:30:30.000000000 +0200
@@ -846,10 +846,8 @@
          if (pc->stdpipe) {
  		close(fileno(pc->stdpipe));
                  pc->stdpipe = NULL;
-		if (pc->stdpipe_pid && PID_ALIVE(pc->stdpipe_pid)) {
-			while (!waitpid(pc->stdpipe_pid, &waitstatus, WNOHANG))
-				;
-		}
+		if (pc->stdpipe_pid && PID_ALIVE(pc->stdpipe_pid))
+			waitpid(pc->stdpipe_pid, &waitstatus, 0);
  		pc->stdpipe_pid = 0;
          }
  	if (pc->pipe) {




More information about the Crash-utility mailing list