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.0 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.0 release is available at  /share/builds/components/nspr20/v4.0. This is a major version upgrade from the 3.x  releases of NSPR and NSPR 4.0 is not fully backward compatible with the older releases.

2. What's New

In addition to several bug fixes the following new features are available in this release, as compared to NSPR 3.5.1.

2.1 New functions and features

1. Specification of security attributes of named objects
The security attributes of named objects (files, shared memory and semaphores) can now be specified with a platform-independent API at the time of creation; the access modes are similar to those in POSIX.
2.  Thread pools
A set of new interfaces for creating thread pools to create and manage jobs. This is a preliminary version of the API and is subject to change.

The new interfaces and test programs (for sample usage) are found in:

Header files: prtpool.h
Test programs: pr/tests/thrpool_server.c

3. Support for IPv6
Support of IPv6 is now included for all platforms. The API is similar to the one defined in RFC 2553. The IPv6 implementation is based on the native IPv6 support, where available, and is emulated with IPv4 sockets and IPv4-mapped IPv6 addresses on other platforms. Native IPv6 support is available in the base OS on AIX 4.3.3 and Solaris 8.

An application can simultaneously use IPv4 and IPv6 sockets.

Header file: prio.h, prnetdb.h
Test program: pr/tests/socket.c

4. Support for blocking and unblocking interrupts.
Two new interfaces, PR_BlockInterrupt and PR_UnblockInterrupt are added to NSPR. When a thread blocks interrupt, the interrupt is kept pending until it is unblocked.

Header files: prthread.h

5. Source of random noise to seed pseudo-random number generators.
A new function, PR_GetRandomNoise, is available to generate random seeds.
6. Server-side socket features for Mac

        A set of server-side socket features are supported on the Mac platform. These include accepting connections and
        blocking IO.

7. Enhanced interface for dynamic load library function

        A new function, PR_LoadLibraryWithFlags, to support immediate-load/lazy-load options and
        platform-specific library attributes.

8. Miscellaneous features

  • New data types for file offset, PROffset32 and PROffset64
  • Add PR_EXCL flag for PR_Open
  • Add PR_SendFile to PRIOMethods table
  • NSPR interfaces are declared with the dllimport attribute on Windows

2.2 Bug fixes

The bug fixes in NSPR 4.0 are listed in the report  Bugzilla bug 29632.

2.3 Obsolete and Modified Interfaces

NSPR 4.0 is not backward compatible with the previous releases of NSPR.

2.3.1 Obsolete library

The C++ I/O Streams library (prstrms.h, libprstrms3) is no longer part of the NSPR distribution.

2.3.2 Obsolete interfaces

A few interfaces have been removed from NSPR 4.0, they are listed in the report Obsolete interfaces in NSPR 4.0 Bugzilla bug 23642.

2.3.3 Modified interfaces

The semantics of a few interfaces are modified; they are listed in the report  Bugzilla bug 23641

3. Library Name and Versioning

The binaries for this release are named libnspr4 (nspr4 on Win 95); this release is not backward compatible with previous releases.

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
pthreads SunOS5.6_OPT.OBJ  32-bit version
7/64-bit SparcWorks C/C++ 5.0 7/64-bit
pthreads SunOS5.7_64_OPT.OBJ 64-bit version
Windows 95 Visual C++ 6.0 95
NT 4.0
Win 2000
threads WIN954.0_OPT.OBJ MSVC 6.0 SP3
Win NT 4.0SP4 Visual C++ 6.0 4.0SP4
Win 2000
threads &
AIX  4.3.3 C Set ++ for AIX 3.6.4 - xlC 4.3.3 pthreads AIX4.3_OPT.OBJ 32-bit
4.3.3/64-bit C Set ++ for AIX 3.6.4 - xlC 4.3.3/64-bit pthreads AIX4.3_64_OPT.OBJ 64-bit
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 32-bit
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 64-bit
Linux Red Hat 6.0 egcs-1.1.2 RH 6.1 pthreads Linux2.2_x86_glibc_PTH_OPT.OBJ glibc-2.1.2 

Important changes to note are:

1. Solaris

Solaris 8 is supported.
Two binaries are provided for Solaris

1. A Solaris 2.6 binary is for 32-bit applications running on Solaris 2.6, 7 and 8.
2. A 64-bit Solaris 7 binary for 64-bit applications running on Solaris 7 and 8

To use purify on Solaris, libpthread should be explicitly specified in the list of libraries passed to the linker, ahead of other system libraries such as -lposix4, -lsocket, -ldl, etc.,.

2. AIX

        Two versions are supported for AIX 4.3.3, one for 32-bit and another for 64-bit mode. AIX 4.3.2 is no longer

        A bug in the send_file function in AIX causes data corruption in the 64-bit version of AIX. To work around this
        bug the environment variable NSPR_AIX_SEND_FILE_USE_DISABLED should be set to 1 when using the
        64-bit version of NSPR.

3. Linux

        Linux is now supported only on the Redhat 6.1 release. The binaries are built with the egcs-1.1.2 compiler and
        glibc-2.1.2 library.

4. Win 2000

        The latest version of Windows, Windows 2000, is supported.

5. Compatibility

The NSPR 4.0 release is not backward compatible with the previous releases of NSPR.

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.

In addition, tests described in the Year 2000 Test Plan were successfully executed.

 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_0.  You can check out the source from CVS by
    cvs co -r NSPRPUB_RELEASE_4_0 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