r2810 - jhalfs/trunk/common

georgeb at linuxfromscratch.org georgeb at linuxfromscratch.org
Wed Jun 28 17:36:23 PDT 2006


Author: georgeb
Date: 2006-06-28 18:36:22 -0600 (Wed, 28 Jun 2006)
New Revision: 2810

Modified:
   jhalfs/trunk/common/progress_bar.sh
Log:
Replace fuser process lookup with test for directory existance in /proc. fuser has a high cpu cost for smaller systems

Modified: jhalfs/trunk/common/progress_bar.sh
===================================================================
--- jhalfs/trunk/common/progress_bar.sh	2006-06-28 19:24:26 UTC (rev 2809)
+++ jhalfs/trunk/common/progress_bar.sh	2006-06-29 00:36:22 UTC (rev 2810)
@@ -21,14 +21,16 @@
 declare -i  SEC=0  # Seconds accumulator
 declare -i  PREV_SEC=0
 
+makePID=$(fuser -v . 2>&1 | grep make)
+makePID=$(echo $makePID | cut -d" " -f2)
 
 write_or_exit() {
     # make has been killed or failed or run to completion, leave
-  if ! fuser -v . 2>&1 | grep make >/dev/null ; then
-     echo -n "${CURSOR_ON}" && exit
-  fi
+  [[ ! -e /proc/$makePID ]] && echo -n "progress bar dies:${CURSOR_ON}" && exit
+
     # Target build complete, leave.
   [[ -f ${TARGET} ]] && echo -n "${CURSOR_ON}" && exit
+
     # It is safe to write to the screen
   echo -n "$1"
 }




More information about the alfs-log mailing list