Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Jul 1995 14:39:07 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-current@freebsd.org
Subject:   Re: /etc/rc and "rm -f /var/spool/lock/*"
Message-ID:  <199507080439.OAA14323@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> |Lock files suck.  They should not be used at all, and the only client
>> |that really needs them right now is mgetty.
>> 
>> What if you wanted to run outgoing hylafax and outgoing
>> 'ppp -auto' on the same port.

>Open the callout device with O_EXCL.

Erm, O_EXCL is useless for locking devices in FreeBSD.  POSIX specifies
the behaviour for open() with both O_CREAT and O_EXCL set.  This
behaviour is useless for locking of devices (it only works of the file
doesn't already exist, and non-existent files aren't devices).  The
behaviour is implementation-defined if only O_EXCL is set.  In FreeBSD,
the behaviour is to ignore O_EXCL.

FreeBSD provides the TIOCEXCL ioctl.  This is not so good in theory
(open() + ioctl() isn't atomic, so the locking can at best be advisory)
and is worse in practice (the ioctl always succeeds and no advise is
given about prior locking; also, the locking doesn't apply to root).

Bruce



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