You are currently viewing a snapshot of taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to, please file a bug.

NSPR 4.1 Release


Table of Contents

  1. Introduction
  2. What's New
  3. Library Version Specification
  4. Platforms
  5. Compatibility
  6. Release Components
  7. Test Data
  8. Reporting bugs
  9. Building from source
  10. Contact Info

1. Introduction

The NSPR 4.1 release is available at /share/builds/components/nspr20/v4.1. This is a minor upgrade from the 4.0 release of NSPR and NSPR 4.1 is backward compatible with 4.0.x releases.

2. What's New

NSPR 4.1 provides some new features and some bug fixes..

2.1 New functions and features

The following new functions or features have been added.
  • Added flags support to PR_Recv(), PR_Send(), PR_RecvFrom(), See Bugzilla: 17223. In particular, allows the caller to PEEK at messages waiting without receiving data.
  • Added function PR_GetMemMapAlignment(). See Bugzilla: 38996. This function is provided because some platforms require the offset value passed to PR_MemMap() to be aligned: on Unix, it is page size; on windows it is "allocation granularity".
  • Added support for layered nonblocking connect . See Bugzilla: 40778.
  • NSPR changes its license from NPL 1.1 to the dual-license of MPL/GPL. See BugZilla: 42367 .
  • Added function PR_GetNumberOfProcessors(). See BugZilla: 25981. This new function returns the number of CPUs on the running system.
  • Added function PR_SetEnv(). See BugZilla:25982 .
  • Implement PR_AcceptRead(), PR_TransmitFile() across all platforms, taking advantage of platform dependent features that provide equivalent function or using emulated capability on platforms that do not provide those features. See BugZilla: 34920.

2.2 Bug fixes

The following table shows a summary of bug-fixes in NSPR 4.1. The table includes bugs fixed in NSPR 4.0.1 and 4.0.2.

