Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Nov 2009 08:02:01 +0100
From:      Ulrich =?utf-8?B?U3DDtnJsZWlu?= <uqs@spoerlein.net>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: [patch] add pwait utility
Message-ID:  <20091107070201.GF34407@acme.spoerlein.net>
In-Reply-To: <20091106222446.GB60707@stack.nl>
References:  <20091106222446.GB60707@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 06.11.2009 at 23:24:46 +0100, Jilles Tjoelker wrote:
> I propose adding a small new utility to /usr/bin: pwait. Similar to the
> Solaris utility of the same name, it waits for any process to terminate.
> Some use cases I have in mind:
> 
> * rc.subr's wait_for_pids. This is a cleaner and more efficient fix for
>   PR conf/132766. In the rare case that /usr is not available, the old
>   sleep(1) method can be used.
> * interactive use, e.g. to shut down the computer when some task is done
>   even if the task is already running

Hi Jilles,

this is great! I found no sleep(3) calls in the code and it looks like
the kevent stuff will make pwait exit the instant the PID is gone.

This is really nice and should be used to improve wait_for_pids. I
understand that shutdown duration is of zero importance for server
operations, but when using FreeBSD on the desktop or laptop I often do
"halt -p", just because it is seriously faster and I know the
implications.

A slower machine of mine is calling sleep(1) inside wait_for_pid way too
often during shutdown. I'd also vote to reduce the sleep(1) call from 2s
to 0.5s. Gotta do some benchmarking here ...

Regards,
Uli



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091107070201.GF34407>