Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Dec 2011 18:13:10 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        mdf@freebsd.org, Robert Watson <rwatson@freebsd.org>, current@freebsd.org
Subject:   Re: extattr_set_*() return type
Message-ID:  <20111221161310.GW50300@deviant.kiev.zoral.com.ua>
In-Reply-To: <201112211031.11977.jhb@freebsd.org>
References:  <201112201649.06265.jhb@freebsd.org> <CAMBSHm-6VpY_8BkkSJyDThw3DwioaSvC=soZQqcYDAE3jh3oqA@mail.gmail.com> <201112211031.11977.jhb@freebsd.org>

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

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

On Wed, Dec 21, 2011 at 10:31:11AM -0500, John Baldwin wrote:
> On Tuesday, December 20, 2011 5:18:58 pm mdf@freebsd.org wrote:
> > On Tue, Dec 20, 2011 at 1:49 PM, John Baldwin <jhb@freebsd.org> wrote:
> > > Hmm, if these functions are expected to operate like 'write(2)' and a=
re
> > > supposed to return the number of bytes written, shouldn't their retur=
n value
> > > be 'ssize_t' instead of 'int'?  It looks like the system calls themse=
lves
> > > already do the right thing in setting td_retval[] (they assign a ssiz=
e_t to it
> > > and td_retval[0] can hold a ssize_t on all of our current platforms).=
  It
> > > would seem that the only change would be to the header and probably
> > > syscalls.master.  I guess this would require a symver bump to fix tho=
ugh.
> >=20
> > An extended attribute larger than 2GB is a programming abuse, though.
> > Technically int may not be 32 bits but it is on all supported
> > platforms now.
>=20
> Today it is an abuse.  In the 90's a 64-bit off_t was considered an abuse=
 by
> some. :)
>=20
> The type should match the documented behavior.  On OS X the set operation
> doesn't return a size but instead returns a simple success/failure (0 or =
-1)
> for which an int is appropriate.  However, the FreeBSD API documents that=
 it
> operates like write and consumes the buffer.   Note that the size of the
> buffer passed to the 'set' and 'get' operations is a size_t, not an int, =
and
> the 'get' operations already return a ssize_t, not an int.

Note that read(2)/write(2) do return int. I still have WIP patch to fix
this, but after some conversations with Bruce I am not sure it is worth
finishing.

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAk7yBZYACgkQC3+MBN1Mb4jUzQCfR3CXwLMZ9MMWuxN+v8Llnox5
NFYAmgIns4Y1urAY5DTY5huLDk+//+vZ
=Z0YS
-----END PGP SIGNATURE-----

--dekGTJBfK0OxIkXB--



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