Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Aug 2009 12:09:47 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        "Mikhail T." <mi+thun@aldan.algebra.com>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: semantics of fcntl() with l_len being 0
Message-ID:  <20090826090947.GS9623@deviant.kiev.zoral.com.ua>
In-Reply-To: <4A94B829.3090202@aldan.algebra.com>
References:  <4A94B829.3090202@aldan.algebra.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--A61Eau4L8twGtri1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 26, 2009 at 12:20:57AM -0400, Mikhail T. wrote:
> Hello!
>=20
> I'm curious, whether a file, that's locked (via fcntl) with l_start and
> l_len being 0 is supposed to be appendable...
>=20
> I would think so, but I notice, that when spamprobe (see mail/spamprobe)
> chews on my spam mailbox, I can not append a new piece of spam to the
> file -- my imap-server is waiting for spamprobe to finish.
>=20
> The fcntl(2) says: ``len =3D 0 means until end of file''. Is that ``until
> the end of file AT THE TIME OF LOCKING'' or simply ``no other lock until
> we are done''? Thanks. Yours,

SUSv3 is definitive on the subject:
A lock shall be set to extend to the largest possible value of the file
offset for that file by setting l_len to 0. If such a lock also has
l_start set to 0 and l_whence is set to SEEK_SET, the whole file shall
be locked.

=46rom sys/kern/kern_lockf.c, line 464:
	} else if (fl->l_len =3D=3D 0) {
		end =3D OFF_MAX;


--A61Eau4L8twGtri1
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkqU+9sACgkQC3+MBN1Mb4hIhQCdHpyp47SyuxvCHBrZwCojjlrF
csYAniFIfgC8HSDBSjcSX6VMw+4iF+fw
=Lboc
-----END PGP SIGNATURE-----

--A61Eau4L8twGtri1--



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