ID Summary
4090 PR_Open()'s PR_APPEND flag is a no-op
5518 Win32: PRSeekWhence values are passed to SetFilePointer.
17223 Support the flags argument to PR_Recv, PR_Send, PR_RecvFrom,
26506 The DNS lock is not needed with native threads.
30914 PR_PushIOLayer should not swap the contents of the fd's
31437 Process ERANGE error on Solaris
31697 Porting NSPR to Mac OS X (Rhapsody)
32779 PR_Interrupt should increment the condition variable's pendi
33652 PR_AcceptRead should not align PRNetAddr on the size of void
35405 rcnetdb.cpp uses == to compare two PRIPv6Addr structures
37146 The atomic.c test prints incorrect output
38599 Better implementation of PR_Poll on Unix
39674 Remove the Unix sigprocmask calls in prnetdb.c
39696 Assembly code implementation of NSPR atomic routines for Sol
39731 PR_GetInheritedFD doesn't support pipes
39942 PR_SetError calls free.
40529 Some error returns in PR_GetIPNodeByName don't properly clea
40629 NSPR's /dev/zero fd gets inherited by child processes
40941 Patches for Linux/IA64
41832 Pthreads: PR_WaitCondVar does not set error code on failure
42714 Remove NSPR's dependency on winmm.dll
42874 ntsec.c: OpenProcessToken may fail with ERROR_ACCESS_DENIED
42900 PR_Connect doesn't time out in the NT version
43507 PR_EnableClockInterrupts calls _PR_InitStuff.
45181 NSPR assumes the FD_CLOEXEC flag is cleared.
45432 Leaking PRLibrary if a library won't load
46506 Use pthreads by default on FreeBSD.
46909 Mac's prcpucfg.h should not define _PR_LOCAL_THREADS_ONLY.
50386 PR_Sleep() may return uninitialized variable.
17806 The value of the out_flags fields when PR_Poll returns 0 or
46166 function may return undefined value
46525 UMR in OpenProcessToken called from PR_NT_InitSids [ntsec.c
46417 PR_ProcessAttrSetStdioRedirect misbehaves
30902 True atomic implementation of NSPR atomic routines for Unix/
31049 PR_Accept crashes if the listening socket is an emulated IPv
31120 ntio.c: _PR_Unblock_IO_Wait sets the wrong thr_bound_cpu.
32184 PL_HashTableEnumerateEntries isn't stable over PL_HashTableR
32234 prcpucfg.h breaks compiles, needs comment delimeters
33740 need to change os2io.c for write errors and create new files
34048 NSPR library loading fix: specify fragment names of the DLLs
35408 PR_NewTCPSocketPair needs to create a thread to do the conne
37272 macsockotpt.c: inet_addr() should return -1 rather than asse
37761 assert in nslocalstore.cpp
39967 crash due to missing stylesheet
43337 PR_GetPeerName() asserts
45141 Unable to build retail NSPR
45623 function returns uninitialized variable
36170 NSPR's shared library loader doesn't properly report errors

3. Library Name and Versioning

The binaries for this release are named libnspr4 (nspr4 on Win 95).

The full release number of nspr library can be determined in several ways:

1. The nspr library exports a function, libVersionPoint, that can be called to retrieve the version of the library. The function and data prototypes are available for other libraries to provide similar version information.
2. On Win32 systems, the version number is embedded in the resource descriptor of the DLL and can be viewed using Windows Explorer. On Unix system, the "what" command of sccs or the "ident" command of rcs can be used to obtain the version information.
3. The PR_VersionCheck function can be called to check for compatibility; given a version number the function returns success condition if the version of the nspr library loaded into the application is compatible.

4. Platforms

The set of supported platforms is listed in the following table. For most platforms, a single release of the nspr library is used to support all the current releases of the OS.

Platform Build Compiler
Certify &
Thread Model Build Name Comments
Solaris 2.6 SparcWorks C/C++ 4.2 2.6
8 (32bit & 64bit)
pthreads SunOS5.6_OPT.OBJ 32-bit version
7 (64-bit) SparcWorks C/C++ 5.0 7 (64-bit)
8 (64-bit)
pthreads SunOS5.7_64_OPT.OBJ 64-bit version
Windows NT 4.0, SP6a MSVC 6.0, SP4 95 OSR2
98 2ed
NT4.0, SP6a
Win 2000
threads WIN954.0_OPT.OBJ
Win NT NT 4.0, SP6a MSVC 6.0, SP4 NT4.0, SP6a
Win 2000
threads &
AIX 4.3.3 C Set ++ for AIX 3.6.4 - xlC 4.3.3 pthreads AIX4.3_OPT.OBJ
4.3.3/64-bit C Set ++ for AIX 3.6.4 - xlC 4.3.3/64-bit pthreads AIX4.3_64_OPT.OBJ
Tru64 UNIX (the new name of Digital UNIX) 4.0D Digital C++ v6.1-027
Digital CC v5.6-079
pthreads OSF1V4.0D_OPT.OBJ
HP-UX 11.0 aCC: A.03.13
cc: A.11.01.00
11.0 pthreads HP-UXB.11.00_OPT.OBJ
11.0/64-bit aCC: A.03.04
cc: A.11.00.00
11.0/64-bit pthreads HP-UXB.11.00_64_OPT.OBJ
Linux Red Hat 6.1 egcs-1.1.2 RH 6.1
RH 6.2
pthreads Linux2.2_x86_glibc_PTH_OPT.OBJ glibc-2.1.2

Cooperatively Developed Platforms
Platform Build Compiler
Certify &
Thread Model Build Name Owner Comments
Macintosh 8.5 Metrowerks
Client PPC Only

5. Compatibility

The NSPR 4.1 release is backward compatible with releases 4.0.x.

For the nspr library, backward compatibility does not preclude the addition of new error codes to the set of nspr error codes already defined. An application should allow for nspr functions returning error codes not documented for the particular release with which it is linked. This helps to retain backward compatibility as new error codes are added upon discovery of new information about platform-specific error codes.

6. Release Components

The main components of this release are a set of shared libraries and header files for each platform. A debug build and a release (optimized) build of the libraries are made available for each platform.

6.1 Platform Directory

The platform-dependent name of the directory where the components are placed is of the form

<os-name><os-version>[_<compiler>][cpu-arch][_<implementation strategy>][_<addr-bits>]_<DBG|OPT>.OBJ

For example,
SunOS5.6_OPT.OBJ (optimized build)
AIX4.3_64_DBG.OBJ (64-bit, debug build)

6.2 Implementation Strategy

For the implementation of nspr, different strategies are used on different platforms. On some platforms the nspr threads map directly to the native threads on the platform, while on others nspr supports both threads that are scheduled by nspr and the native threads.

The default implementation strategies in this release are:
- pthreads: all Unix platforms
- classic: Win NT (combined MxN model, with Windows threads and fibers)
- native threads: Win95

6.3 Components

Under each <platform> directory, there are:

1. include directory, containing the header files
2. lib directory, containing the libraries. Three libraries are built on all platforms: nspr, plc, plds. Only shared (dynamic link) versions of the libraries are built.

The nspr library exports the core nspr functions.

The plc (Portable Library C) library is a separate library from the core nspr. You do
not need to use plc if you just want to use the core nspr functions. The plc library currently
contains thread-safe string functions and functions for processing command-line options.

The plds (Portable Library Data Structures) library supports data structures such as arenas and hash tables. It is important to note that services of plds are not thread-safe. To use these services in a multi-threaded environment, clients have to implement their own thread-safe access, by acquiring locks/monitors, for example.

For Solaris platforms with UltraSparc processors only, a platform-specific library, libultrasparc, is also supplied. This library implements optimized versions of atomic operations by using the features present in the UltraSparc (V9) processors, but not in the Sparc (V8) processors. This library is linked into libnspr, with the name libatomic, by use of the auxiliary filter mechanism of the Solaris linker. To use this library at runtime, on UltraSparc systems, should be copied into a file named and the new file should be present in the path searched by the linker, set using LD_LIBRARY_PATH.

3. bin directory, containing a perl script,, and a Java bundle,
4. mdheader.jar, jar file for the header files.
5. mdbinary.jar, jar for the libraries, executable programs, and scripts.

7. Test Data

All the major functional areas of nspr were tested using the programs in the nspr test suite. Both functional and stress tests in the pr/tests directory were successfully run on multi-processor systems for most platforms, except for Win95/98.

8. Reporting bugs

Bugs discovered should be reported by filing a report in Bugsplat. The following information is required
  • platform (Solaris 2.6, HP-UX 11.0, etc.)
  • number of cpus in the system
  • a stack trace, in the event of a crash
  • reproducibility of the problem
  • location of core dump, if available, along with those for the libraries and executables

9. Building from source

This release is built from the source, at the CVS repository rooted at, with the CVS tag
NSPRPUB_RELEASE_4_1. You can check out the source from CVS by
cvs co -r NSPRPUB_RELEASE_4_1 mozilla/nsprpub

To build, do
cd mozilla/nsprpub
gmake export

10. Contact Info - NSPR documentation
http://warp/projects/hardcore/prj-nspr20 - nspr home page
nsprgroup - the nspr team
nspr20clients - mailing list for nspr clients
netscape.public.mozilla.nspr - nspr newsgroup at