User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.4 (like Gecko) Build Identifier: The attached patch allows to build nspr on FreeBSD 6.2. Support for getprotobyname_r() function is added since 6.2-BETA1, with the same 5-args form of GLIBC 2. Reproducible: Always
Comment on attachment 240132 [details] [diff] [review] nspr-4.6.3-fbsd62.patch r=wtc. Thank you for the patch. Does NSPR not compile if this patch is not applied? Another place to define these two macros is _freebsd.h. See http://lxr.mozilla.org/nspr/source/nsprpub/pr/include/md/_freebsd.h and http://lxr.mozilla.org/nspr/source/nsprpub/pr/include/md/_netbsd.h Question -- in _freebsd.h we are including <osreldate.h> to get the definition of the __FreeBSD_version macro. Is that still the right header to include, or is <sys/param.h> better?
At least 4.6.3 release does not build without this patch (fails with a conflicting declaration of getprotobyname_r and getprotobynumber_r: ../../../dist/include/nspr/md/_freebsd.h:101:1: warning: "_PR_INET6" redefined <command line>:1:1: warning: this is the location of the previous definition ../../../../mozilla/nsprpub/pr/src/misc/prnetdb.c:1183: error: conflicting types for 'getprotobyname_r' /usr/include/netdb.h:249: error: previous declaration of 'getprotobyname_r' was here ../../../../mozilla/nsprpub/pr/src/misc/prnetdb.c:1192: error: conflicting types for 'getprotobynumber_r' /usr/include/netdb.h:252: error: previous declaration of 'getprotobynumber_r' was here gmake: *** [prnetdb.o] Error 1 gmake: Leaving directory `/var/tmp/portage/nspr-4.6.3/work/nspr-4.6.3/build/pr/src/misc' gmake: *** [export] Error 2 gmake: Leaving directory `/var/tmp/portage/nspr-4.6.3/work/nspr-4.6.3/build/pr/src' gmake: *** [export] Error 2 gmake: Leaving directory `/var/tmp/portage/nspr-4.6.3/work/nspr-4.6.3/build/pr' gmake: *** [export] Error 2 the two functions have been added to FreeBSD 6.2 and were not available before. osreldate.h is as good as sys/param.h to include, so I suppose that the whole inclusion part can be simply dropped; I'll attach an updated patch after making sure that it actually builds. I've defined _PR_HAVE_GETPROTO_R in prnetdb.c itself mostly because all the other operating systems have their defines there.
Created attachment 240163 [details] [diff] [review] Updated (smaller) patch This version relies on osreldate.h being included already by _freebsd.h, so just checks the __FreeBSD_version (an undefined macro will evaluate to 0). I haven't moved the definition around as the rest of the checks are local to this file.
Comment on attachment 240163 [details] [diff] [review] Updated (smaller) patch r=wtc.
I checked in the patch on the NSPR trunk (NSPR 4.7) and the NSPRPUB_PRE_4_2_CLIENT_BRANCH (Mozilla trunk/1.9 alpha). Checking in prnetdb.c; /cvsroot/mozilla/nsprpub/pr/src/misc/prnetdb.c,v <-- prnetdb.c new revision: 3.51; previous revision: 3.50 done Checking in prnetdb.c; /cvsroot/mozilla/nsprpub/pr/src/misc/prnetdb.c,v <-- prnetdb.c new revision: 126.96.36.199; previous revision: 188.8.131.52 done
I checked in the patch on the NSPR_4_6_BRANCH (NSPR 4.6.4). Checking in prnetdb.c; /cvsroot/mozilla/nsprpub/pr/src/misc/prnetdb.c,v <-- prnetdb.c new revision: 184.108.40.206; previous revision: 3.47 done