Last Comment Bug 354305 - [PATCH] FreeBSD 6.2 support in nspr: getprotobyname_r available
: [PATCH] FreeBSD 6.2 support in nspr: getprotobyname_r available
Status: RESOLVED FIXED
:
Product: NSPR
Classification: Components
Component: NSPR (show other bugs)
: other
: x86 FreeBSD
: P2 normal (vote)
: 4.6.4
Assigned To: Wan-Teh Chang
: Wan-Teh Chang
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-26 04:25 PDT by Diego Pettenò
Modified: 2006-11-14 09:43 PST (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
nspr-4.6.3-fbsd62.patch (618 bytes, patch)
2006-09-26 04:25 PDT, Diego Pettenò
wtc: review+
Details | Diff | Review
Updated (smaller) patch (560 bytes, patch)
2006-09-26 10:01 PDT, Diego Pettenò
wtc: review+
Details | Diff | Review

Description Diego Pettenò 2006-09-26 04:25:24 PDT
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 1 Diego Pettenò 2006-09-26 04:25:53 PDT
Created attachment 240132 [details] [diff] [review]
nspr-4.6.3-fbsd62.patch
Comment 2 Wan-Teh Chang 2006-09-26 09:36:12 PDT
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?
Comment 3 Diego Pettenò 2006-09-26 09:53:16 PDT
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[3]: *** [prnetdb.o] Error 1
gmake[3]: Leaving directory `/var/tmp/portage/nspr-4.6.3/work/nspr-4.6.3/build/pr/src/misc'
gmake[2]: *** [export] Error 2
gmake[2]: Leaving directory `/var/tmp/portage/nspr-4.6.3/work/nspr-4.6.3/build/pr/src'
gmake[1]: *** [export] Error 2
gmake[1]: 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.
Comment 4 Diego Pettenò 2006-09-26 10:01:54 PDT
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 5 Wan-Teh Chang 2006-09-26 10:08:03 PDT
Comment on attachment 240163 [details] [diff] [review]
Updated (smaller) patch

r=wtc.
Comment 6 Wan-Teh Chang 2006-09-26 10:21:36 PDT
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: 3.21.2.29; previous revision: 3.21.2.28
done
Comment 7 Wan-Teh Chang 2006-11-14 09:43:02 PST
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: 3.47.2.1; previous revision: 3.47
done

Note You need to log in before you can comment on or make changes to this bug.