Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Jun 2002 08:45:58 -0400 (EDT)
From:      "Geoffrey C. Speicher" <geoff@sea-incorporated.com>
To:        Paul Herman <pherman@frenchfries.net>
Cc:        "Matthew D. Fuller" <fullermd@over-yonder.net>, <freebsd-stable@FreeBSD.ORG>, Matt Simerson <freebsd@blockads.com>
Subject:   Re: bug in pw, -STABLE [patch]
Message-ID:  <20020623083510.K29729-100000@sea-incorporated.com>
In-Reply-To: <20020623000216.E37393-100000@mammoth.eat.frenchfries.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 23 Jun 2002, Paul Herman wrote:

> On Sat, 22 Jun 2002, Geoffrey C. Speicher wrote:
>
> > DESCRIPTION
> >     pid_begin() will check for existence of the pid file named
> >     _path_, and if it exists, determine whether the process whose
> >     pid is contained therein is still running.
> >
> >     [...]
>
> That's nice and all, but you really are trying to solve the wrong
> problem here.  Remember, you want to lock a particular file and not
> an entire process.  (Think: concurrent pw(8)s with different -V
> directories.)
>
> Keep it simple.  Do what you mean.  If you want to make changes to
> /etc/master.passwd then open(2) /etc/master.passwd with O_EXLOCK.

As Matt Fuller already pointed out in a follow-up, that brings us back to
where we were when we started, and it doesn't work for this application,
since master.passwd disappears and reappears before we're done.  Hence the
use of a pid file as a mutex.

You raise a good point about concurrent pw(8)s with different -V
parameters, and I would think that the solution would be either to use a
different pid file for each -V, or to not worry about it for pw(8) and
have concurrent instances sometimes block briefly when it's not necessary.

Geoff


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




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