Deleted Added
full compact
rc.subr (203022) rc.subr (206248)
1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $
1# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $
2# $FreeBSD: head/etc/rc.subr 203022 2010-01-26 13:23:31Z emaste $
2# $FreeBSD: head/etc/rc.subr 206248 2010-04-06 05:20:46Z dougb $
3#
4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 339 unchanged lines hidden (view full) ---

350}
351
352#
353# wait_for_pids pid [pid ...]
354# spins until none of the pids exist
355#
356wait_for_pids()
357{
3#
4# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
5# All rights reserved.
6#
7# This code is derived from software contributed to The NetBSD Foundation
8# by Luke Mewburn.
9#
10# Redistribution and use in source and binary forms, with or without

--- 339 unchanged lines hidden (view full) ---

350}
351
352#
353# wait_for_pids pid [pid ...]
354# spins until none of the pids exist
355#
356wait_for_pids()
357{
358 local _list _prefix _nlist _j
359
358 _list="$@"
359 if [ -z "$_list" ]; then
360 return
361 fi
362 _prefix=
363 while true; do
364 _nlist="";
365 for _j in $_list; do
366 if kill -0 $_j 2>/dev/null; then
367 _nlist="${_nlist}${_nlist:+ }$_j"
360 _list="$@"
361 if [ -z "$_list" ]; then
362 return
363 fi
364 _prefix=
365 while true; do
366 _nlist="";
367 for _j in $_list; do
368 if kill -0 $_j 2>/dev/null; then
369 _nlist="${_nlist}${_nlist:+ }$_j"
370 [ -n "$_prefix" ] && sleep 1
368 fi
369 done
370 if [ -z "$_nlist" ]; then
371 break
372 fi
373 _list=$_nlist
374 echo -n ${_prefix:-"Waiting for PIDS: "}$_list
375 _prefix=", "
371 fi
372 done
373 if [ -z "$_nlist" ]; then
374 break
375 fi
376 _list=$_nlist
377 echo -n ${_prefix:-"Waiting for PIDS: "}$_list
378 _prefix=", "
376 pwait $_list 2>/dev/null || sleep 2
379 pwait $_list 2>/dev/null
377 done
378 if [ -n "$_prefix" ]; then
379 echo "."
380 fi
381}
382
383#
384# check_startmsgs

--- 1326 unchanged lines hidden ---
380 done
381 if [ -n "$_prefix" ]; then
382 echo "."
383 fi
384}
385
386#
387# check_startmsgs

--- 1326 unchanged lines hidden ---