Last Comment Bug 361077 - Clean up the USE_PTHREADS related code in coreconf/HP-UX*.mk.
: Clean up the USE_PTHREADS related code in coreconf/HP-UX*.mk.
Status: RESOLVED FIXED
:
Product: NSS
Classification: Components
Component: Build (show other bugs)
: 3.11.3
: HP HP-UX
: -- normal (vote)
: 3.12
Assigned To: Wan-Teh Chang
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-17 11:47 PST by Wan-Teh Chang
Modified: 2006-12-07 11:37 PST (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Proposed patch (4.36 KB, patch)
2006-12-06 22:36 PST, Wan-Teh Chang
christophe.ravel.bugs: review+
Details | Diff | Review

Description Wan-Teh Chang 2006-11-17 11:47:50 PST
coreconf has some USE_PTHREADS related code that comes from
the old days when NSPR had multiple implementations on Unix.
Today NSPR has only one implementation on all major Unix
platforms.  Therefore the USE_PTHREADS code should be removed,
or we should always set USE_PTHREADS=1.

On HP-UX, the problem is more serious than on Solaris (bug 361076).
I found that even though coreconf sets USE_PTHREADS=1 by default
on HP-UX B.11.*, coreconf tests USE_PTHREADS before setting it.
An example is coreconf/HP-UXB.11.11.mk:

  ifdef USE_PTHREADS
          OS_CFLAGS       += -D_POSIX_C_SOURCE=199506L
  endif

  #
  # Config stuff for HP-UXB.11.11.
  #
  include $(CORE_DEPTH)/coreconf/HP-UXB.11.mk

But USE_PTHREADS is set in HP-UX.mk, which is included by HP-UXB.11.mk.
So to correctly add the -D_POSIX_C_SOURCE=199506L flag to the compiler
command line, we must set USE_PTHREADS=1 on HP-UX.  Without the
-D_POSIX_C_SOURCE=199506L flag, the binaries appear to work just fine,
but I found that the value of 'errno' is incorrect sometimes.

The easiest fix is to move the code

  ifdef USE_PTHREADS
          OS_CFLAGS       += -D_POSIX_C_SOURCE=199506L
  endif

to HP-UXB.11.mk, after the following statement:

  include $(CORE_DEPTH)/coreconf/HP-UX.mk

or just add -D_POSIX_C_SOURCE=199506L to the end of this statement
in HP-UXB.11.mk:

  OS_CFLAGS += $(ARCHFLAG) -DHPUX11

because HP-UXB.11.mk already adds -lpthread to OS_LIBS unconditionally.
Comment 1 Wan-Teh Chang 2006-11-17 11:52:31 PST
Christophe, make sure your SVbuild init files for HP-UX
have USE_PTHREADS=1 in $Targets.
Comment 2 Wan-Teh Chang 2006-12-06 22:36:45 PST
Created attachment 247782 [details] [diff] [review]
Proposed patch

I decided to simply add -D_POSIX_C_SOURCE=199506L to OS_CFLAGS in
HP-UXB.11.mk, without ifdef USE_PTHREADS, because HP-UXB.11.mk already
adds -lpthread to OS_LIBS unconditionally.  I also deleted some
commented-out code.
Comment 3 Wan-Teh Chang 2006-12-07 10:29:32 PST
I checked in the patch on the NSS trunk (NSS 3.12).

Checking in HP-UXB.11.00.mk;
/cvsroot/mozilla/security/coreconf/HP-UXB.11.00.mk,v  <--  HP-UXB.11.00.mk
new revision: 1.3; previous revision: 1.2
done
Checking in HP-UXB.11.11.mk;
/cvsroot/mozilla/security/coreconf/HP-UXB.11.11.mk,v  <--  HP-UXB.11.11.mk
new revision: 1.3; previous revision: 1.2
done
Checking in HP-UXB.11.20.mk;
/cvsroot/mozilla/security/coreconf/HP-UXB.11.20.mk,v  <--  HP-UXB.11.20.mk
new revision: 1.4; previous revision: 1.3
done
Checking in HP-UXB.11.22.mk;
/cvsroot/mozilla/security/coreconf/HP-UXB.11.22.mk,v  <--  HP-UXB.11.22.mk
new revision: 1.3; previous revision: 1.2
done
Checking in HP-UXB.11.23.mk;
/cvsroot/mozilla/security/coreconf/HP-UXB.11.23.mk,v  <--  HP-UXB.11.23.mk
new revision: 1.2; previous revision: 1.1
done
Checking in HP-UXB.11.mk;
/cvsroot/mozilla/security/coreconf/HP-UXB.11.mk,v  <--  HP-UXB.11.mk
new revision: 1.9; previous revision: 1.8
done
Comment 4 Wan-Teh Chang 2006-12-07 11:37:21 PST
I forgot to remove commented-out code (NSS trunk 3.12).  Did that now.

Checking in HP-UXB.11.mk;
/cvsroot/mozilla/security/coreconf/HP-UXB.11.mk,v  <--  HP-UXB.11.mk
new revision: 1.10; previous revision: 1.9
done

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