Files
Timothy Nikkel 0dbaaf7973 Bug 2062949. Regenerate nsprpub/config/prdepend.h for NSPR_4_40_RTM. r=sylvestre UPGRADE_NSPR_RELEASE
prdepend.py appends the release tag from moz.yaml to config/prdepend.h so that updating
NSPR forces a rebuild. The update to NSPR_4_40_RTM in bug 2050344 did not re-run it, so
the header still records NSPR_4_39_RTM, which is exactly the staleness it exists to
prevent, and re-vendoring nsprpub did not reproduce the committed tree.

With this, `./mach vendor nsprpub/moz.yaml -r NSPR_4_40_RTM --patch-mode check --force`
reproduces the committed tree exactly.

Differential Revision: https://phabricator.services.mozilla.com/D318093
2026-08-12 14:37:06 +00:00
..

NSPR — Netscape Portable Runtime

CI codecov License: MPL 2.0

Warning

NSPR is a legacy library (started in 1994!) and should not be used for new projects. It predates modern C/C++ standards and the portable threading, I/O, time, and networking primitives now available in the standard library and the operating system. New code should rely on those instead (e.g. <threads.h> / std::thread, <chrono>, POSIX/Winsock APIs). NSPR is maintained primarily for the benefit of existing consumers such as NSS and Firefox.

NSPR (Netscape Portable Runtime) is a platform-neutral API that provides system-level and libc-like functions. It gives applications a uniform interface to non-GUI operating system facilities and is used by Mozilla clients, Red Hat and Oracle server applications, and other software.

NSPR is functionally complete and is in maintenance mode: updates track changes in supported operating systems rather than adding new features.

Features

  • Threads — a unified threading API across platforms ranging from those without native threads to those with sophisticated implementations.
  • Thread synchronization — monitor-style mutual exclusion and condition variables, with Java-compatible reentrancy.
  • I/O — an enhanced BSD-sockets model supporting layered, synchronous I/O with optional non-blocking behavior.
  • Network addresses — manipulation of network addresses with a migration path between IPv4 and IPv6.
  • Time — interval timers for timeouts and scheduling, plus calendar functions covering roughly year 30000 to year 30000.
  • Memory managementmalloc, calloc, realloc, free.
  • Shared library linking — load and unload dynamic libraries.

Getting NSPR

  • Windows — build from source.
  • macOS — install via MacPorts or Homebrew.
  • Debian / Ubuntusudo apt-get install libnspr4-dev
  • openSUSE — install mozilla-nspr (and mozilla-nspr-devel for headers) via zypper or YaST.

Building from source

mkdir target && cd target
../configure
make

Running the test suite

make -C target/pr/tests
cd target/pr/tests && ./runtests.sh
  • NSS — Network Security Services, built on top of NSPR.

License

NSPR is licensed under the Mozilla Public License, version 2.0. See LICENSE for details.