Standard byteorder functions across BSD / Linux

Max Laier max at
Wed Jun 4 23:19:53 UTC 2008

On Thursday 05 June 2008 00:33:19 Nanno Langstraat wrote:
> My question to FreeBSD:
> I don't use FreeBSD myself, but I'll prepare a patch if you like the
> idea and if you indicate what you'll accept:
>     * <endian.h> or <sys/endian.h> ?
>       I maintain that it should be <endian.h> for user applications:
>       IMHO <sys/> is for the user-kernel API, and byteorder belongs to
>       libc not the kernel API.
>       glibc apparently agrees, OpenBSD disagreed.

Not sure about this.  There might be namespace issues with this approach, 
though there probably shouldn't.  It's obviously not a problem to have 
both, but getting rid of sys/endian.h now is too late for sure.

>     * You're OK with userspace applications standardizing on OpenBSD's
>       original betoh64() instead of FreeBSD's derivate be64toh() ?

I'm all for this.  We should keep the both for backward compatibility and 
it will probably take some fixing to hunt down all ported code that does 
define betoh64 on its own.

/"\  Best regards,                      | mlaier at
\ /  Max Laier                          | ICQ #67774661
 X  | mlaier at EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News

More information about the freebsd-hackers mailing list