fixes for netbsd #735

wants to merge 5 commits into


None yet
3 participants

yamt commented Oct 28, 2012

rebased version of #591
plus one more fix.

yamt added some commits Jul 19, 2012

don't define _XOPEN_SOURCE for NetBSD
on NetBSD, defining _XOPEN_SOURCE hides extensions
like inet_aton, strcasecmp, etc.
rename popcount to popcount_binary to avoid a conflict with NetBSD libc
NetBSD-current's libc has a function named popcount.
hiding these extensions using feature macros is not possible because
redis uses other extensions covered by the same feature macro.
eg. inet_aton
use nanosleep instead of usleep
SUSv3 says that:
	The useconds argument shall be less than one million. If the value of
	useconds is 0, then the call has no effect.
and actually NetBSD's implementation rejects such a value with EINVAL.
use nanosleep which has no such a limitation instead.
_XOPEN_SOURCE 600 for NetBSD as well
it's necessary for getaddrinfo etc.
while i'm not sure why this is under #ifdef linux in the first place,
keep non-NetBSD cases as-is for now.
don't assume time_t == long
time_t is always 64bit on recent versions of NetBSD.

@yamt yamt referenced this pull request Oct 28, 2012


fixes for netbsd #591


antirez commented Oct 28, 2012

Everything looks fine to me, only thing I'm not sure is commit 881f3ea since I'm not sure that all the other systems where we build have "j" format specifier support for printf. Maybe we can instead go for casting?


antirez commented Oct 28, 2012

p.s. also, thank you!

moreaki commented Oct 28, 2012

@antirez: With regard to the "j" format specifier, I believe the C99 standard is pretty clear about it (section Here's what the convenient POSIX documentation about printf format specifiers has to say:

So, unless redis is currently supported on operating systems that do not have C99 compliant C compilers, I believe the proposed format specifier "j" is quite safe. YMMV.


yamt commented Oct 29, 2012

if it's desirable to support non-C99 environments, long long is safer.
do you want me to prepare a patch?


antirez commented Oct 29, 2012

I think we are currently already dependent on C99 in other places, so IMHO it's worth to go into the direction of using C99 specific constructs without too problems as son as they are mature in all the platforms we support currently (Linux, *BSD, OSX, and in a "best effort" way also Solaris-derivates).

Redis currently is compiled using -std=c99 btw.


yamt commented Oct 30, 2012

Linux, *BSD, OSX, and in a "best effort" way also Solaris-derivates

all of them seem to support 'j' modifier according to their latest man pages.


antirez commented Nov 1, 2012

Thanks @yamt


yamt commented Apr 4, 2013

please tell me if/when you want me rebase again.

@yamt yamt referenced this pull request May 17, 2013


netbsd support #1111


yamt commented May 17, 2013

see #1111 for newer patches

@yamt yamt closed this May 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment