Date: Mon, 31 Oct 2011 23:16:27 +0100 From: Ed Schouten <ed@80386.nl> To: John Baldwin <jhb@freebsd.org> Cc: arch@freebsd.org, Jilles Tjoelker <jilles@stack.nl> Subject: Re: [PATCH] fadvise(2) system call Message-ID: <20111031221627.GR2258@hoeg.nl> In-Reply-To: <201110311717.53476.jhb@freebsd.org> References: <201110281426.00013.jhb@freebsd.org> <201110311024.07580.jhb@freebsd.org> <20111031190359.GP2258@hoeg.nl> <201110311717.53476.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi John,
* John Baldwin <jhb@freebsd.org>, 20111031 22:17:
> I also really do think that posix_*() truly is far uglier to read. In the
> worst case, imagine something like this:
>
> char *cp;
>
> cp = posix_malloc(posix_strlen(some_string) + 1);
> posix_strcpy(cp, s);
> posix_printf("%s\n", cp);
>
> *blech*
I do agree it's ugly, but at least it's standardized. The fact is that
it's easier to explain to someone "this code doesn't build on $NONBSD,
because $NONBSD lacks POSIX conformance" than saying "this code doesn't
build on $NONBSD because it uses BSD-specific crap". As I mentioned
previously, there is no fadvise() on Linux. There's no gain in
compatibility by implementing it -- it's just syntactic sugar.
Maybe we can find a compromise. My main objection is that the current
patch adds some redundancy that will stay part of our ABI. Also, having
two different symbols makes debugging a bit harder, because you must not
forget to place multiple breakpoints, maybe even preload multiple
symbols.
What if we implement everything using the POSIX naming scheme, but put
this in <fcntl.h>:
> #if _BSD_SOURCE
> #define FADV_NORMAL POSIX_FADV_NORMAL
> #define ...
>
> static inline int
> fadvise(int _fd, off_t _offset, off_t _len, int _advice)
> {
>
> return (fadvise(_fd, _offset, _len, _advice));
> }
> #endif
That way userspace code still has the liberty of using the shorthand
notation, without being a burden on the ABI.
But please, don't let me stop you from committing your work as is. I'm
happy either way. :-)
--
Ed Schouten <ed@80386.nl>
WWW: http://80386.nl/
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)
iQIcBAEBAgAGBQJOrx47AAoJEG5e2P40kaK7WRAP/0+Y1XCZQsDDUXNa0khvIH5y
wxUA8h+1AYXQakTNC2RienRGe85EbDedbcyQT/eqaEJEb1rK0sZwjlVO8HX0miLT
wbz9diwEItQmLf+V84hY4qBAWlG0yzvK7MnfkqT7kAaujlOZC3ZUuFt2DmuzpeYu
Ar+ciZHVaR61pmXuDDTTE+wgBUYLlK4KZTqhub8fyDJq7J5lSv+OXbhuXRTJmj4O
uajz8P5YyFW/d/WD1LrAFQkPJlR+CPksQNKKO+WdbXE6w/0Iw21qB5uneP6f0Ek7
igwIGiy+vT0uFYa04ehACAj99i0cRsGX4yYtTL4vCa1x9QAtthk6EUa1emKfDPJO
DEMoKuE5kgoHYeiNLsXF4BPHf0m9KpapzWBjjgRQS+Efoo6qCY7nAvae6qpxA9cx
Xj/w+He+IdD7Esk51yjvei9ge0tLzXq9hw4uPhLA/IQknt1PswgDTdPqJuOEOzJa
nyPFIHP9pqLz7GT+u1hgxI7kKN+AkTXvrcRDz++k0TAja7Ux0ReOeuQFoetGmriP
F0tyYf7JeP+bkwY/hZcxErC8viWbiW/4YN4hHIwnDrMRnzw3W/shWWpwtQx1XW5E
moMsz5DAzyUlAky16f/+y8eLmWFemnN3KJxN5SBhf6cl5FwY9rts3PdPM+TgLHfc
/14PS2FninFw9u+OxSFc
=H2f4
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111031221627.GR2258>
