[PATCH] FreeBSD 6.2 support in nspr: getprotobyname_r available

RESOLVED FIXED in 4.6.4

Status

NSPR
NSPR
P2
normal
RESOLVED FIXED
11 years ago
11 years ago

People

(Reporter: Diego Pettenò, Assigned: Wan-Teh Chang)

Tracking

other
4.6.4
x86
FreeBSD

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

11 years ago
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
(Reporter)

Comment 1

11 years ago
Created attachment 240132 [details] [diff] [review]
nspr-4.6.3-fbsd62.patch
(Assignee)

Comment 2

11 years ago
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?
Attachment #240132 - Flags: review+
(Reporter)

Comment 3

11 years ago
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.
(Reporter)

Comment 4

11 years ago
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.
Attachment #240132 - Attachment is obsolete: true
(Assignee)

Comment 5

11 years ago
Comment on attachment 240163 [details] [diff] [review]
Updated (smaller) patch

r=wtc.
Attachment #240163 - Flags: review+
(Assignee)

Comment 6

11 years ago
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
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
OS: Other → FreeBSD
Priority: -- → P2
Target Milestone: --- → 4.6.4
(Assignee)

Comment 7

11 years ago
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
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.