Home | History | Annotate | only in /src/include
History log of /src/include
RevisionDateAuthorComments
 1.149 08-Oct-2024  christos PR/58729: Taylor R Campbell: container_of is not documented or available
in userland
 1.148 25-Aug-2024  christos PR/58640: Riastradh: Provide sys/stdalign.h
 1.147 15-Aug-2024  riastradh uchar.h: New header file for C11 (and C++11) compliance.

Implementation of the new functions mbrtoc16, c16rtomb, mbrtoc32, and
c32rtomb to come later. Updates for C23 to come later.

PR lib/52374: <uchar.h> missing
 1.146 04-Jun-2019  hannken branches: 1.146.10; 1.146.12;
Move the basic part of XDR to common/include/rpc and common/lib/libc/rpc.

No functional change intended.
 1.145 24-Apr-2019  roy Don't install YP headers when MKYP=no
 1.144 16-Oct-2017  maya branches: 1.144.4;
Add endian.h header. Simply includes sys/endian.h

<endian.h> has been accepted by the austin group.
 1.143 02-Oct-2016  kamil branches: 1.143.6;
Import <stdalign.h>

This header conforms to the C11 standard
Reference: ISO/IEC 9899:201x 7.15 Alignment <stdalign.h>

According to ISO/IEC 9899:201x (draft) 7.15 Alignment <stdalign.h> defines
four macros:
- alignas which expands to _Alignas
- alignof which expands to _Alignof
- __alignas_is_defined and __alignof_is_defined which both expand to 1

The _Alignas declaration appears as one of the type specifiers to modify
the alignment requirement of the object being declared.

The _Alignof operator is used to query the alignment requirement of its
operand type.

ISO/IEC N3242=11-0012 (C++1x) and ISO/IEC N3797 (C++1y) both note a header
<cstdalign> which defines only __alignas_is_defined and shall not define
the alignas macro. It misses the alignof case as it's probably based on an
older C1x draft, which defined only alignas. Assume that this is a bug in
the standard and treat alignof the same way as alignas in C++11.

Allow to define alignas and alignof in C++ prior the C++11 standard. It
might be broken but a nonstandard C++ compiler might support C11-like
_Alignas and _Alignof. Note that it's fatal for g++(1) v.5.4.
 1.142 02-Oct-2016  kamil Import <stdnoreturn.h>

This header conforms to the C11 standard
Reference: ISO/IEC 9899:201x 7.23 _Noreturn <stdnoreturn.h>

According to ISO/IEC 9899:201x (draft) <stdnoreturn.> defines the
noreturn macro which expands to _Noreturn.

The _Noreturn keyword appears in a function declaration and specifies
that the function does not return by reaching the end of the function
body.

Design choices:
- don't implicitly break C++ code including this header with #error
C++11 offers [[noreturn]] which conflicts with C11 _Noreturn

- don't check for __STDC_VERSION__, everybody is free to reuse it with
a nonstandard compiler not conforming to C11 but supporting _Noreturn

gcc(1) and clang(1) support _Noreturn in -std=c99 and older standards

this follows <stdbool.h> choice for not checking for C99

- follow <stdbool.h> and declare the __noreturn_is_defined guard

- use a standard header guard (_STDNORETURN_H_), similar to <stdbool.h>

Reviewed by <pgoyette> and <joerg>
 1.141 29-Jul-2015  christos branches: 1.141.2;
move stdbool.h to sys, reuire pool.h to include <sys/stdbool.h> for bool,
centralize definitions of bool, true, false, to <sys/stdbool.h>
 1.140 11-Dec-2013  joerg Allow kernel code to access constant databases by moving cdbr(3) and the
required mi_vector_hash(3) into src/common.
 1.139 11-Feb-2012  martin branches: 1.139.6;
Add userland part of posix_spawn. Libc functions imported from FreeBSD.
Based on Charles Zhang's summer of code project.
 1.138 05-Feb-2012  dholland Migrate one last leftover bit (used only by the kernel now) to
sys/ufs/ufs and remove the old quota headers and no-longer-used shared
code. Ok by releng.
 1.137 09-Jan-2012  dholland Add <quota.h> with the new libquota API.

This is the user/application API and does not include the kernel
interface. Definitions shared with the kernel are found in
<sys/quota.h>.

Since I've been working on a local branch I have taken the liberty of
moving the latest-so-far version of <quota.h> to the front of the
patch queue. This loses (a small amount of) history but has the
advantage of avoiding unnecessary version bumps of libquota.so.
 1.136 26-Aug-2011  dyoung branches: 1.136.2;
Build and install ppath(3), property-list paths library.
 1.135 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.134 24-Mar-2011  bouyer Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
 1.133 31-Jul-2010  joerg Add support for fenv.h interface for i386 and amd64.

Submitted by Stathis Kamperis as part of GSoC 2010 and ported from
FreeBSD.
 1.132 25-Apr-2010  joerg Add the constant database reader (cdbr(3)) and writer ((cdbw(3)).
They implement a space efficent write-once database with fast access
path. Switch the services(5) database to use cdb. The size of the
database file decreases from 2.1MB disk space to 307KB. Access
performance is about the same if setservent(0) is used and about an
order of magnitude faster otherwise. services_mkdb defaults to the new
format, but can optionally create the old db(3) format as well for
statically linked legacy applications.
 1.131 28-May-2008  ad branches: 1.131.8; 1.131.16;
/usr/include/atomic.h, for Solaris source compat.
 1.130 07-Sep-2007  rmind branches: 1.130.6; 1.130.8;
Implementation of POSIX message queues.

Reviewed by: <ad>, <tech-kern>
 1.129 20-Aug-2007  drochner branches: 1.129.2;
Add C99 complex support, for double and float.
Most complex function implementations are from the "c9x-complex" library,
originating from the "cephes" math library, see
http://www.netlib.org/cephes/, from Stephen L. Moshier, incorporated and
redistributed with the NetBSD license by permission of the author.

Error behaviour and other boundary conditions (branch cuts)
need to be looked at.

For namespace sanity, I've done the rename/weak alias procedure to
most of the exported functions which are also used internally.
Didn't do so for sin/cos(f) yet because assembler implementations use
them directly, and renaming functions shared between the main libm
and the machine specific "overlay" might raise binary compatibility
issues.
 1.128 30-May-2007  tls Move FORTIFY_SOURCE implementation from the somewhat ill-named "libssp"
(what other systems keep in libssp, we already have in libc) into libc
to match what other systems with FORTIFY_SOURCE do. Goodbye, libssp
dependency in libraries and executables. Discussed with christos and
mrg; Christos will merge the headers to get us the rest of the way to a
FORTIFY_SOURCE implementation that works as others' code expects.
 1.127 30-Apr-2007  rmind Import of POSIX Asynchronous I/O.
Seems to be quite stable. Some work still left to do.

Please note, that syscalls are not yet MP-safe, because
of the file and vnode subsystems.

Reviewed by: <tech-kern>, <ad>
 1.126 09-Feb-2007  ad Sync with changes introduced by merging the newlock2 branch.
 1.125 30-Oct-2006  christos branches: 1.125.2; 1.125.4;
kill crypto/rmd160.h and crypto/sha2.h, and instead make symlinks to
/usr/include from /usr/include/sys. This makes all the one way hash
header handling identical.
 1.124 02-Jun-2006  mrg remove support for building (with) GCC 2.95. also:
- always install <stdbool.h>
- don't generate a fake one for vax / gettext.
 1.123 27-Apr-2006  thorpej Install proplib include files.
 1.122 07-Apr-2006  mrg retire HAVE_GCC3/HAVE_GCC4 and introduce HAVE_GCC that is set to 2, 3 or 4.
 1.121 30-Dec-2005  agc Add Todd Miller's ftw(3) and nftw(3) file-tree walking functionality,
from OpenBSD.

Bump libc minor to 136.
 1.120 03-Apr-2005  christos Add FreeBSD's strfmon(3). From Rui Paulo. No bump this time. Take advantage
of the getpwent_r bump.
 1.119 14-Dec-2004  nathanw Nuke threadlib.h. Library defensive threading is now provided through the
normal pthread.h interface.
Move stubs for libc back into a libc-internal header.
 1.118 13-Sep-2004  thorpej DCE 1.1 RPC compatible UUID routines for libc, adapted from FreeBSD.
Encode/decode to big/little endian binary blob routines adapted from
kernel.

PR 23470.
 1.117 13-Jul-2004  seb Add wordexp(3). The wordexp function performs shell-style word expansions.
This implementation is wrapper around the undocumented wordexp sh(1)
built-in command.

From FreeBSD.
Provided in PR lib/26123.
Approved by kleink@.
 1.116 21-May-2004  christos install new files.
 1.115 14-Oct-2003  tron Replace symbolic link "/usr/include/varargs.h" (pointing to
"/usr/include/machine/varargs.h") by a stub include file which will
emit an error if GCC 3.3 or newer is used and include "machine/varargs.h"
otherwise.

Based on a suggestion by Richard Earnshaw. This fixes PR toolchain/22888
by myself.
 1.114 01-Oct-2003  christos make some files symlinks from sys.
 1.113 09-Sep-2003  itojun add randomid(3).
 1.112 27-Aug-2003  mrg introduce an additional switch to enable building GCC3 instead of GCC2:
HAVE_GCC3. if this is set, we also set USE_TOOLS_TOOLCHAIN=no. change
the definition of the former to be restricted to whether tools/toolchain
is used or not.
 1.111 26-Jul-2003  mrg install stdbool.h if gcc3
 1.110 27-Jun-2003  tshiozak Citrus iconv support(4)
add iconv external I/F (iconv.h - iconv_open()/iconv()/iconv_close()) and
iconv(1) utility.
TODO:
- bump libc minor.
- add iconv data files.
- create manpages: iconv_open(3)/iconv(3)/iconv_close(3)/iconv(1)/
mkesdb(1)/mkcsmapper(1).
 1.109 22-Mar-2003  jdolecek install mntopts.h
 1.108 20-Jan-2003  christos add support for p1003.1b semaphores. From FreeBSD
 1.107 19-Jan-2003  thorpej Expose libc's thread stubs, which get magically turned into real pthread
calls when the pthread library is linked in. Simplifies making other
libraries (such as X's) thread-safe.
 1.106 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.105 18-Sep-2002  lukem minor makefile delint
 1.104 31-Mar-2002  bjh21 split /usr/include/sys/sha1.h and /usr/include/sha1.h completely.
future direction: nuke /usr/include/sys/sha1.h, it shouldn't be there as
we don't provide libkern to userland.

This mirrors the same change for md5.h made by itojun on 2000/12/11.
 1.103 22-Mar-2002  thorpej Split the notion of building Hesiod, Kerberos, S/key, and YP
infrastructure and using that infrastructure in programs.

* MKHESIOD, MKKERBEROS, MKSKEY, and MKYP control building
of the infratsructure (libraries, support programs, etc.)

* USE_HESIOD, USE_KERBEROS, USE_SKEY, and USE_YP control
building of support for using the corresponding API
in various libraries/programs that can use it.

As discussed on tech-toolchain.
 1.102 22-Feb-2002  christos A utmpx implementation.
 1.101 04-Feb-2002  thorpej Don't install <stdbool.h> for now. Lossage resulting from me testing
with a not-in-tree compiler.
 1.100 02-Feb-2002  thorpej ISO C / SUSv3 <stdbool.h>.
 1.99 12-Dec-2001  tv MKfoo=no -> NOfoo=
 1.98 17-Jul-2001  thorpej A <sched.h> file, which provides the clone(2) prototypes, in order
to be compatible with Linux.
 1.97 28-Apr-2001  kleink * Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.96 19-Mar-2001  atatat Add md2 routines to libc.
 1.95 17-Feb-2001  ragge branches: 1.95.2;
Don't handle ieeefp.h on vax.
 1.94 21-Dec-2000  itojun have dummy wctype.h and isw*/tow*. part of libc minor 68 -> 69 crank.
equivalent to is*/to* at this moment. we'll put wchar_t code in the
near future.
 1.93 11-Dec-2000  itojun split /usr/include/sys/md5.h and /usr/include/md5.h completely.
future direction: nuke /usr/include/sys/md5.h, it shouldn't be there as
we don't provide libkern to userland.
 1.92 05-Jul-2000  ad Pull in RIPEMD-160 functions from OpenBSD - this has the same API as our MD4,
MD5 and SHA1 stuff.
 1.91 20-Jun-2000  thorpej branches: 1.91.2;
Merge a bunch of things from crypto-us and crypto-intl into basesrc,
adding support for Heimdal/KTH Kerberos where easy to do so. Eliminate
bsd.crypto.mk.

There is still a bunch more work to do, but crypto is now more-or-less
fully merged into the base NetBSD distribution.
 1.90 03-Jun-2000  fvdl Use a seperate Makefile in the rpc/ subdir. Needed because it generates
a file (rpcb_prot.h).
 1.89 03-Jun-2000  fvdl Add missed include files.
 1.88 03-Jun-2000  fvdl Move rpcb_prot.x to here from libc/rpc.
 1.87 02-Jun-2000  fvdl Fix omission in previous.
 1.86 02-Jun-2000  fvdl New headers for the new RPC code (based on TI-RPC from Sun).
 1.85 20-Apr-2000  kleink branches: 1.85.2;
* Move <wchar.h> from libcurses to include (for the missing functionality
is to be provided by libc).
* Define wint_t and size_t in <wchar.h> as well.
 1.84 01-Apr-2000  christos Add getopt.h and collect all the getopt related stuff here.
Make unistd.h include <getopt.h> to get the getopt stuff.
This adds support for getopt_long from Dieter Baron and Thomas Klausner.
 1.83 23-Feb-2000  itojun add getifaddrs(3) from bsdi4, as mentioned in tech-net (in SIOCGIFCONF
related thread).
this will save future apps from complexity of SIOCGIFCONF.

getifaddrs(3) does not use SIOCGIFCONF internally, it uses sysctl.
 1.82 12-Jan-2000  mjl Add necessary support routines for login.conf.
 1.81 10-Jan-2000  kleink Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
std C headers including it, and a kernel module written in C++ would benfit
as well.
 1.80 22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.79 13-Sep-1999  kleink Add an XSH5 ulimit()/<ulimit.h> implementation.
 1.78 12-Sep-1999  kleink Add an XSH5 fmtmsg() implementation.
 1.77 20-Jul-1999  mrg optionally include CRYPTOPATH Makefile.frag files.
 1.76 12-Jul-1999  thorpej Use bsd.crypto.mk.
 1.75 19-Mar-1999  thorpej Move the link.h files for the different shlib formats via repository copy,
and rename them to match the executable format. Introduce a new link.h
file which automatically picks the correct header based on the target of
the toolchain.
 1.74 13-Feb-1999  lukem convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.73 15-Jan-1999  lukem merge nsswitch into main branch
 1.72 12-Jan-1999  kleink Separate the userland and libsa errno declarations from <sys/errno.h> into
their canonical places.
 1.71 02-Feb-1998  perry merge lite-2
 1.70 02-Nov-1997  kleink Add <libgen.h> header, from XPG4.2.
 1.69 30-Apr-1997  thorpej branches: 1.69.2;
Move md5.h to <sys/md5.h> so that it may be included by the kernel.
A symlink is used to preserve <md5.h> compatibility.
 1.68 27-Mar-1997  mycroft Install files via INCS, and GC the bogus permission fixing hack.
 1.67 30-Jan-1997  thorpej Install md4.h and md5.h
 1.66 17-Jan-1997  lukem A stringlist implementation (previously ``private'' to libc netgroup code,
but christos ok-ed making public as it's useful)
 1.65 27-Dec-1996  pk link.h no longer liver here
 1.64 18-Dec-1996  cgd install dlfcn.h on the Alpha, since the Alpha (with the ELF shared library
tools) provides the dl*() interfaces. the only remaining special-case header
is the a.out link.h, which should really be installed by the dynamic linker.
 1.63 18-Oct-1996  thorpej branches: 1.63.2;
Use ${INSTALL}.
 1.62 29-Sep-1996  mrg install sys headers from sys/Makefile.
 1.61 07-Sep-1996  mycroft Make a symlink for poll.h.
 1.60 09-Aug-1996  jtc install rmt.h
 1.59 15-May-1996  jtc Added new header files for functions in libutil.
Added macro for master passwd lock file.
From Greg Hudson <ghudson@MIT.EDU>.
 1.58 10-May-1996  cgd don't install dlfcn.h or link.h on the Alpha, because they make no
sense for that architecture. (It doesn't have dynamic linking or
shared libraries.)
 1.57 25-Apr-1996  jtc Use 'includes' instead of 'install' targets to install headers
 1.56 05-Feb-1996  jtc Add cpio.h, tar.h, and re_comp.h headers for POSIX & XPG4 conformance
 1.55 05-Jun-1995  pk Add dlfcn.h and alphabetize.
 1.54 16-Apr-1995  mycroft Follow symlinks when copying .h files. From Greg Hudson.
 1.53 07-Apr-1995  jtc New header file <ieeefp.h>, which provides a API for getting and setting
IEEE rounding mode, exception enable flags, and exception sticky flags.
 1.52 17-Feb-1995  jtc For Normative Addendum 1.
We have this cr*p because no one would sa "no" to the danes.
 1.51 15-Jan-1995  jtc fix tipo
 1.50 12-Jan-1995  jtc Use and .
 1.49 03-Dec-1994  christos Add netgroup.h
 1.48 26-Oct-1994  cgd new RCS ID format.
 1.47 15-Oct-1994  cgd make <stdarg.h> a symlink, and clean up ports' stdarg.h and varargs.h files.
 1.46 29-Aug-1994  mycroft branches: 1.46.2;
Simplify copying of sys include files.
 1.45 21-Jul-1994  cgd get permissions right on installed directories
 1.44 08-Jul-1994  jtc Use pax instead of two tar's to install ${MACHINE} and ${MACHINE_ARCH}
header files. It's faster, because the file data doesn't have to be
passed through a pipe; and it's cleaner, because pax's rich set of
features allows us to copy the files without changing directories, etc.
 1.43 22-Jun-1994  mycroft branches: 1.43.2;
Fix the install for real. Note this uses pax(1).
 1.42 22-Jun-1994  cgd add bm header, from Bostic
 1.41 21-Jun-1994  jtc Added langinfo.h header for nl_langinfo() function
 1.40 12-Jun-1994  cgd make install work for copies, but hack it to work for symlinks
 1.39 29-May-1994  jtc Added nl_types.h for message catalog functions
 1.38 16-May-1994  cgd oops
 1.37 16-May-1994  cgd update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those. Kill varargs.h, because it can simply
be a link to the machine-dependent version.
 1.36 11-May-1994  cgd user-land signal include file
 1.35 31-Mar-1994  cgd don't use MACHINE_ARCH if it's dir doesn't exist...
 1.34 10-Feb-1994  cgd clean things up some
 1.33 10-Feb-1994  cgd don't hide install -d, and make owner/group correct
 1.32 12-Jan-1994  cgd regexp.h should still be here, for things needing the compat lib.
 1.31 08-Jan-1994  cgd fix SYS_INCLUDE definition, and explicitly include bsd.own.mk.
minor cleanup, and add support for creating and/or symlinking
/usr/include/${MACHINE_ARCH} as necessary.
 1.30 22-Dec-1993  cgd add 'dev' to the list of LDIRS
 1.29 12-Nov-1993  jtc Install regex.h header.
 1.28 21-Oct-1993  jtc Added X/Open 1170's <search.h> header --- it only declares bsearch, insque,
and remque at this time. The remainder of the functions will be added as
time allows.
 1.27 17-Oct-1993  pk Moved <link.h> here from usr.bin/ld as it is needed by other modules
and utilities (eg. crt0, libc, nm).
 1.26 09-Oct-1993  cgd install the 2 includes in ./rpcsvc, too.
 1.25 08-Oct-1993  cgd move rpcsvc files and include generation into src/lib/librpcsvc
 1.24 01-Oct-1993  jtc Use `:', rather than `.' to separate user and group in chown commands
in case we ever decide to remove the support for the (obsolete) `.'
separator.
 1.23 16-Aug-1993  mycroft Oops. `copies' was getting done before making /usr/include.
 1.22 15-Aug-1993  mycroft There would have to be just one Makefile in the entire tree which referenced
_PROGSUBDIR. GRRRRRR.
 1.21 01-Aug-1993  mycroft Add RCS identifiers.
 1.20 10-Jul-1993  brezak Allow SYS_INCLUDES={copies,symlinks} choice in bsd.own.mk.
 1.19 16-Jun-1993  mycroft Don't forget to install fnmatch.h.
 1.18 07-Jun-1993  deraadt install incluide files mode 644
 1.17 26-May-1993  deraadt install /usr/include/malloc.h!
 1.16 18-May-1993  cgd change for 'arch'
 1.15 06-May-1993  proven ftp put doesn't cleanly truncate and overwrite a file.
 1.14 06-May-1993  proven rpc directory installs now.
 1.13 05-May-1993  proven Set permissions and ownership all at once. (No more directories mode 0777)
 1.12 01-May-1993  mycroft Don't forget to install err.h.
 1.11 28-Apr-1993  cgd changed sys.386bsd to sys
 1.10 26-Apr-1993  mycroft Install mpool.h.
 1.9 09-Apr-1993  cgd added netccitt, netiso, and netns support, from (currently
alpha) patch 126
 1.8 09-Apr-1993  cgd make sure directory to install stuff exists before installing
 1.7 04-Apr-1993  cgd now that we have subdirs, need to do them on install, too...
 1.6 04-Apr-1993  cgd updated for addition of rpcsvc
 1.5 31-Mar-1993  cgd install of include subdirs from sys.386bsd now done relative to current
dir, rather than from /sys.
 1.4 23-Mar-1993  cgd marked dirs netimp, netiso, and netns as "missing" from LDIRS
 1.3 22-Mar-1993  cgd added "vm" to list of subdirs of /usr/include, and made a minor
cleanup so /usr/include/machine is handled right w/different types
of installs (links vs. copies).
 1.2 22-Mar-1993  cgd made install copy, rather than symlink includes
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.43.2.1 21-Jul-1994  cgd from trunk
 1.46.2.2 29-Aug-1994  mycroft Simplify copying of sys include files.
 1.46.2.1 29-Aug-1994  mycroft file Makefile was added on branch netbsd-1-0 on 1994-08-29 04:59:49 +0000
 1.63.2.1 06-Nov-1996  lukem initial nsswitch implementation
 1.69.2.2 31-Oct-1998  lukem update to current, fix copyrights, reimplement MAXDNSLUS (for now)
 1.69.2.1 23-May-1997  lukem Add necessary files for nsswitch, take 2
Remove support for "lookup" methods in resolv.conf
Remove prototypes for _ng_sl_*; these were replaced a long time ago
 1.85.2.2 23-Jun-2000  minoura Import of most recent XPG4DL dated 2000.06.23.
 1.85.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.91.2.2 20-Jun-2000  thorpej Merge a bunch of things from crypto-us and crypto-intl into basesrc,
adding support for Heimdal/KTH Kerberos where easy to do so. Eliminate
bsd.crypto.mk.

There is still a bunch more work to do, but crypto is now more-or-less
fully merged into the base NetBSD distribution.
 1.91.2.1 20-Jun-2000  thorpej file Makefile was added on branch netbsd-1-5 on 2000-06-20 06:00:33 +0000
 1.95.2.12 20-Sep-2002  thorpej Sync with HEAD.
 1.95.2.11 25-Apr-2002  nathanw Catch up to -current.
 1.95.2.10 22-Mar-2002  nathanw Catch up to -current.
 1.95.2.9 12-Mar-2002  nathanw Restore ucontext.h (missed in last merge; thanks to nick for pointing
it out).
Clean up wrap slightly.
 1.95.2.8 11-Mar-2002  nathanw Catch up to -current.
 1.95.2.7 23-Feb-2002  gmcgarry It's back with the pthreads bits.
 1.95.2.6 23-Feb-2002  gmcgarry sched.h is now part of the pthread library
 1.95.2.5 28-Jan-2002  nathanw Catch up to -current.
 1.95.2.4 14-Jan-2002  nathanw Catch up to -current.
 1.95.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.95.2.2 08-Apr-2001  nathanw Merge trunk onto branch.
 1.95.2.1 05-Mar-2001  nathanw User-level support for LWPs and scheduler activations.
SVR4-style ucontext code by Klaus Klein.
 1.125.4.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.125.2.1 22-Jul-2007  liamjfoy Pull up to netbsd-4 (requested by christos in ticket #773):

Move libssp to libc.
 1.129.2.1 06-Nov-2007  matt sync with HEAD
 1.130.8.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.130.6.1 04-Jun-2008  yamt sync with head
 1.131.16.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.131.16.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.131.8.2 28-May-2008  ad /usr/include/atomic.h, for Solaris source compat.
 1.131.8.1 28-May-2008  ad file Makefile was added on branch christos-time_t on 2008-05-28 12:28:13 +0000
 1.136.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.136.2.1 17-Apr-2012  yamt sync with head
 1.139.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.141.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.143.6.1 04-Dec-2017  snj Pull up following revision(s) (requested by maya in ticket #416):
distrib/sets/lists/comp/mi: revision 1.2152
include/Makefile: revision 1.144
include/endian.h: revision 1.1
Add endian.h header. Simply includes sys/endian.h
<endian.h> has been accepted by the austin group.
 1.144.4.1 10-Jun-2019  christos Sync with HEAD
 1.146.12.1 02-Aug-2025  perseant Sync with HEAD
 1.146.10.1 14-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #976):

lib/libc/locale/c32rtomb.3: revision 1.10
lib/libc/locale/c32rtomb.3: revision 1.9
lib/libc/locale/c32rtomb.3: revision 1.11
tests/lib/libc/locale/t_mbrtoc32.c: revision 1.1
distrib/sets/lists/base/shl.mi: revision 1.988
lib/libc/include/namespace.h: revision 1.204
lib/libc/include/namespace.h: revision 1.205
lib/libc/locale/mbrtoc16.3: revision 1.1
lib/libc/locale/mbrtoc16.c: revision 1.1
lib/libc/locale/mbrtoc16.3: revision 1.2
lib/libc/locale/mbrtoc16.c: revision 1.2
lib/libc/locale/mbrtoc16.3: revision 1.3
lib/libc/locale/mbrtoc16.c: revision 1.3
lib/libc/locale/mbrtoc32.3: revision 1.1
lib/libc/locale/mbrtoc32.c: revision 1.1
tests/lib/libc/locale/t_c16rtomb.c: revision 1.1
lib/libc/locale/mbrtoc32.c: revision 1.2
lib/libc/locale/mbrtoc16.3: revision 1.4
lib/libc/locale/mbrtoc16.c: revision 1.4
lib/libc/locale/mbrtoc32.3: revision 1.2
tests/lib/libc/locale/t_c16rtomb.c: revision 1.2
lib/libc/locale/mbrtoc32.c: revision 1.3
lib/libc/locale/mbrtoc16.3: revision 1.5
lib/libc/locale/mbrtoc16.c: revision 1.5
lib/libc/locale/mbrtoc32.3: revision 1.3
tests/lib/libc/locale/t_c16rtomb.c: revision 1.3
lib/libc/locale/mbrtoc32.c: revision 1.4
lib/libc/locale/mbrtoc16.3: revision 1.6
lib/libc/locale/mbrtoc16.c: revision 1.6
lib/libc/locale/mbrtoc32.3: revision 1.4
tests/lib/libc/locale/t_c16rtomb.c: revision 1.4
lib/libc/locale/mbrtoc32.c: revision 1.5
lib/libc/locale/mbrtoc16.3: revision 1.7
lib/libc/locale/mbrtoc16.c: revision 1.7
lib/libc/locale/mbrtoc32.3: revision 1.5
tests/lib/libc/locale/t_c16rtomb.c: revision 1.5
lib/libc/locale/mbrtoc32.c: revision 1.6
lib/libc/locale/mbrtoc16.3: revision 1.8
lib/libc/locale/mbrtoc32.3: revision 1.6
tests/lib/libc/locale/t_c16rtomb.c: revision 1.6
lib/libc/locale/mbrtoc32.c: revision 1.7
lib/libc/locale/mbrtoc16.3: revision 1.9
lib/libc/locale/mbrtoc32.3: revision 1.7
lib/libc/locale/mbrtoc32.c: revision 1.8
lib/libc/locale/mbrtoc32.3: revision 1.8
lib/libc/locale/mbrtoc32.c: revision 1.9
distrib/sets/lists/comp/mi: revision 1.2468
lib/libc/locale/mbrtoc32.3: revision 1.9
distrib/sets/lists/comp/mi: revision 1.2469
lib/libc/locale/c32rtomb.h: revision 1.1
lib/libc/locale/c32rtomb.h: revision 1.2
include/Makefile: revision 1.147
share/man/man3/uchar.3: revision 1.1
share/man/man3/uchar.3: revision 1.2
tests/lib/libc/locale/t_c32rtomb.c: revision 1.1
distrib/sets/lists/comp/mi: revision 1.2470
lib/libc/locale/c16rtomb.3: revision 1.1
lib/libc/locale/c16rtomb.c: revision 1.1
lib/libc/locale/c16rtomb.3: revision 1.2
lib/libc/locale/c16rtomb.c: revision 1.2
lib/libc/locale/c16rtomb.3: revision 1.3
lib/libc/locale/c16rtomb.c: revision 1.3
lib/libc/locale/c16rtomb.3: revision 1.4
lib/libc/locale/c16rtomb.c: revision 1.4
lib/libc/locale/c16rtomb.3: revision 1.5
lib/libc/locale/c16rtomb.c: revision 1.5
lib/libc/locale/c16rtomb.3: revision 1.6
lib/libc/locale/c16rtomb.c: revision 1.6
lib/libc/locale/c16rtomb.3: revision 1.7
lib/libc/locale/c16rtomb.c: revision 1.7
lib/libc/locale/c16rtomb.3: revision 1.8
lib/libc/locale/c16rtomb.3: revision 1.9
distrib/sets/lists/tests/mi: revision 1.1330
distrib/sets/lists/tests/mi: revision 1.1331
distrib/sets/lists/tests/mi: revision 1.1332
tests/lib/libc/locale/t_uchar.c: revision 1.1
tests/lib/libc/locale/t_uchar.c: revision 1.2
tests/lib/libc/locale/t_uchar.c: revision 1.3
tests/lib/libc/locale/t_mbrtoc16.c: revision 1.1
tests/lib/libc/locale/t_mbrtoc16.c: revision 1.2
tests/lib/libc/locale/t_mbrtoc16.c: revision 1.3
include/uchar.h: revision 1.1
include/uchar.h: revision 1.2
include/uchar.h: revision 1.3
include/uchar.h: revision 1.4
include/uchar.h: revision 1.5
tests/lib/libc/locale/t_c8rtomb.c: revision 1.1
include/uchar.h: revision 1.6
tests/lib/libc/locale/t_c8rtomb.c: revision 1.2
tests/lib/libc/locale/t_c8rtomb.c: revision 1.3
tests/lib/libc/locale/t_c8rtomb.c: revision 1.4
share/man/man3/Makefile: revision 1.93
tests/lib/libc/locale/t_c8rtomb.c: revision 1.5
tests/lib/libc/locale/t_c8rtomb.c: revision 1.6
tests/lib/libc/locale/t_c8rtomb.c: revision 1.7
lib/libc/shlib_version: revision 1.297
lib/libc/locale/c16rtomb.3: revision 1.10
lib/libc/locale/c16rtomb.3: revision 1.11
tests/lib/libc/locale/t_mbrtoc8.c: revision 1.1
tests/lib/libc/locale/t_mbrtoc8.c: revision 1.2
tests/lib/libc/locale/t_mbrtoc8.c: revision 1.3
lib/libc/locale/mbrtoc16.3: revision 1.10
tests/lib/libc/locale/Makefile: revision 1.15
tests/lib/libc/locale/Makefile: revision 1.16
tests/lib/libc/locale/Makefile: revision 1.17
tests/lib/libc/locale/Makefile: revision 1.18
distrib/sets/lists/debug/mi: revision 1.442
distrib/sets/lists/debug/mi: revision 1.443
distrib/sets/lists/debug/mi: revision 1.444
lib/libc/locale/c8rtomb.3: revision 1.1
lib/libc/locale/c8rtomb.c: revision 1.1
lib/libc/locale/c8rtomb.3: revision 1.2
lib/libc/locale/c8rtomb.c: revision 1.2
lib/libc/locale/c8rtomb.3: revision 1.3
lib/libc/locale/c8rtomb.c: revision 1.3
lib/libc/locale/c8rtomb.3: revision 1.4
lib/libc/locale/c8rtomb.c: revision 1.4
lib/libc/locale/c8rtomb.3: revision 1.5
lib/libc/locale/c8rtomb.c: revision 1.5
lib/libc/locale/c8rtomb.3: revision 1.6
lib/libc/locale/c8rtomb.c: revision 1.6
lib/libc/locale/c8rtomb.3: revision 1.7
lib/libc/locale/c8rtomb.3: revision 1.8
lib/libc/locale/c8rtomb.3: revision 1.9
lib/libc/locale/mbrtoc32.h: revision 1.1
lib/libc/locale/mbrtoc32.h: revision 1.2
lib/libc/locale/mbrtoc8.c: revision 1.1
lib/libc/locale/mbrtoc8.3: revision 1.1
lib/libc/locale/mbrtoc8.c: revision 1.2
lib/libc/locale/mbrtoc8.3: revision 1.2
lib/libc/locale/mbrtoc8.c: revision 1.3
lib/libc/locale/mbrtoc8.3: revision 1.3
lib/libc/locale/mbrtoc8.c: revision 1.4
lib/libc/locale/mbrtoc8.3: revision 1.4
lib/libc/locale/Makefile.inc: revision 1.66
lib/libc/locale/mbrtoc8.c: revision 1.5
lib/libc/locale/mbrtoc8.3: revision 1.5
lib/libc/locale/Makefile.inc: revision 1.67
lib/libc/locale/mbrtoc8.c: revision 1.6
lib/libc/locale/mbrtoc8.3: revision 1.6
lib/libc/locale/mbrtoc8.c: revision 1.7
lib/libc/locale/mbrtoc8.3: revision 1.7
lib/libc/locale/mbrtoc8.c: revision 1.8
lib/libc/locale/c32rtomb.3: revision 1.1
lib/libc/locale/c32rtomb.c: revision 1.1
lib/libc/locale/c32rtomb.3: revision 1.2
lib/libc/locale/c32rtomb.c: revision 1.2
lib/libc/locale/c32rtomb.3: revision 1.3
lib/libc/locale/c32rtomb.c: revision 1.3
lib/libc/locale/c32rtomb.3: revision 1.4
lib/libc/locale/c32rtomb.c: revision 1.4
lib/libc/locale/c32rtomb.3: revision 1.5
lib/libc/locale/c32rtomb.c: revision 1.5
lib/libc/locale/c32rtomb.3: revision 1.6
lib/libc/locale/c32rtomb.c: revision 1.6
lib/libc/locale/c32rtomb.3: revision 1.7
lib/libc/locale/c32rtomb.3: revision 1.8

(all via patch)


tests/lib/libc/locale/Makefile: Sort.
No functional change intended.
Preparation for PR lib/52374.

uchar.h: New header file for C11 (and C++11) compliance.

Implementation of the new functions mbrtoc16, c16rtomb, mbrtoc32, and
c32rtomb to come later. Updates for C23 to come later.
PR lib/52374: <uchar.h> missing

libc: New C11 functions mbrtoc16, mbrtoc32, c16rtomb, c32rtomb.

The mbrtoc16/32 functions read mulitbyte strings according to the
current locale into UTF-16/32 code unit sequences; the c16/32rtomb
functions write UTF-16/32 code unit sequences into multibyte strings
according to the current locale. The `r' means restartable: they
work incrementally and pick up where they left off.

NOTE: This bumps the libc minor version, since it adds new symbols.

PR lib/52374: <uchar.h> missing
mbrtoc16(3), mbrtoc32(3): Fix \n in man page examples.
Need to write \en to pacify roff.
PR lib/52374: <uchar.h> missing

c16rtomb(3), c32rtomb(3): Fix more \n in man pages.
Also, tighten an assertion: we left room for a NUL byte at the end.
PR lib/52374: <uchar.h> missing

libc: Use the more idiomatic alignof from stdalign.h.
No functional change intended.
PR lib/52374: <uchar.h> missing

mbrtoc16(3): Simplify surrogate state test.

Turn the finer-grained test into an assertion.
No semantic change intended: we are supposed to control this state,
and we always arrange it this way. (But in principle this could
change the behaviour of buggy programs that violate the mbstate_t
abstraction.)
PR lib/52374: <uchar.h> missing

libc: New functions c8rtomb(3) and mbrtoc8(3).

New in C23, for converting from UTF-8 to locale-dependent multibyte
sequences (c8rtomb) or vice versa (mbrtoc8), along with the new type
char8_t.

Conditional on either:
- _NETBSD_SOURCE
- _ISOC23_SOURCE
- __STDC_VERSION__ >= 202311L
(Riding the libc minor bump from this morning for the UTF-16/UTF-32
versions from C11.)

PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb
libc: c32rtomb and mbrtoc32 are used internally, so weak-alias them.
PR lib/52374: <uchar.h> missing
c8rtomb(3), mbrtoc8(3): Use namespace.h to get private aliases.

This way applications defining the symbols c32rtomb or mbrtoc32 won't
clobber our private definitions, which are slightly more constrained
about their use of mbstate_t than is obvious from the interface
contract.

PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb
mbrtoc16(3), mbrtoc32(3): brush up markup

Split long .Fn lines into Fo/Fa/Fc. Dont indent the list of return
values. Don't use artisanal -width.

Untabify code examples - indented literal displays don't have correct
tab stops consistent with tab stops in the fixed font code, so the
lines end up misaligned in the PostScript output.

c16rtomb(3), c32rtomb(3): brush up markup

mbrtoc16(3), mbrtoc32(3): Simplify return value language.
Also expand BMP only once.
PR lib/52374: <uchar.h> missing

mbrtoc16(3), mbrtoc32(3): No state overlap with mbrtoc8 or c8rtomb.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc32(3): Clarify control flow.
No need for another goto here; let's keep it clearly structured with
a single `out' label.
No functional change intended.
PR lib/52374: <uchar.h> missing

c8rtomb(3), mbrtoc8(3): brush up markup

mbrtoc8(3): Simplify return value language.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

c16rtomb(3), c32rtomb(3): Specify what happens if ps is null.
PR lib/52374: <uchar.h> missing

c8rtomb(3): Specify what happens when ps is null.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

c16rtomb(3), c32rtomb(3): No state overlap with mbrtoc8 or c8rtomb.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc16(3), mbrtoc32(3): Work on deturgidifying prose.
Still maybe not great but at least there's less jargon in most of the
text, without really losing any content.
PR lib/52374: <uchar.h> missing

mbrtoc8(3): Work on deturgidifying prose.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc16(3), mbrtoc32(3): Restore word accidentally removed.
PR lib/52374: <uchar.h> missing

mbrtoc8(3): Restore word accidentally removed.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

c8rtomb(3): Fix possible error descriptions.
The argument c8 can't be a surrogate code point itself (they're in
the range [0xd800,0xdfff], beyond 8-bit values), but the bits of a
surrogate code point could be forced into the UTF-8 format, which is
also invalid.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

c16rtomb(3), c32rtomb(3): Attempt a deturgidification pass.
Limit the jargon around surrogates.
PR lib/52374: <uchar.h> missing

c8rtomb(3): Clarify prose and fix example in caveat.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb
c16rtomb(3), c32rtomb(3), mbrtoc16(3), mbrtoc32(3): xref c8 versions.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc16(3): Clarify how many bytes are consumed in special cases.
Fix overlap in RETURN VALUES section.
PR lib/52374: <uchar.h> missing

mbrtoc8(3): Clarify how many bytes are consumed in special cases.
Fix overlap in RETURN VALUES section.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

pass lint, XXX see lint bug.

libc: Add _l variants of the cNrtomb and mbrtocN functions.
These accept an explicit locale parameter, rather than using the
current locale.
Visible under _NETBSD_SOURCE, not exposed otherwise.
NOTE: This adds libc symbols. Riding the libc minor bump for the
non-_l variants of these from two days ago -- hope that's not pushing
it too far.
PR lib/58613: c*rtomb, mbrtoc* should have locale-parametric _l
variants

c8rtomb(3), c16rtomb(3): Add tests for incomplete NUL termination.
PR lib/58615: incomplete c8rtomb, c16rtomb handles NUL termination
wrong

c8rtomb(3), c16rtomb(3): Fix NUL handling.
PR lib/58615: incomplete c8rtomb, c16rtomb handles NUL termination
wrong

c8rtomb(3), c16rtomb(3), c32rtomb(3): Test stateful shift sequences.
PR lib/58612: c8rtomb/c16rtomb/c32rtomb yield suboptimal shift
sequences

c8rtomb(3): Fix digit error in shift sequence test.
PR lib/58612: c8rtomb/c16rtomb/c32rtomb yield suboptimal shift
sequences

c8rtomb(3): Nix __CTASSERT after case label.
I put this in to make it (machine-verifiably) clear that zeroing the
state is the same as returning to the initial conversion state, as
the standard requires, but this is causing build trouble (and will
likely cause more trouble if pulled up) because some definitions of
__CTASSERT make a declaration which is forbidden after a label, so
let's remove it.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc8(3): Fix pasto in comment at top.
No functional change intended.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc8: remove lint-specific workarounds
No binary change.

mbrtoc8: fix comments

mbrtoc16, mbrtoc32: fix comments, remove lint-specific workarounds
No binary change.
t_c8rtomb, t_c16rtomb: Simplify comment.
ESC $ B is technically rather the JIS X 0208-1983 shift sequence, but
since I don't see any way to provoke the JIS X 0208-1978 shift
sequence to come flying out of this conversion (ESC $ @), and I'm not
sure there's any difference in the interpretation, let's just say JIS
X 0208.
PR lib/58612: c8rtomb/c16rtomb/c32rtomb yield suboptimal shift
sequences

c32rtomb(3): Use conversion state to handle shift sequences.
For conversion of Unicode scalar values to coding systems requiring
shift sequences, such as ISO-2022-JP, _citrus_iconv_convert will
always produce:
1. a shift sequence from the initial state to some nondefault state,
like from US-ASCII to JIS X 0208
2. the encoding of the desired characater
3. a shift sequence restoring the initial state
This is unnecessary if the output is already in the state needed to
encoded the desired character. For example, this method produces
seven bytes to encode each YEN SIGN in ISO-2022-JP -- and fourteen,
to encode two consecutive ones -- even though the shift sequence is
only three bytes long and once shifted YEN SIGN takes only one byte.
Instead, convert the Unicode scalar value to a locale-dependent wide
character and encode that, by composing
- _citrus_iconv_convert
=> gives us a multibyte encoding of the character from the initial
state (and restoring the initial state afterward)
- mbrtowc with initial conversion state
=> gives us the single wide character representation
XXX If combining characters are possible here, this may fail.
- wcrtomb with caller's conversion tsate
=> gives us a state-dependent multibyte encoding of the character
XXX Is there a cheaper way to convert from Unicode scalar value to
locale-dependent wide character? It is not obvious to me from the
largely undocumented Citrus machinery, but it would obviously be
better than this somewhat circuitous Rube Goldberg contraption of
chained multibyte APIs.
PR lib/58612: c8rtomb/c16rtomb/c32rtomb yield suboptimal shift
sequences

mbrtoc8(3), mbrtoc16(3): Test consuming shift sequences with state.
This has the side effect of testing mbrtoc32(3) because they are both
defined in terms of it.
PR lib/58618: mbrtocN(3) fails to keep shift state

c8rtomb(3), c16rtomb(3), c32rtomb(3): Suggest MB_LEN_MAX in example.
This way it avoids variable-length arrays, by always allocating the
maximum space that could be occupied by MB_CUR_MAX.

mbrtoc32(3): Use conversion state to handle shift sequences.
PR lib/58618: mbrtocN(3) fails to keep shift state

mbrtoc32(3): Fix name and type of mbrtowc_l return value.
This was from `int mbtowc_l(...)' in an earlier draft and I didn't
update it to size_t when I changed the draft to mbrtowc_l. Caught by
lint.
`mb_len' avoids (harmless) clash with standard C function mblen(3).
PR lib/58618: mbrtocN(3) fails to keep shift state

c32rtomb(3): Fix type of wcrtomb_l return value.
This was from `int wctomb_l(...)' in an earlier draft and I didn't
update it to size_t when I changed the draft to wcrtomb_l. Caught by
lint.
`wc_len' mirrors `mb_len' in the complementary code in mbrtoc32(3) to
avoid clash with standard C function mblen(3).
PR lib/58612: c8rtomb/c16rtomb/c32rtomb yield suboptimal shift
sequences

c8rtomb(3), c16rtomb(3), c32rtomb(3): Attempt to simplify language.

c8rtomb(3), c16rtomb(3), c32rtomb(3): Fix null string output case.
This ignores c8/c16/c32, produces no output anywhere, and just resets
ps to the initial conversion state.
Also just use 0 in the example, not '\0' or L'\0'. This works for
C11, which prefers '\0' and L'\0', for and C23, which introduced the
new u8'\0', u'\0' (UTF-16), and U'\0' (UTF-32).
c16rtomb, c32rtomb, mbrtoc8: fix page numbers in comments
mbrtoc8(3), mbrtoc16(3), mbrtoc32(3): Say 0 for zero code unit.
Rather than deal with differences between C11 and C23 in notation,
'\0' vs L'\0' vs u8'\0' vs u'\0' vs U'\0'.
uchar.h: Include <sys/featuretest.h> before testing _*_SOURCE.
PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
PR lib/52374: <uchar.h> missing

uchar.h: Need <sys/cdefs.h> for __restrict.
PR lib/52374: <uchar.h> missing

uchar.h: Simplify __cpp_char8_t and __cplusplus conditionals.
No functional change intended.
PR lib/52374: <uchar.h> missing

tests/lib/libc/locale/t_uchar: Test for char8_t, mbrtoc8, c8rtomb.
PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
PR lib/52374: <uchar.h> missing

tests/t_uchar: fix copy-and-paste typo
 1.20 16-Aug-2009  pgoyette Repair more fallout from the exec_aout.h change.

No guarantee that these are the "right" things to do, but they do allow
building of port-amd64 again.
 1.19 10-Dec-2003  agc Modify the licences of code written by Theo De Raadt from a 4-clause
to a 2-clause licence (retaining UCB clauses (1) and (2)), per PR
22409 from Joel Baker, approved by Theo de Raadt, and ratified by
myself - the only discrepancy being the handling of the original
clause 3 in src/usr.sbin/yppoll/yppoll.c.
 1.18 13-Oct-2003  christos Remove Berkeley's advertising clause 3.
 1.17 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.16 02-Feb-1998  perry merge lite-2
 1.15 26-Oct-1994  cgd new RCS ID format.
 1.14 01-Jul-1994  deraadt macros in exec_aout.h now
 1.13 07-Apr-1994  deraadt document the magic number gibble somewhat
 1.12 12-Jan-1994  pk Make NMAGIC work again.
 1.11 11-Dec-1993  mycroft Add N_PAGSIZ(), N_TRELOFF(), and N_DRELOFF(), and N_BSSADDR(), to match
SunOS interface.
 1.10 18-Oct-1993  pk Moved __LDPGSZ and `struct relocation_info' to <machine/exec.h>.
 1.9 02-Oct-1993  pk Added fields to struct relocation_info to accommodate PIC code and
run-time relocations. I've usurped all formerly reserved bits in the process.
 1.8 12-Sep-1993  glass sun3 has 8k pages
 1.7 01-Sep-1993  deraadt addition of the pc532 architecture
 1.6 01-Aug-1993  mycroft Add RCS identifiers.
 1.5 18-Jun-1993  cgd convert magic numbers to network byte order, and attendent changes
 1.4 17-Apr-1993  mycroft Add N_RELOFF().
 1.3 16-Apr-1993  mycroft Add QMAGIC support.
 1.2 16-Apr-1993  mycroft Add support for QMAGIC.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7 13-Jan-2009  christos fix reversed test from Tobias Nygren.
 1.6 11-Jan-2009  christos merge christos-time_t
 1.5 26-May-2008  rmind branches: 1.5.8;
Adjust and thus unify my license.
 1.4 28-Nov-2007  rmind branches: 1.4.6; 1.4.8;
Unify the license: All rights reserved.
No functional change.
 1.3 30-Jun-2007  rmind branches: 1.3.4;
Fix the C99 restrict keyword with array defintion in prototype problem.

http://mail-index.netbsd.org/tech-userlevel/2007/06/17/0004.html
Closes PR/36451.
 1.2 03-May-2007  rmind - Add linkage for C++
- KNF

Patch from <ad>, thanks!
 1.1 30-Apr-2007  rmind Import of POSIX Asynchronous I/O.
Seems to be quite stable. Some work still left to do.

Please note, that syscalls are not yet MP-safe, because
of the file and vnode subsystems.

Reviewed by: <tech-kern>, <ad>
 1.3.4.1 09-Jan-2008  matt sync with HEAD
 1.4.8.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.4.6.1 04-Jun-2008  yamt sync with head
 1.5.8.2 08-Nov-2008  christos changes for 64 bit time_t
 1.5.8.1 26-May-2008  christos file aio.h was added on branch christos-time_t on 2008-11-08 21:13:13 +0000
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 16-May-1994  cgd update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those. Kill varargs.h, because it can simply
be a link to the machine-dependent version.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.27 29-Mar-2025  riastradh assert.h: Sprinkle __predict_true.

Assertions are always supposed to be true, so this should be a good
prediction.

This matches what we have done for KASSERT in the kernel since the
year 2000.

PR lib/59231: assert.h: missing branch prediction
 1.26 12-Sep-2023  rillig branches: 1.26.2;
assert.h: remove custom macro definitions for lint mode

In lint mode, 'assert(cond)' expanded to nothing. This broke code like
sqlite that assumes 'assert(cond)' expands to an expression that can be
used as operand of the comma operator, as in 'return assert(i > 0), i'.
 1.25 17-Apr-2020  kamil Remove the static_assert() fallback for pre-C11 and pre-C++11

C++ without real static_assert() can be incompatible with the C fallback
as presented in openjdk.

A pre-C11 compiler can be picky on the implementation.
 1.24 27-May-2019  kamil As a _NETBSD_SOURCE extension define static_assert for pre-c11/c++99

Proposed on source-changes-d.
 1.23 22-May-2019  maya Limit static_assert visibility to C11.

The existing definition caused issues as GCC only provides _Static_assert
when building C11 code.
This follows the C standard: static_assert available since C11.

Fixes https://rt.perl.org/Public/Bug/Display.html?id=134023
 1.22 03-Oct-2016  kamil branches: 1.22.6; 1.22.14;
Add static_assert macro definition in <assert.h>

This declaration conforms to the C11 standard
Reference: ISO/IEC 9899:201x 7.2 Diagnostics <assert.h>

_Static_assert performs compile-time assertion checking.

According to ISO/IEC 9899:201x (draft) 7.2 Diagnostics <assert.h> defines
the static_assert macro which expands to _Static_assert. It's not
conditionalized by NDEBUG like the assert macro.

According to ISO/IEC N3242=11-0012 (C++1x) the <cassert> header shall
define only the assert macro, but not static_assert as it's already part
of the C++11 language.

Allow to define static_assert in C++ prior the C++11 standard. It might be
broken but a nonstandard C++ compiler might support C11-like _Static_assert
feature. Note that it's fatal for g++ 5.4, but it works for clang++ 3.8.1.

Approved by <joerg>.
 1.21 26-Aug-2011  joerg branches: 1.21.24;
__assert and __assert13 are dead
 1.20 02-Nov-2008  christos branches: 1.20.2;
include <sys/null.h> because _DIAGASSERT(foo == NULL) is too common and some
include it.
 1.19 17-Aug-2008  gmcgarry Define away __assert_function__ if __lint__.
 1.18 03-Feb-2005  perry branches: 1.18.26;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.17 01-Jul-2004  kleink Tidy up the namespace: lint -> __lint__.
 1.16 18-May-2004  kleink Remove _assert() again. As has been noted by Ben Harris, this had been
removed already in rev. 1.4 and was subsequently reinstated by the
Lite-2 import. Nothing uses it, and it pollutes user namespace.
 1.15 07-Aug-2003  agc branches: 1.15.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.14 05-Jun-2003  bjh21 EBENISANIDIOT: Remove a spurious '#endif' that crept in under the radar.
 1.13 05-Jun-2003  bjh21 Namespace cleanup: _assert is in the application's namespace, and thus should
only be exposed if _NETBSD_SOURCE is defined. To make life less complicated,
define _assert() in terms of assert(), since they always seem to have identical
definitions.

_assert() was removed back in 1993, but got reinstated with the 4.4Lite
import. Maybe it should go again. Nothing in the tree uses it.
 1.12 06-May-2001  kleink Employ __static_cast(); suggested by Dave Sainty in PR lib/11766.
 1.11 20-Dec-2000  christos branches: 1.11.2;
avoid multiple declarations.
 1.10 19-Dec-2000  kleink C99: Print the name of the function enclosing the assertion, if possible.
 1.9 07-Aug-2000  kleink #ifdef __STDC__ -> #if __STDC__
 1.8 15-Sep-1999  lukem if _DIAGNOSTIC is defined, define _DIAGASSERT() to call __diagassert(),
otherwise it's a no-op.
prototype __diagassert().
 1.7 14-Nov-1998  christos Define assert and _assert macros for lint when NDEBUG is present as nothing.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 16-May-1994  cgd update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those. Kill varargs.h, because it can simply
be a link to the machine-dependent version.
 1.4 07-Oct-1993  jtc Use _ASSERT_H_ guard macro so that <sys/cdefs.h> is only included once and
the __assert() helper function is declared once if <assert.h> is included
multiple times.
Don't support the _assert() macro, nothing uses it and it pollutes the
user's namespace.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 16-Jun-1993  jtc Make assert macro ansi complient.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.11.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.15.2.2 02-Jul-2004  he Pull up revision 1.17 (requested by kleink in ticket #580):
Tidy up the namespace: lint -> __lint__.
 1.15.2.1 22-May-2004  he Pull up revision 1.16 (requested by kleink in ticket #356):
Remove _assert() again. As has been noted by Ben Harris, this
had been removed already in rev. 1.4 and was subsequently reinstated
by the Lite-2 import. Nothing uses it, and it pollutes user
namespace.
 1.18.26.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.20.2.2 02-Nov-2008  christos include <sys/null.h> because _DIAGASSERT(foo == NULL) is too common and some
include it.
 1.20.2.1 02-Nov-2008  christos file assert.h was added on branch christos-time_t on 2008-11-02 14:27:45 +0000
 1.21.24.1 04-Nov-2016  pgoyette Sync with HEAD
 1.22.14.2 21-Apr-2020  martin Sync with HEAD
 1.22.14.1 10-Jun-2019  christos Sync with HEAD
 1.22.6.1 29-May-2019  martin Pull up following revision(s) (requested by maya in ticket #1275):

include/assert.h: revision 1.23

Limit static_assert visibility to C11.

The existing definition caused issues as GCC only provides _Static_assert
when building C11 code.

This follows the C standard: static_assert available since C11.

Fixes https://rt.perl.org/Public/Bug/Display.html?id=134023
 1.26.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 28-May-2008  ad branches: 1.1.2; 1.1.6; 1.1.12;
/usr/include/atomic.h, for Solaris source compat.
 1.1.12.2 28-May-2008  ad /usr/include/atomic.h, for Solaris source compat.
 1.1.12.1 28-May-2008  ad file atomic.h was added on branch christos-time_t on 2008-05-28 12:28:13 +0000
 1.1.6.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.1.6.1 28-May-2008  wrstuden file atomic.h was added on branch wrstuden-revivesa on 2008-06-23 05:02:09 +0000
 1.1.2.2 04-Jun-2008  yamt sync with head
 1.1.2.1 28-May-2008  yamt file atomic.h was added on branch yamt-pf42 on 2008-06-04 02:04:33 +0000
 1.15 12-May-2024  rillig include/bitstring.h: remove CONSTCOND comment from do-while-0 loop

Lint doesn't need this comment anymore, as there is nothing surprising
or unusual about this idiom.

sed -Ei 's,} *while *\(/\* *CONSTCOND *\*/ *0\),} while (0),' *.h
 1.14 17-Mar-2016  christos more casting fixes
 1.13 17-Mar-2016  christos appease gcc-5 |= #$@#%
 1.12 20-Nov-2015  christos add some const
 1.11 20-Nov-2015  christos keep value as an int.
 1.10 20-Nov-2015  christos update to size_t
 1.9 06-May-2010  christos lint friendly
 1.8 06-Feb-2005  perry branches: 1.8.44;
remove obsolete "register" declarations
 1.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.6 02-Feb-1998  perry merge lite-2
 1.5 14-May-1997  pk Make macros evaluate to non-compound statements (Jarle Greipsland; PR#3614)
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 22-May-1993  cgd fixed, thanks to Mike Murphy <mrm@optigfx.com>, with minor hacks by cgd
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.8.44.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.7 22-Jan-2016  dholland Needs stddef.h for size_t.
 1.6 22-Jan-2016  dholland u_char, u_int, u_long -> unsigned char, unsigned, unsigned long

This makes these headers work without _NETBSD_SOURCE.
 1.5 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 22-Jun-1994  cgd rcs id's
 1.1 22-Jun-1994  cgd add bm header, from Bostic
 1.3 11-Dec-2013  joerg Allow kernel code to access constant databases by moving cdbr(3) and the
required mi_vector_hash(3) into src/common.
 1.2 05-Dec-2013  joerg Add cdbr_open_mem.
 1.1 25-Apr-2010  joerg branches: 1.1.2; 1.1.8; 1.1.14;
Add the constant database reader (cdbr(3)) and writer ((cdbw(3)).
They implement a space efficent write-once database with fast access
path. Switch the services(5) database to use cdb. The size of the
database file decreases from 2.1MB disk space to 307KB. Access
performance is about the same if setservent(0) is used and about an
order of magnitude faster otherwise. services_mkdb defaults to the new
format, but can optionally create the old db(3) format as well for
statically linked legacy applications.
 1.1.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 25-Apr-2010  uebayasi file cdbr.h was added on branch uebayasi-xip on 2010-04-30 14:36:17 +0000
 1.3 08-Aug-2023  riastradh cdbw(3): Make cdbw_output descr parameter type less confusing.

This is a string of _up to_ 16 bytes, used with strncpy(..., 16).
Specifying `const char descr[16]', while formally equivalent to
`const char *descr' in standard C, now provokes the ire of gcc when
the caller does not provide a buffer of at least 16 bytes.
 1.2 03-Jun-2012  joerg Prototype for cdbw_stable_seeder.
 1.1 25-Apr-2010  joerg branches: 1.1.2; 1.1.8; 1.1.10;
Add the constant database reader (cdbr(3)) and writer ((cdbw(3)).
They implement a space efficent write-once database with fast access
path. Switch the services(5) database to use cdb. The size of the
database file decreases from 2.1MB disk space to 307KB. Access
performance is about the same if setservent(0) is used and about an
order of magnitude faster otherwise. services_mkdb defaults to the new
format, but can optionally create the old db(3) format as well for
statically linked legacy applications.
 1.1.10.1 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.1.8.1 30-Oct-2012  yamt sync with head
 1.1.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.1.2.1 25-Apr-2010  uebayasi file cdbw.h was added on branch uebayasi-xip on 2010-04-30 14:36:17 +0000
 1.4 28-Jan-2013  matt Add missing long double prototypes.
 1.3 15-Sep-2010  christos branches: 1.3.6; 1.3.12;
Commit SoC long double support from Stathis Kamperis
 1.2 22-Jul-2009  drochner branches: 1.2.2;
add a "public domain" note (there is nothing creative justifying a
long license)
 1.1 20-Aug-2007  drochner Add C99 complex support, for double and float.
Most complex function implementations are from the "c9x-complex" library,
originating from the "cephes" math library, see
http://www.netlib.org/cephes/, from Stephen L. Moshier, incorporated and
redistributed with the NetBSD license by permission of the author.

Error behaviour and other boundary conditions (branch cuts)
need to be looked at.

For namespace sanity, I've done the rename/weak alias procedure to
most of the exported functions which are also used internally.
Didn't do so for sin/cos(f) yet because assembler implementations use
them directly, and renaming functions shared between the main libm
and the machine specific "overlay" might raise binary compatibility
issues.
 1.2.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.3.12.1 25-Feb-2013  tls resync with head
 1.3.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3 28-Apr-2008  martin branches: 1.3.10;
Remove clause 3 and 4 from TNF licenses
 1.2 30-Jul-1997  jtc branches: 1.2.46;
Fix files using old TNF copyright notice
 1.1 05-Feb-1996  jtc Add cpio.h, tar.h, and re_comp.h headers for POSIX & XPG4 conformance
 1.2.46.1 18-May-2008  yamt sync with head.
 1.3.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.10.1 28-Apr-2008  martin file cpio.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.35 20-Mar-2020  joerg Fix visibility of various C99 features, esp. for C++11.
 1.34 28-Apr-2013  joerg branches: 1.34.28;
Include at least ctype_bits.h, even when not providing the macros.
 1.33 26-Apr-2013  joerg Do not define the ctype(3) interface via macros for C++.
 1.32 16-Apr-2013  joerg Add isalpha_l and friends.
 1.31 01-Jun-2010  tnozaki branches: 1.31.6; 1.31.12;
more split ctype.h -> sys/ctype_inline.h, sys/ctype_bits.h
 1.30 22-May-2010  tnozaki 1. hide _CTYPE_PRIVATE section in ctype.h, move them to private header ctype_local.h.
2. do not use _CTYPE_NUM_CHARS macro to read data from LC_CTYPE(old BSDCTYPE style) database.
because 1<<CHAR_BIT is MD, so i added MI macro _CTYPE_CACHE_SIZE(1<<8).
3. remove _NB_CACHED_RUNE macro, use _CTYPE_CACHE_SIZE instead.
 1.29 26-Dec-2005  perry branches: 1.29.38;
u_intN_t -> uintN_t
 1.28 15-Apr-2005  rillig Replaced the macro name "notyet" with a 0. There's always the possibility
that a strictly conforming C program uses that name itself, so it had to
be removed. Also put the long comment above the #if 0, because it describes
the #if, not the isblank() macro. Added two blank lines to make the grouping
clear. Approved by kleink.
 1.27 03-Feb-2005  perry branches: 1.27.2;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.26 05-Nov-2004  dsl Remove the (int) cast from the array subscript of the ctype #defines.
The cast just stops gcc detecting places where the functions are
passed a 'char' variable - and will index off the array for byte values
0x80 to 0xff.
All (I hope) of the places in the netbsd sources where this was a
potential problem have had an (unsigned char) cast applied.
Christos said he'll fix any fallout I've missed.
 1.25 22-Oct-2003  kleink branches: 1.25.4;
_ISO_C99_SOURCE -> _ISOC99_SOURCE
 1.24 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.23 29-Apr-2003  bjh21 Header file cleanup:
* Sort includes.
* isblank() is in C99, POSIX 2001 and XSH6. Update ifdefs accordingly.
 1.22 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.21 18-Apr-2001  thorpej If _CTYPE_PRIVATE, need to include <machine/limits.h> for CHAR_BIT.
 1.20 17-Apr-2001  kleink Replace (sizeof (char) << 3) with a less silly-looking CHAR_BIT;
from Peter Seebach in PR standards/9333.
 1.19 21-Jan-2001  itojun branches: 1.19.2;
have comment about strange use of _B
 1.18 13-Jun-2000  simonb Remove 'extern' from function declarations.
 1.17 10-May-1998  kleink branches: 1.17.8;
Reorganize name space protection.
 1.16 23-Mar-1998  mrg cast the argument of ctype macros to (int).
 1.15 02-Jun-1997  kleink branches: 1.15.2;
Add support for localized character sets (a.k.a. LC_CTYPE).

Thanks go to Matthias Scheler <tron@lyssa.owl.de> for contributing his initial
work in PR/3592, and to Christos Zoulas for refining it!
 1.14 26-Oct-1994  cgd new RCS ID format.
 1.13 16-May-1994  cgd update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those. Kill varargs.h, because it can simply
be a link to the machine-dependent version.
 1.12 05-Oct-1993  jtc #ifdef out the isblank macro. Programs that use it will still work, as
they will link in the isblank function.
 1.11 14-Sep-1993  jtc Added isblank() used by 4.4 and POSIX utilities like tr.
 1.10 05-Sep-1993  mycroft ANSI_SOURCE --> _ANSI_SOURCE
 1.9 23-Aug-1993  cgd use "_to*_tab_" rather than "_to*_table_" -- table is defined as the former
 1.8 21-Aug-1993  jtc _ctype_, _tolower_tab_, and _toupper_tab_ are now pointers to the tables.
The tables have been renamed to _C_ctype_, _C_tolower_, and _C_toupper_
as they are tables for the C locale. When switching to a new locale, the
pointers will be set to point to tables specific to the new locale.
 1.7 09-Aug-1993  deraadt zapped extra ; at end of two #define lines
 1.6 06-Aug-1993  jtc Declare translation tables for toupper and tolower. To be replaced by
pointers to the tables to the current locale.
Reintroduce toupper and tolower macros that use the translation tables.
 1.5 06-Aug-1993  jtc Use const qualifier with _ctype_ table. Smart compilers can then store it
in the text segment. When we implement locales, the isctype macros/functions
will reference this table (or a locale specific table) through a pointer, but
for right now, it continues to reference the _ctype_ table directly.
 1.4 06-Aug-1993  jtc Rename tolower & toupper macros to _tolower and _toupper.
Standard C requires tolower to return a character that is !isupper unchanged
which was not being done with the macro. The function version does the
right thing, so the loss of the macro is no great deal.

I didn't eliminate the macros entirely, since X/Open's XPG3 requires _tolower
and _toupper with the same semantics. But, like isascii/toascii, they are
removed from the namespace if either ANSI_SOURCE or _POSIX_SOURCE is defined.
 1.3 06-Aug-1993  jtc Declare function versions of is* and to* functions -- discovered by
P.J. Plauger's ANSI Library regression test.
Don't export isascii & toascii in strict ansi mode.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd branches: 1.1.1.1.2;
initial import of 386bsd-0.1 sources
 1.1.1.1.2.1 27-Jul-1993  cgd get rid of the toupper and tolower macros; they're broken and aren't
necessary to have as macros.
 1.15.2.1 27-Sep-1998  cgd pull up rev 1.16 from trunk (tv).
 1.17.8.2 23-Jun-2000  minoura Import of most recent XPG4DL dated 2000.06.23.
 1.17.8.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.19.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.25.4.1 16-Apr-2005  tron Pull up revision 1.28 via patch (requested by rillig in ticket #1427):
Replaced the macro name "notyet" with a 0. There's always the possibility
that a strictly conforming C program uses that name itself, so it had to
be removed. Also put the long comment above the #if 0, because it describes
the #if, not the isblank() macro. Added two blank lines to make the grouping
clear. Approved by kleink.
 1.27.2.1 16-Apr-2005  tron Pull up revision 1.28 (requested by rillig in ticket #158):
Replaced the macro name "notyet" with a 0. There's always the possibility
that a strictly conforming C program uses that name itself, so it had to
be removed. Also put the long comment above the #if 0, because it describes
the #if, not the isblank() macro. Added two blank lines to make the grouping
clear. Approved by kleink.
 1.29.38.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.31.12.1 23-Jun-2013  tls resync from head
 1.31.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.34.28.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.27 24-Sep-2016  christos sync with mit/kerberos db
 1.26 01-Dec-2013  christos branches: 1.26.8;
add new internal functions
 1.25 13-Mar-2012  christos branches: 1.25.2;
use __type_fit() instead of locally brewed macro
 1.24 26-Aug-2008  joerg branches: 1.24.2; 1.24.6;
Convert db from UCB types to POSIX types. Prefer uint8_t for u_char as
it is mostly about the wire format.

Patched libc.so is bit-identical.

OK matt@
 1.23 03-Feb-2007  christos branches: 1.23.12;
Add macros for overflow detection
 1.22 26-Dec-2005  perry u_intN_t -> uintN_t
 1.21 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.20 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.19 09-Jul-2003  kristerw Remove variable names from prototypes.
 1.18 30-May-2002  itojun do not define types like int32_t or u_int32_t locally.
 1.17 26-Sep-1999  scw branches: 1.17.8;
Modify the P_{16,32}_SWAP() macros to avoid unaligned 16 and 32 bit
memory accesses. This fixes a problem seen on the Shark when trying
to use the db(3) functions to access a BIG_ENDIAN btree.

For some reason, the db(3) regression tests fail to spot this problem
on the Shark...
 1.16 09-Dec-1998  christos branches: 1.16.2; 1.16.4;
delint.
 1.15 16-Nov-1998  christos delint
 1.14 07-May-1998  kleink Change the file mode argument to dbopen() and the db backends from int to
mode_t.
 1.13 26-Oct-1994  cgd new RCS ID format.
 1.12 17-Aug-1994  cgd branches: 1.12.2;
clean up import
 1.11 20-Oct-1993  cgd update to v1.72 of new DB code
 1.10 16-Sep-1993  cgd forgot the friggin' rcsid last time around.
 1.9 09-Sep-1993  cgd upgrade new DB code to version 1.7
 1.8 01-Aug-1993  mycroft Add RCS identifiers.
 1.7 14-Jun-1993  cgd update db code to v1.6 from vangogh, and put it in "db" rather than "DB"
 1.6 27-May-1993  cgd new vangogh db (v1.5)
 1.5 26-Apr-1993  proven Merged Charles's enhancements to SWAP macros into new db.h
 1.4 21-Apr-1993  proven Took out an include line. Libc should compile now.
 1.3 18-Apr-1993  proven Updated header files for libdb.
 1.2 21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 02-Feb-1998  perry import lite-2
 1.1.1.2 17-Aug-1994  cgd update to 1.79
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.12.2.2 17-Aug-1994  cgd clean up import
 1.12.2.1 17-Aug-1994  cgd file db.h was added on branch netbsd-1-0 on 1994-08-17 22:58:57 +0000
 1.16.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.16.2.1 26-Sep-1999  he Pull up revision 1.17 (requested by scw):
Fix P_{16,32}_SWAP() macros to avoid unaligned 16 and 32 bit
memory accesses. This fixes a problem seen on arm32 when trying
to use the db(3) functions to access a BIG_ENDIAN btree.
 1.17.8.1 21-Jun-2002  nathanw Catch up to -current.
 1.23.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.24.6.2 26-Aug-2008  joerg Convert db from UCB types to POSIX types. Prefer uint8_t for u_char as
it is mostly about the wire format.

Patched libc.so is bit-identical.

OK matt@
 1.24.6.1 26-Aug-2008  joerg file db.h was added on branch christos-time_t on 2008-08-26 21:18:39 +0000
 1.24.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.2.1 17-Apr-2012  yamt sync with head
 1.25.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.8.1 04-Nov-2016  pgoyette Sync with HEAD
 1.38 28-Dec-2022  nia scandir(3) and alphasort(3) are part of POSIX-2008, so don't require
_NETBSD_SOURCE to use them.
 1.37 30-Dec-2021  nros branches: 1.37.2;
Make fdopendir visible according to POSIX.1 spec.
 1.36 16-Dec-2016  mrg scandir/alphasort take "const struct dirent **" not "const void *" in
modern unix. since we claim to be 'IEEE Std 1003.1-2008', make it so.
 1.35 30-Jul-2012  yamt branches: 1.35.14;
comments
 1.34 26-Sep-2010  yamt branches: 1.34.6;
fix rewinddir on nfs. fix PR/42879 (and probably PR/40229.)
 1.33 24-Feb-2009  christos branches: 1.33.2;
version alphasort.
 1.32 11-Jan-2009  christos branches: 1.32.2;
merge christos-time_t
 1.31 05-Dec-2008  ad Add fdopendir(), from Solaris/Linux.
 1.30 09-Jan-2008  christos branches: 1.30.14;
tell about getdents, not getdirentries
 1.29 17-May-2006  christos branches: 1.29.10;
rename dd_rewind to dd_internal so that it can be re-used to implement
telldir/seekdir/rewinddir differently. While there change the prototype
to telldir to take a non-const DIR, per:
http://www.opengroup.org/onlinepubs/009695399/basedefs/dirent.h.html
 1.28 26-Mar-2006  christos PR/33124: Murray Armfield: readdir_r is missing a restrict qualifier.
http://www.opengroup.org/onlinepubs/000095399/basedefs/dirent.h.html
 1.27 24-Jan-2006  christos remove functions that we should not be exposing.
 1.26 24-Jan-2006  christos expose unlocked versions of readdir and telldir.
 1.25 14-Sep-2005  christos Fix opendir30 screwup and sort the compat defs for clarity.
 1.24 13-Sep-2005  christos compat code reorg
 1.23 19-Aug-2005  christos 64 bit inode changes
 1.22 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.21 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.20 28-May-2003  christos add mutex locking and dirent_r.
 1.19 29-Apr-2003  bjh21 Fix things so that _NETBSD_SOURCE correctly exposes the dirfd() and
the insides of struct _dirdesc. Also make the existence of struct
_dirdesc visible to POSIX applications since this is less ugly than
pretending that DIR is a void *.
 1.18 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.17 16-Apr-2000  mrg make scandir(3)'s 3rd argument take a function that takes a *const*
struct dirent *, rather than non-const. this makes scandir(3) the
same as the scandir implementations in libiberty and glibc, and the
select function has no need to modify the dirent.
 1.16 10-Jan-2000  kleink Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
std C headers including it, and a kernel module written in C++ would benfit
as well.
 1.15 22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.14 06-May-1998  kleink Reorganize name space protection.
 1.13 10-Oct-1997  fvdl oops. Checked in wrong dirent.h version. Add missing getdents prototype
to this one.
 1.12 10-Oct-1997  fvdl Correct comment: getdirentries() -> getdents()
 1.11 13-Jul-1997  christos Added missing __seekdir prototype
 1.10 05-Dec-1995  jtc Changed to unconditionally include <sys/types.h> as required by X/Open XPG4.2.
 1.9 26-Mar-1995  jtc KERNEL -> _KERNEL
 1.8 28-Dec-1994  mycroft Sync with CSRG.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 29-Aug-1994  mycroft branches: 1.6.2;
Update to 4.4-Lite version.
 1.5 15-Dec-1993  jtc Struct dirent definition moved to <sys/dirent.h>.
 1.4 10-Dec-1993  jtc Expand "u_long" & "u_short" to "unsigned long" and "unsigned short".
Some programs (like NSCA httpd) include <dirent.h> without first including
<sys/types.h> so the u_foo types aren't declared. I don't think POSIX.1
allows us to include <sys/types.h> in <dirent.h> either.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 04-Jun-1993  proven Removed bugs and memory leaks from the directory functions.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3 02-Feb-1998  perry import lite-2
 1.1.1.2 29-Aug-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6.2.2 29-Aug-1994  mycroft Update to 4.4-Lite version.
 1.6.2.1 29-Aug-1994  mycroft file dirent.h was added on branch netbsd-1-0 on 1994-08-29 18:11:09 +0000
 1.29.10.1 23-Mar-2008  matt sync with HEAD
 1.30.14.1 28-Dec-2008  christos sync with head.
 1.32.2.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.33.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.34.6.1 30-Oct-2012  yamt sync with head
 1.35.14.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.37.2.1 28-Dec-2022  martin Pull up following revision(s) (requested by nia in ticket #28):

include/dirent.h: revision 1.38

scandir(3) and alphasort(3) are part of POSIX-2008, so don't require
_NETBSD_SOURCE to use them.
 1.10 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.9 23-Apr-2004  christos constify setdisktab()
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.7 19-Jan-1999  abs Add '-f disktab' option to disklabel, via lib/6623 from
Greg A. Woods <woods@most.weird.com>. (Very) slightly tweaked disklabel.8
 1.6 27-Jul-1998  mycroft Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.5 26-Jul-1998  mycroft const poisoning.
 1.4 02-Feb-1998  perry merge lite-2
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.26 02-Nov-2024  nia Expose dladdr(3) to POSIX.1.2024 applications.
 1.25 11-Jul-2017  joerg branches: 1.25.18;
Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
functions are used for destructors of thread_local objects.

If a pending destructor exists, prevent unloading of shared objects.
Introduce __dl_cxa_refcount interface for this purpose. When the last
reference is gone and the object has been dlclose'd before, the
unloading is finalized.

Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
on providing __cxa_thread_atexit as direct wrapper without further
patching.
 1.24 16-Feb-2012  joerg branches: 1.24.24;
Add _dlauxinfo helper function to provide access to the ELF auxilary
vector. This can normally be found via __ps_strings, but libc is
initialised too early when linked dynamically and doesn't have access to
it yet, so provide an alternative mechanism via ld.elf_so.
Bump libc minor.
 1.23 25-Jun-2011  nonaka branches: 1.23.2;
PR/45015: ld.elf_so: support ELF symbol versioning
Applied latest patch.
 1.22 24-Dec-2010  skrll Add support for DF_1_BIND_NOW, DF_1_NODELETE and DF_1_NOOPEN marked
objects, and the RTLD_NODELETE and RTLD_NOLOAD flags to dlopen(3).

Mark libpthread as DF_1_NOOPEN and use it to test the functionality.

Somewhat taken from FreeBSD.

Fixes PR 42029.

OK from christos and joerg.
 1.21 07-Jan-2010  skrll Typo in comment.
 1.20 24-Sep-2009  pooka Add Solarisa-like dlinfo() interface to the ELF dynamic linker.
Implement RTLD_DI_LINKMAP which returns a pointer to the linkmap
chain at the given object. Other Solaris queries are currently
unimplemented.
 1.19 28-Apr-2008  martin branches: 1.19.8; 1.19.10; 1.19.16;
Remove clause 3 and 4 from TNF licenses
 1.18 21-Mar-2005  kleink branches: 1.18.18;
Add restrict qualifiers to dlsym() (XSI) and dladdr() arguments.
 1.17 03-Feb-2005  perry branches: 1.17.2;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.16 01-Jul-2003  skrll Remove reference to dlinfo - it doesn't exist in NetBSD.
 1.15 30-May-2003  christos Add RTLD_SELF, RTLD_NEXT, RTLD_DEFAULT, from FreeBSD
 1.14 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.13 13-Jun-2000  simonb branches: 1.13.6;
Remove 'extern' from function declarations.
 1.12 11-Feb-2000  thorpej branches: 1.12.2;
Const'ify dli_saddr in struct _dl_info.
 1.11 08-Feb-2000  scottb change first argument of dladdr to const.
 1.10 19-May-1999  kleink Declare dlerror()'s return value __aconst.
 1.9 05-Sep-1998  pk Assign my copyright to the TNF.
 1.8 14-Jul-1998  tv Change ld.so default behavior to RTLD_LOCAL, and make RTLD_LOCAL into a
new flag bit. Keep RTLD_GLOBAL as an actual flag bit so it won't be
re-used, or may be used for something later. Mask the dlopen() mode bits
in ld.elf_so so a comparison against RTLD_NOW works. (RTLD_{LOCAL,GLOBAL}
needs to be implemented for ld.elf_so.)
 1.7 12-May-1998  pk Add dladdr() and `Dl_info' structure; interface cloned from Solaris 2.
 1.6 06-May-1998  kleink Per XSH98, define the RTLD_LOCAL flag. In this implementation it's a NOP,
since non-local searches have to be explicitly enabled via RTLD_GLOBAL.
 1.5 25-Mar-1998  kleink Protect the dlctl() prototype and the DL_* macros against _XOPEN_SOURCE;
they are neither specified by the XPG nor part of the name space reserved for
implementation-defined use.
 1.4 15-Mar-1998  pk Define RTLD_GLOBAL.
 1.3 02-Jan-1997  pk Add `const' to dlopen() & dlsym() protos, per PR#2453.
Add RTLD_NOW.
 1.2 05-Jun-1995  pk {BEGIN,END}DECLS
 1.1 05-Jun-1995  pk Put dlopen() et.al. declarations in separate header file for compatibility.
 1.12.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.13.6.2 28-May-2004  tron Pull up revision 1.16 (requested by skrll in ticket #1702):
Remove reference to dlinfo - it doesn't exist in NetBSD.
 1.13.6.1 28-May-2004  tron Pull up revision 1.15 (requested by skrll in ticket #1702):
Add RTLD_SELF, RTLD_NEXT, RTLD_DEFAULT, from FreeBSD
 1.17.2.1 21-Mar-2005  jwise Pull up revision 1.18 of include/dlfcn.h (requested by kleink in [pullup-3 #39])
Pull up revision 1.19 of share/man/man3/dlfcn.3) (requested by kleink in same)

Add restrict qualifiers to dlsym() (XSI) and dladdr() arguments.
 1.18.18.1 18-May-2008  yamt sync with head.
 1.19.16.1 21-Apr-2010  matt sync to netbsd-5
 1.19.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.19.10.1 28-Apr-2008  martin file dlfcn.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.19.8.1 14-Oct-2009  sborrill Pull up the following revisions(s) (requested by pooka in ticket #1088):
include/dlfcn.h: revision 1.20
lib/libc/dlfcn/dlfcn_elf.c: revision 1.6
libexec/ld.elf_so/reloc.c: revision 1.97
libexec/ld.elf_so/rtld.c: revision 1.125
libexec/ld.elf_so/rtld.h: revision 1.81
libexec/ld.elf_so/symbol.c: revision 1.48

Add Solarisa-like dlinfo() interface to the ELF dynamic linker.
Implement RTLD_DI_LINKMAP which returns a pointer to the linkmap
chain at the given object. Other Solaris queries are currently
unimplemented.
 1.23.2.1 17-Apr-2012  yamt sync with head
 1.24.24.1 29-Aug-2017  bouyer Pull up following revision(s) (requested by joerg in ticket #127):
tests/libexec/ld.elf_so/h_thread_local_dtor.c: revision 1.1
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6/c++config.h: revision 1.14
external/gpl3/gcc/lib/libstdc++-v3/arch/earmeb/c++config.h: revision 1.17
lib/libc/stdlib/atexit.h: file removal
lib/libc/stdlib/exit.c: revision 1.16
external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc64/c++config.h: revision 1.8
lib/libc/stdlib/exit.c: revision 1.17
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hf/c++config.h: revision 1.14
distrib/sets/lists/debug/shl.mi: revision 1.178
external/gpl3/gcc/lib/libstdc++-v3/arch/sh3el/c++config.h: revision 1.21
distrib/sets/lists/debug/shl.mi: revision 1.179
distrib/sets/lists/debug/mi: revision 1.219
lib/libpthread/pthread.c: revision 1.150
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7/c++config.h: revision 1.14
libexec/ld.elf_so/symbols.map: revision 1.2
include/dlfcn.h: revision 1.25
external/gpl3/gcc/lib/libstdc++-v3/arch/arm/c++config.h: revision 1.21
external/gpl3/gcc/lib/libstdc++-v3/arch/x86_64/c++config.h: revision 1.23
external/gpl3/gcc/lib/libstdc++-v3/arch/mips64el/c++config.h: revision 1.18
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4eb/c++config.h: revision 1.14
external/gpl3/gcc/lib/libstdc++-v3/arch/earm/c++config.h: revision 1.19
external/gpl3/gcc/lib/libstdc++-v3/arch/mipsel/c++config.h: revision 1.19
external/gpl3/gcc/lib/libstdc++-v3/arch/ia64/c++config.h: revision 1.5
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6eb/c++config.h: revision 1.14
external/gpl3/gcc/lib/libstdc++-v3/arch/earmhf/c++config.h: revision 1.17
distrib/sets/lists/tests/mi: revision 1.755
external/gpl3/gcc/lib/libstdc++-v3/arch/mips64eb/c++config.h: revision 1.19
external/gpl3/gcc/lib/libstdc++-v3/arch/i386/c++config.h: revision 1.20
external/gpl3/gcc/lib/libstdc++-v3/arch/vax/c++config.h: revision 1.21
external/gpl3/gcc/lib/libstdc++-v3/arch/armeb/c++config.h: revision 1.21
external/gpl3/gcc/lib/libstdc++-v3/arch/sparc/c++config.h: revision 1.20
lib/libc/dlfcn/dlfcn_elf.c: revision 1.14
tests/libexec/ld.elf_so/t_thread_local_dtor.sh: revision 1.1
tests/lib/libpthread/t_thread_local_dtor.sh: revision 1.1
lib/libc/stdlib/Makefile.inc: revision 1.93
lib/libc/include/atexit.h: revision 1.1
lib/libc/include/atexit.h: revision 1.2
external/gpl3/gcc/lib/libstdc++-v3/arch/m68k/c++config.h: revision 1.19
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hf/c++config.h: revision 1.14
distrib/sets/lists/debug/shl.mi: revision 1.180
external/gpl3/gcc/lib/libstdc++-v3/arch/sparc64/c++config.h: revision 1.19
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hfeb/c++config.h: revision 1.14
external/gpl3/gcc/lib/libstdc++-v3/arch/hppa/c++config.h: revision 1.19
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hfeb/c++config.h: revision 1.14
lib/libc/stdlib/cxa_thread_atexit.c: revision 1.1
tests/libexec/ld.elf_so/helper_dso3/h_helper_dso3.cpp: revision 1.1
tests/libexec/ld.elf_so/helper_dso3/Makefile: revision 1.1
external/gpl3/gcc/lib/libstdc++-v3/arch/riscv64/c++config.h: revision 1.5
libexec/ld.elf_so/rtld.c: revision 1.185
external/gpl3/gcc/lib/libstdc++-v3/arch/sh3eb/c++config.h: revision 1.19
external/gpl3/gcc/lib/libstdc++-v3/arch/riscv32/c++config.h: revision 1.5
external/gpl3/gcc/lib/libstdc++-v3/arch/m68000/c++config.h: revision 1.15
external/gpl3/gcc/lib/libstdc++-v3/arch/mipseb/c++config.h: revision 1.21
external/gpl3/gcc/lib/libstdc++-v3/arch/coldfire/c++config.h: revision 1.12
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4/c++config.h: revision 1.14
external/gpl3/gcc/lib/libstdc++-v3/arch/earmhfeb/c++config.h: revision 1.15
external/gpl3/gcc/lib/libstdc++-v3/arch/alpha/c++config.h: revision 1.19
tests/libexec/ld.elf_so/Makefile: revision 1.9
external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h: revision 1.20
external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7eb/c++config.h: revision 1.14
tests/lib/libpthread/h_thread_local_dtor.cpp: revision 1.1
distrib/sets/lists/tests/shl.mi: revision 1.11
tests/lib/libpthread/Makefile: revision 1.13
libexec/ld.elf_so/rtld.h: revision 1.129
external/gpl3/gcc/lib/libstdc++-v3/arch/or1k/c++config.h: revision 1.6
Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
functions are used for destructors of thread_local objects.
If a pending destructor exists, prevent unloading of shared objects.
Introduce __dl_cxa_refcount interface for this purpose. When the last
reference is gone and the object has been dlclose'd before, the
unloading is finalized.
Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
on providing __cxa_thread_atexit as direct wrapper without further
patching.
Fix filename of new debug file
Add misising DEBUGLIB file
Avoid common declaration.
Drop TLS variant checks, emutls is enough for VAX and Sun2.
 1.25.18.1 02-Aug-2025  perseant Sync with HEAD
 1.1 16-Oct-2017  maya branches: 1.1.2;
Add endian.h header. Simply includes sys/endian.h

<endian.h> has been accepted by the austin group.
 1.1.2.2 04-Dec-2017  snj Pull up following revision(s) (requested by maya in ticket #416):
distrib/sets/lists/comp/mi: revision 1.2152
include/Makefile: revision 1.144
include/endian.h: revision 1.1
Add endian.h header. Simply includes sys/endian.h
<endian.h> has been accepted by the austin group.
 1.1.2.1 16-Oct-2017  snj file endian.h was added on branch netbsd-8 on 2017-12-04 19:48:55 +0000
 1.18 06-Jan-2022  uwe err.h: dead once is dead enough

Per joerg's advice keep the __dead in front position as it is where
_Noreturn would go.
 1.17 16-Jan-2014  christos Add the {v,}{warn,err}c function flavors from FreeBSD
 1.16 17-Jul-2011  joerg branches: 1.16.2; 1.16.8;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.15 25-Feb-2010  joerg Consistently use __printflike and __scanflike.
 1.14 03-Feb-2005  perry branches: 1.14.44;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.13 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.12 30-Jul-1998  mycroft __Namespace__ __protection__.
 1.11 26-Oct-1994  cgd new RCS ID format.
 1.10 19-Oct-1994  cgd better attributes.
 1.9 22-May-1994  cgd _VA_LIST_ -> _BSD_VA_LIST_
 1.8 27-Jan-1994  jtc Change __attribute -> __attribute__. The former isn't turned off by
sys/cdefs.h when not using Gcc, the latter is.
 1.7 01-Dec-1993  jtc Use GCC's format attribute (for bug detection with -Wformat).
 1.6 06-Nov-1993  cgd trim _BSD off of _BSD_VA_LIST, so that we don't have to change all
standard headers (yet).
 1.5 06-Nov-1993  cgd update to latest version
 1.4 04-Aug-1993  jtc Change volatile qualifier to __dead, for when cc != gcc.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 01-May-1993  mycroft s/__dead/volatile/
 1.1 30-Apr-1993  glass branches: 1.1.1;
oops
 1.1.1.1 02-Feb-1998  perry import lite-2
 1.14.44.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.16.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11 03-Mar-2008  dholland Add a comment noting that the definition of __errno is now replicated in
signal.h. Per request of joerg@
 1.10 24-Feb-2008  dholland signal.h is not supposed to define errno, so use ___errno instead.
Adjust errno.h in a compatible fashion to avoid -Wredundant-decls issues.
I have run a build to check the tree for places where errno.h is missing,
and fixed the cases I found, but there might be more in MD code.
 1.9 24-Dec-2005  perry branches: 1.9.10; 1.9.16;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.8 13-Sep-2005  christos compat code reorg
 1.7 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.5 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.4 18-Dec-2000  christos protect against multiple declarations.
 1.3 13-Jun-2000  simonb Remove 'extern' from function declarations.
 1.2 21-Jan-2000  mycroft branches: 1.2.2;
Do the pthread errno hack. That is, *always* do:
#define errno (*__errno())
This is necessary to make non-threaded libraries (e.g. libX11) continue to
work correctly when linked with -lpthread. glibc also does this.
 1.1 12-Jan-1999  kleink branches: 1.1.2;
Separate the userland and libsa errno declarations from <sys/errno.h> into
their canonical places.
 1.1.2.1 23-Jan-2000  he Pull up revision 1.2 (requested by mycroft):
Always do the errno indirection hack, so that non-threaded
libraries get the right errno value when linked with -lpthread.
This means "always include <errno.h> and never declare errno
yourself".
 1.2.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.16.1 24-Mar-2008  keiichi sync with head.
 1.9.10.1 23-Mar-2008  matt sync with HEAD
 1.26 09-Apr-2017  christos fexcept_t + fenv_t should be handled the same way for softfloat
 1.25 22-Mar-2017  chs provide a common softfloat fenv implemenation and use it for softfloat builds.
restore ABI compatibility with previous releases for ieeefp.h on sh3.
add namespace.h protection for all the fenv interfaces.
use MKSOFTFLOAT on sh3 instead of assuming softfloat.
standardize on comparing MKSOFTFLOAT with "no".
remove the arm-specific softfloat fenv code (which also had several bugs).
fix logic errors in the arm hardfloat feraiseexcept() and feupdateenv().
 1.24 23-Feb-2017  scole Add fenv for ia64, imported from FreeBSD, compile tested only.
 1.23 25-Aug-2016  christos branches: 1.23.2;
add sh
 1.22 23-Aug-2016  christos add alpha
 1.21 29-Dec-2015  christos branches: 1.21.2;
fix inverted condition...
 1.20 28-Dec-2015  martin Add missing eol-escape
 1.19 27-Dec-2015  christos We need at least 68010 or coldfire for fenv.
 1.18 24-Dec-2015  christos add m68k, default types.
 1.17 24-Dec-2015  christos rearrange...
 1.16 22-Dec-2015  christos Add __HAVE_FENV
 1.15 21-Dec-2015  christos Add fenv.h for mips
 1.14 20-Dec-2015  christos Powerpc now has fenv.h
 1.13 27-Dec-2014  martin fenv(3) support for hppa
 1.12 19-Sep-2014  matt RISC-V support <fenv.h>
 1.11 03-Sep-2014  matt or1k support <fenv.h>
 1.10 10-Aug-2014  matt branches: 1.10.2;
Changes to existing files to enable building AARCH64 userland.
evbarm64-el
This is clang only. While gcc4.8 supports aarch64, no netbsd support has
been written for aarch64 with gcc4.8.
 1.9 28-Apr-2013  matt Enable fenv support for arm.
 1.8 27-Apr-2013  joerg Systematically include sys/featuretest.h when _NETBSD_SOURCE is used.
Some are redundant, but make verification with grep much easier.
 1.7 22-Mar-2012  dholland branches: 1.7.2;
typo in comment
 1.6 20-May-2011  nakayama branches: 1.6.4;
Add fenv support for sparc. Mostly copied from sparc64 and share with it.
 1.5 16-May-2011  martin Actually test for sparc v9 architecture, doesn't matter if we are building
32bit or 64bit (fixes 32bit compat library build on sparc64 - yes, they
differ from native sparc libs!)
 1.4 16-May-2011  he The support of <fenv.h> is actually for __sparc64__, not for __sparc__
(which is also defined on sparc64). This fixes a build problem for
plain sparc.
 1.3 31-Jan-2011  christos fenv support for sparc64 from Stathis Kamperis
 1.2 02-Aug-2010  joerg branches: 1.2.2; 1.2.4;
Missing defined.
 1.1 31-Jul-2010  joerg Add support for fenv.h interface for i386 and amd64.

Submitted by Stathis Kamperis as part of GSoC 2010 and ported from
FreeBSD.
 1.2.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.2.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.2.2.1 02-Aug-2010  uebayasi file fenv.h was added on branch uebayasi-xip on 2010-08-17 06:41:03 +0000
 1.6.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.4.1 17-Apr-2012  yamt sync with head
 1.7.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.2.1 23-Jun-2013  tls resync from head
 1.10.2.1 20-Jan-2015  snj Pull up following revision(s) (requested by martin in ticket #416):
distrib/sets/lists/comp/md.hppa: revision 1.3
include/fenv.h: revision 1.13 via patch
lib/libm/Makefile: revision 1.168
lib/libm/arch/hppa/fenv.c: revisions 1.1, 1.2
sys/arch/hppa/include/Makefile: revision 1.12
sys/arch/hppa/include/fenv.h: revisions 1.1, 1.2
sys/arch/hppa/include/ieeefp.h: revisions 1.5-1.7
tests/lib/libm/Makefile: revision 1.29 via patch
fenv(3) support for hppa
--
use unsigned over uint32_t so that this file works without stdint.h
being included before hand.
fixes mknative-gcc problems, and likely others.
--
Properly separate fenv.h and ieeefp.h by moving all fenv defines
over to the former.
Now that they are decoupled, make rounding modes match the hardware bits.
--
Simplify, now that rounding mode defines match the hardware bits.
 1.21.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.21.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.23.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.4 08-Dec-2023  andvar fix triple s typos in comments.
 1.3 28-Apr-2008  martin branches: 1.3.10;
Remove clause 3 and 4 from TNF licenses
 1.2 03-Feb-2005  perry branches: 1.2.24;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.1 12-Sep-1999  kleink Add an XSH5 fmtmsg() implementation.
 1.2.24.1 18-May-2008  yamt sync with head.
 1.3.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.10.1 28-Apr-2008  martin file fmtmsg.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.13 31-Jan-2011  christos new error.
 1.12 03-Feb-2005  perry branches: 1.12.50;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.11 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.10 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.9 06-Oct-2002  provos implement FNM_LEADING_DIR; matches Linux and other *BSDs; approved thorpej
 1.8 27-Oct-2001  kleink Make FNM_CASEFOLD !_XOPEN_SOURCE, too.
 1.7 28-Jun-2000  thorpej branches: 1.7.2;
Implement FNM_CASEFOLD, for matching the pattern in a case-insensitive
way. Flag name taken from glibc.
 1.6 13-Jan-1998  kleink branches: 1.6.10;
Add a FNM_NOSYS return code. This condition will never happen (since fnmatch()
is implemented), but this preprocessor symbol is required by XPG4.2.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 11-Nov-1993  jtc Remove #ifdefs introduced in last change -- the <fnmatch.h> header is not
specified by 1003.1, so any program that includes it is automatically not
POSIX.1 compliant.
 1.3 06-Nov-1993  cgd update to latest version; don't proto fnmatch() unless _POSIX_SOURCE
not defined.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 16-Jun-1993  jtc branches: 1.1.1;
Update fnmatch to be more posix complient (from keith bostic)
 1.1.1.1 02-Feb-1998  perry import lite-2
 1.6.10.1 03-Jul-2000  thorpej Pull up rev. 1.7:
Implement FNM_CASEFOLD, for matching the pattern in a case-insensitive
way. Flag name taken from glibc.
 1.7.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.7.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.12.50.1 08-Feb-2011  bouyer Sync with HEAD
 1.11 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.10 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.9 23-Feb-1999  mrg add a new fstab type "dp" for the user-specified dump device.
change swapctl -A to see this and add it via swapctl(2). also
add a new swapctl -D <device> to change the dump device on the
fly.
 1.8 27-Jul-1998  mycroft Slight rearrangement.
 1.7 27-Jul-1998  mycroft Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.6 26-Jul-1998  mycroft const poisoning.
 1.5 02-Feb-1998  perry merge lite-2
 1.4 27-Jan-1997  perry fs_passno comment dump->fsck, fixes 3150 from Andrew Wheadon
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.19 16-Aug-2009  christos Version fts one more time! This is the most versioned API ever... Bump
fts_level from short to int to avoid a potential DoS.
From Maksymilian Arciemowicz
 1.18 11-Jan-2009  christos merge christos-time_t
 1.17 07-Mar-2008  lukem branches: 1.17.12;
Use "unsigned foo" instead of "u_foo".
Be consistent with tabs.
 1.16 27-Jul-2006  christos branches: 1.16.10; 1.16.16;
fts_number is a quad; bump version.
 1.15 30-Mar-2006  christos PR/33163: Auster Vl.: fts: cant allocate memory | filename too long
Change the ftp_pathlen and fts_namelen to u_int from u_short so that
pathnames > 32K work.
 1.14 13-Sep-2005  christos compat code reorg
 1.13 19-Aug-2005  christos 64 bit inode changes
 1.12 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.11 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.10 11-Nov-2002  thorpej Make fts_pathlen and fts_nitems unsigned.
 1.9 06-Nov-1998  christos branches: 1.9.12;
complete prototype for fts_compar.
 1.8 04-Nov-1997  thorpej Fix __RENAME quoting lossage (don't pass it a quoted string). From
Chris Demetriou <cgd@pa.dec.com>.
 1.7 22-Oct-1997  fvdl New hacks to make libc work painlessly without bumping the major number:
use type func(arg1s) asm("emitted_name") gcc mechanism.
Suggested by Bill Sommerfeld.
 1.6 21-Oct-1997  fvdl branches: 1.6.2;
Hacks to enable libc to work without bumping the major.
 1.5 28-Dec-1994  mycroft Sync with CSRG.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 06-Nov-1993  cgd version number update
 1.2 01-Aug-1993  mycroft New version to match new fts.c.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6.2.3 04-Nov-1997  thorpej Pull up from trunk: Fix __RENAME() usage.
 1.6.2.2 22-Oct-1997  thorpej Pull up from trunk: Update for less nasty function renaming.
 1.6.2.1 21-Oct-1997  thorpej file fts.h was added on branch netbsd-1-3 on 1997-10-22 06:26:48 +0000
 1.9.12.1 11-Nov-2002  nathanw Catch up to -current
 1.16.16.1 24-Mar-2008  keiichi sync with head.
 1.16.10.1 23-Mar-2008  matt sync with HEAD
 1.17.12.1 08-Nov-2008  christos changes for 64 bit time_t
 1.1 30-Dec-2005  agc Add Todd Miller's ftw(3) and nftw(3) file-tree walking functionality,
from OpenBSD.

Bump libc minor to 136.
 1.11 28-Apr-2008  martin branches: 1.11.10;
Remove clause 3 and 4 from TNF licenses
 1.10 08-Nov-2007  christos branches: 1.10.6;
revert the reversion of the previous change. Kill _NETBSD_SOURCE again.
 1.9 07-Nov-2007  dogcow Revert the other part of the getopt_long changes to fix non-NetBSD builds;
viz -r1.22 -r1.23 src/lib/libc/stdlib/getopt_long.c
 1.8 06-Nov-2007  christos remove featuretest.h and NETBSD_SOURCE conditional ifdefs. This is not
a standard header and does not have namespace issues.
 1.7 03-Feb-2005  perry branches: 1.7.16;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.6 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.5 28-Apr-2003  bjh21 branches: 1.5.2;
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.4 07-Jul-2000  ad Pull in <sys/cdefs.h>, since we're using __BEGIN_DECLS/__END_DECLS.
 1.3 02-Apr-2000  christos Include <unistd.h> to get the rest of the getopt goo.
 1.2 02-Apr-2000  christos backout previous. the definition of struct option caused too many namespace
collisions. Instead, define getopt_long in getopt.h and getopt in unistd.h
where it belongs.
 1.1 01-Apr-2000  christos Add getopt.h and collect all the getopt related stuff here.
Make unistd.h include <getopt.h> to get the getopt stuff.
This adds support for getopt_long from Dieter Baron and Thomas Klausner.
 1.5.2.1 22-Jun-2004  tron Pull up revision 1.6 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.7.16.1 09-Jan-2008  matt sync with HEAD
 1.10.6.1 18-May-2008  yamt sync with head.
 1.11.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.11.10.1 28-Apr-2008  martin file getopt.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.27 29-May-2019  christos Add GLOB_TILDE_CHECK (from GNU)
 1.26 06-Sep-2010  christos branches: 1.26.46;
add globstar.
 1.25 08-Apr-2009  christos branches: 1.25.2;
add glob_pattern_p for glibc because cvs needs it and it is a huge mess
to compile in the gnu glob code.
 1.24 13-Sep-2008  christos branches: 1.24.6; 1.24.8;
PR/39534: Henning Petersen: Typo = instead of / to close comment.
 1.23 22-Feb-2008  christos branches: 1.23.4;
GLOB_NO_DOTDIRS patch from mouse@
Fixes re-definition of GLOB_PERIOD.
 1.22 05-Dec-2007  christos branches: 1.22.4;
From Richard M Kreuter, add GLOB_PERIOD.
 1.21 26-Mar-2006  christos branches: 1.21.10;
PR/33123: Murray Armfield: standards compliance & glob.h
Certain fields in glob.h need to be size_t; fix this and version glob(3).
http://www.opengroup.org/onlinepubs/000095399/basedefs/glob.h.html
 1.20 13-Sep-2005  christos compat code reorg
 1.19 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.18 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.17 07-Aug-2003  agc branches: 1.17.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.16 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.15 28-Oct-2001  kleink Partially back out previous: don't apply restrict qualifier to pointer
to function.
 1.14 27-Oct-2001  kleink Sprinkle some __restrict into <glob.h>.
 1.13 16-Mar-2001  christos fix comment.
 1.12 16-Mar-2001  christos Add GLOB_LIMIT
 1.11 22-Jun-1998  tv branches: 1.11.2; 1.11.10; 1.11.12;
Typo: POSXI -> POSIX.
Re-add GLOB_QUOTE and GLOB_ABEND bracketed by standards ifs for source
compatibility.
 1.10 19-Jun-1998  kleink * Remove GLOB_QUOTE, add GLOB_NOESCAPE. Per POSIX, backslash quoting of
special characters is the default behaviour, which may be disabled by
setting GLOB_NOESCAPE.
* Add GLOB_NOMATCH, which will be returned if no matching pathnames have been
found and GLOB_NOCHECK was not set.
* Add GLOB_NOSYS for completeness; it will never happen.
 1.9 31-Mar-1998  kleink Replace the old GLOB_ABEND constant with (the standardized) GLOB_ABORTED.
 1.8 04-Nov-1997  thorpej Fix __RENAME quoting lossage (don't pass it a quoted string). From
Chris Demetriou <cgd@pa.dec.com>.
 1.7 22-Oct-1997  fvdl New hacks to make libc work painlessly without bumping the major number:
use type func(arg1s) asm("emitted_name") gcc mechanism.
Suggested by Bill Sommerfeld.
 1.6 21-Oct-1997  fvdl branches: 1.6.2;
Hacks to enable libc to work without bumping the major.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 06-Nov-1993  cgd update to latest version
 1.3 03-Aug-1993  mycroft New versions to go with new fts() et al.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6.2.3 04-Nov-1997  thorpej Pull up from trunk: Fix __RENAME() usage.
 1.6.2.2 22-Oct-1997  thorpej Pull up from trunk: Update for less nasty function renaming.
 1.6.2.1 21-Oct-1997  thorpej file glob.h was added on branch netbsd-1-3 on 1997-10-22 06:26:46 +0000
 1.11.12.2 14-Nov-2001  nathanw Catch up to -current.
 1.11.12.1 08-Apr-2001  nathanw Merge trunk onto branch.
 1.11.10.1 29-Mar-2001  lukem pull up rev 1.11 - 1.13 (for christos):
add GLOB_LIMIT
 1.11.2.1 01-Apr-2001  he Pull up revisions 1.12-1.13 (requested by christos):
Fixes buffer overflow problems in glob(3). Adds and uses GLOB_LIMIT
to prevent denial of service attacks.
 1.17.2.1 22-Jun-2004  tron Pull up revision 1.18 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.21.10.2 23-Mar-2008  matt sync with HEAD
 1.21.10.1 09-Jan-2008  matt sync with HEAD
 1.22.4.1 24-Mar-2008  keiichi sync with head.
 1.23.4.1 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.24.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.24.6.2 13-Sep-2008  christos PR/39534: Henning Petersen: Typo = instead of / to close comment.
 1.24.6.1 13-Sep-2008  christos file glob.h was added on branch christos-time_t on 2008-09-13 17:05:08 +0000
 1.25.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.26.46.1 10-Jun-2019  christos Sync with HEAD
 1.24 19-Oct-2007  christos kill _NETBSD_TOOLS.
 1.23 18-Oct-2007  christos Introduce _NETBSD_TOOLS for symbols the are needed in tools build
 1.22 24-May-2005  kleink branches: 1.22.10;
Make namespace protection feature tests for reentrant functions more
accurate (and actually less restrictive).
 1.21 02-Apr-2005  christos Add getpwent_r, getgrent_r
 1.20 03-Feb-2005  perry branches: 1.20.2;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.19 04-Oct-2004  lukem Overhaul the use of nsdispatch(3) by public APIs so that the back-end
methods use va_list in a manner that is directly related to the public API.
This makes it much easier to write dynamic nsswitch backends for getgrent(3).
Per my proposal on tech-userlevel.

Implement getgrgid_r() and getgrnam_r() APIs per the POSIX 1003.1, 2004 Ed.
These aren't fully reentrant or threadsafe yet, because the compat stuff
currently uses non-reentrant data sources (getnetgrent(3), getgrent(3)),
and there is probably some locking to be improved in the backends.
This will be fixed in the near future.
We also need to add _SC_GETGR_R_SIZE_MAX to sysconf(3).
 1.18 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.17 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.16 27-Jan-2002  lukem public prototypes should use __P(); fix entries for pwcache_{user,group}db()
 1.15 24-Jan-2002  lukem - Implement pwcache_userdb(3), which changes the routines that
user_from_uid(3) and uid_from_user(3) use to lookup user information.
- Implement pwcache_groupdb(3), which changes the routines that
group_from_gid(3) and gid_from_group(3) use to lookup group information.
- Ensure that private functions in pwcache.c are declared static
- Use strlcpy(3) instead of strncpy(3)
 1.14 28-Jul-1998  mycroft branches: 1.14.12;
Add gid_from_group() and uid_from_user().
 1.13 27-Jul-1998  mycroft Mark more functions returning internal buffers for const auditing.
 1.12 27-Jul-1998  mycroft Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.11 26-Jul-1998  mycroft const poisoning.
 1.10 22-Jun-1998  msaitoh pid/gid is not int but pid_t/gid_t (u_int32_t (unsigned!)).
 1.9 06-May-1998  kleink Reorganize name space protection.
 1.8 11-Jun-1996  jtc POSIX.1 requires programs to include <sys/types.h> before including
<grp.h> or <utime.h> while XPG4.2 makes <sys/types.h> optional. So
I've included <sys/types.h> to provide the XPG4.2 behavior.
 1.7 29-Apr-1995  cgd provide group_from_gid() proto if not _POSIX_SOURCE and not _XOPEN_SOURCE
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 16-May-1994  cgd add back jtc's _XOPEN_SOURCE changes, return type of setgrent back to void
 1.4 16-May-1994  cgd update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those. Kill varargs.h, because it can simply
be a link to the machine-dependent version.
 1.3 25-Oct-1993  jtc X/Open 1170 defines the return type of setgrent() to be void -- a trival
change since our setgrent() allways succeeded.
Removed prototype for obsolete function setgrfile(), added prototype for
setgroupent().
Added _XOPEN_SOURCE to conditionals in case someone wants to compile
something in an strict X/Open environment.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.14.12.1 28-Jan-2002  nathanw Catch up to -current.
 1.20.2.2 11-Jul-2005  tron Pull up revision 1.21 (requested by lukem in ticket #541):
Add getpwent_r, getgrent_r
 1.20.2.1 28-May-2005  tron Pull up revision 1.22 (requested by kleink in ticket #345):
Make namespace protection feature tests for reentrant functions more
accurate (and actually less restrictive).
 1.22.10.1 06-Nov-2007  matt sync with HEAD
 1.5 28-Apr-2008  martin branches: 1.5.10;
Remove clause 3 and 4 from TNF licenses
 1.4 03-Feb-2005  perry branches: 1.4.24;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.3 24-Jan-1999  lukem merge in stuff from hesiod3.0.2 distribution
 1.2 15-Jan-1999  lukem merge nsswitch into main branch
 1.1 06-Nov-1996  lukem branches: 1.1.2; 1.1.4;
file hesiod.h was initially added on branch nsswitch.
 1.1.4.2 23-May-1997  lukem add rcsid
 1.1.4.1 23-May-1997  lukem Add necessary files for nsswitch, take 2
Remove support for "lookup" methods in resolv.conf
Remove prototypes for _ng_sl_*; these were replaced a long time ago
 1.1.2.1 06-Nov-1996  lukem initial nsswitch implementation
 1.4.24.1 18-May-2008  yamt sync with head.
 1.5.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5.10.1 28-Apr-2008  martin file hesiod.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.7 24-Oct-2019  kamil Switch the iconv(3) prototype to the POSIX conformant variation

Remove const from the 2nd argument.

const char ** and char ** are incompatible types and it was a cost to keep
the technically incompatible form for a more purist variation. NetBSD was
almost the last alive OS to still keep the const argument (known leftovers:
Minix and Illumos).

Keep the const form for the internal purposes inside citrus and rump.

Address the build breakage fallout in the same change.

There are no ABI changes.

Change accepted by core@.
 1.6 03-Feb-2005  perry branches: 1.6.96;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.5 02-Aug-2004  tshiozak revert the last all changes related to iconv(3).
 1.4 01-Aug-2004  tshiozak make sure that the iconv(3) follows the POSIX specification;
change the 2nd argument from "const char ** restrict" to "char ** restrict".
 1.3 22-Aug-2003  kleink Sprinkle some restrict, repair a minor nit in iconv(3)'s synopsis.
 1.2 01-Jul-2003  tshiozak change iconv_t definision : void * -> struct __tag_iconv_t *.
suggested by yamt.
 1.1 27-Jun-2003  tshiozak Citrus iconv support(4)
add iconv external I/F (iconv.h - iconv_open()/iconv()/iconv_close()) and
iconv(1) utility.
TODO:
- bump libc minor.
- add iconv data files.
- create manpages: iconv_open(3)/iconv(3)/iconv_close(3)/iconv(1)/
mkesdb(1)/mkcsmapper(1).
 1.6.96.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.9 27-Mar-2011  mrg finish the ieeefp.h vs fp_prec_t hack from the previous change and
don't try to define a type when "fp_prec" isn't defined.

this lets my non-x86 (and i presume non-m68k) builds pass again.
 1.8 26-Mar-2011  christos add fpgetprec/fpsetprec
 1.7 18-Nov-2005  christos PR/32108: Greg Oster: fpgetmask() linking failure with g++ on macppc
Missing __{BEGIN,END}_DECLS.
 1.6 03-Feb-2005  perry branches: 1.6.2;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.5 13-Jun-2000  simonb branches: 1.5.10;
Remove 'extern' from function declarations.
 1.4 09-Jan-1998  perry branches: 1.4.8;
RCS Id Police.
 1.3 09-Apr-1995  mycroft Move fp_except and fp_rnd definitions to machine/include.
 1.2 09-Apr-1995  mycroft Correct fp_rnd for i386. Add FP_X_* for m68k.
 1.1 07-Apr-1995  jtc New header file <ieeefp.h>, which provides a API for getting and setting
IEEE rounding mode, exception enable flags, and exception sticky flags.
 1.4.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.10.1 01-Dec-2005  riz Pull up following revision(s) (requested by oster in ticket #8833):
include/ieeefp.h: revision 1.7 via patch
PR/32108: Greg Oster: fpgetmask() linking failure with g++ on macppc
Missing __{BEGIN,END}_DECLS.
 1.6.2.1 21-Nov-2005  tron Pull up following revision(s) (requested by oster in ticket #967):
include/ieeefp.h: revision 1.7
PR/32108: Greg Oster: fpgetmask() linking failure with g++ on macppc
Missing __{BEGIN,END}_DECLS.
 1.8 21-Sep-2016  roy Add ifa_addrflags to ifaddrs (forgot to commit this file, thanks Ryo!)
 1.7 23-Jan-2016  dholland branches: 1.7.2;
Apparently a recent round of vandalism by the C++ standards committee
includes disallowing the standard and historic type name "unsigned". Add
a gratuitous "int" to recent changes.

C++ is really a blight on the world.
 1.6 22-Jan-2016  dholland u_char, u_int, u_long -> unsigned char, unsigned, unsigned long

This makes these headers work without _NETBSD_SOURCE.
 1.5 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.4 13-Jun-2000  simonb Remove 'extern' from function declarations.
 1.3 02-Mar-2000  kleink branches: 1.3.2;
Minor style nit.
 1.2 23-Feb-2000  itojun add freeifaddrs(), which reclaims region allocated by getifaddrs().
in sync with kame and bsdi.
 1.1 23-Feb-2000  itojun add getifaddrs(3) from bsdi4, as mentioned in tech-net (in SIOCGIFCONF
related thread).
this will save future apps from complexity of SIOCGIFCONF.

getifaddrs(3) does not use SIOCGIFCONF internally, it uses sysctl.
 1.3.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.11 16-Jan-2015  christos strtoi and strtou additions
 1.10 27-Apr-2013  joerg branches: 1.10.6;
Include sys/featuretest.h before using _NETBSD_SOURCE.
 1.9 16-Apr-2013  joerg Add strtol_l and friends. Switch _citrus_bcs_strtol to use plain
strtol_l unless in tools mode. Add note to retire the BCS code on the
next libc major bump.
 1.8 16-Apr-2013  joerg Add support for wcstoimax_l and friends.
 1.7 15-Nov-2009  christos branches: 1.7.8; 1.7.14;
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.6 04-Aug-2008  matt branches: 1.6.4; 1.6.6; 1.6.14;
Add C99 imaxabs and imaxdiv protoypes and imaxdiv_t typedef.
 1.5 28-Apr-2008  martin branches: 1.5.2;
Remove clause 3 and 4 from TNF licenses
 1.4 18-Apr-2005  kleink branches: 1.4.18;
Instead of pulling in all of <wchar.h>, just define wchar_t here.
Addresses PR lib/29987.
 1.3 03-Feb-2005  perry branches: 1.3.2;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.2 11-Mar-2003  tshiozak branches: 1.2.4;
add wcstoll, wcstoimax, wcstoull and wcstoumax. (lib/20656)
- these are defined in C99 (wcsto[ui]max) and SUSv3.
- these implementations are written by sigsegv@s25.xrea.com,
derived from NetBSD's wcstol/wcstoul.
- I just added some comments.
 1.1 28-Apr-2001  kleink branches: 1.1.2;
* Move definitions of exact-width integer types from <machine/types.h>
to <sys/types.h> and <sys/stdint.h>.
* Add a new C99 <stdint.h> header, which provides integer types of
explicit width, related limits and integer constant macros.
* Extend <inttypes.h> to provide <stdint.h> definitions and format
macros for printf() and scanf().
* Add C99 strtoimax() and strtoumax() functions.
* Use the latter within scanf().
* Add C99 %j, %t and %z printf()/scanf() conversions for
intmax_t, pointer-type and size_t arguments.
 1.1.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.1.2.1 28-Apr-2001  nathanw file inttypes.h was added on branch nathanw_sa on 2001-10-08 20:13:45 +0000
 1.2.4.1 24-May-2005  riz Pull up revision 1.4 (requested by kleink in ticket #1547):
Instead of pulling in all of <wchar.h>, just define wchar_t here.
Addresses PR lib/29987.
 1.3.2.1 21-Apr-2005  tron Pull up revision 1.4 (requested by kleink in ticket #172):
Instead of pulling in all of <wchar.h>, just define wchar_t here.
Addresses PR lib/29987.
 1.4.18.1 18-May-2008  yamt sync with head.
 1.5.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.6.14.1 20-May-2011  bouyer Pull up following revision(s) (requested by joerg in ticket #1611):
include/inttypes.h: revision 1.7
include/stddef.h: revision 1.16
include/wchar.h: revision 1.28
include/stdlib.h: revision 1.90
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.6.6.2 04-Aug-2008  matt Add C99 imaxabs and imaxdiv protoypes and imaxdiv_t typedef.
 1.6.6.1 04-Aug-2008  matt file inttypes.h was added on branch christos-time_t on 2008-08-04 21:19:46 +0000
 1.6.4.1 20-May-2011  bouyer Pull up following revision(s) (requested by joerg in ticket #1611):
include/inttypes.h: revision 1.7
include/stddef.h: revision 1.16
include/wchar.h: revision 1.28
include/stdlib.h: revision 1.90
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.7.14.1 23-Jun-2013  tls resync from head
 1.7.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.6.1 22-Apr-2015  snj Pull up following revision(s) (requested by roy in ticket #648):
common/lib/libc/stdlib/_strtoi.h: revisions 1.1, 1.2
common/lib/libc/stdlib/strtoi.c: revision 1.1
common/lib/libc/stdlib/strtou.c: revision 1.1
distrib/sets/lists/base/ad.aarch64: patch
distrib/sets/lists/base/ad.arm: patch
distrib/sets/lists/base/ad.mips: patch
distrib/sets/lists/base/ad.powerpc: patch
distrib/sets/lists/base/md.amd64: patch
distrib/sets/lists/base/md.sparc64: patch
distrib/sets/lists/base/shl.mi: patch
distrib/sets/lists/comp/mi: revision 1.1939
distrib/sets/lists/debug/ad.aarch64: patch
distrib/sets/lists/debug/ad.arm: patch
distrib/sets/lists/debug/ad.mips: patch
distrib/sets/lists/debug/ad.powerpc: patch
distrib/sets/lists/debug/md.amd64: patch
distrib/sets/lists/debug/md.sparc64: patch
distrib/sets/lists/debug/shl.mi: patch
include/inttypes.h: revision 1.11
lib/libc/shlib_version: patch
lib/libc/stdlib/Makefile.inc: revision 1.84
lib/libc/stdlib/strtol.3: revisions 1.27-1.31
lib/libc/stdlib/strtoul.3: revisions 1.26-1.29
sys/lib/libkern/Makefile.libkern: revision 1.37
sys/lib/libkern/libkern.h: revision 1.117
tools/compat/Makefile: revision 1.73
tools/compat/compat_defs.h: revision 1.101
tools/compat/configure.ac: revision 1.83
tools/compat/configure: revision 1.82
tools/compat/nbtool_config.h.in: revision 1.36
add strto{i,u} from Kamil Rytarowski as discussed in tech-userlevel.
--
strtoi and strtou additions
--
strtoi and strtou for the kernel
--
strtoi and strtou additions
--
strtoi and strtou man pages
--
strto{i,u}
--
regen
--
Remove trailing whitespace.
--
match variable names with man page (Kamil Rytarowski)
--
cleanups from (Kamil Rytarowski)
--
add strtoi strtou (Kamil Rytarowski)
--
PR/49640: Kamil Rytarowski: Improve error printing
--
Use existing month for Dd.
 1.2 26-Apr-2013  joerg Do not define the C++ alternative operator names as macros.
 1.1 17-Feb-1995  jtc branches: 1.1.82; 1.1.88;
For Normative Addendum 1.
We have this cr*p because no one would sa "no" to the danes.
 1.1.88.1 23-Jun-2013  tls resync from head
 1.1.82.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.17 22-Jan-2016  dholland u_char, u_int, u_long -> unsigned char, unsigned, unsigned long

This makes these headers work without _NETBSD_SOURCE.
 1.16 12-Sep-2011  christos add kvm_getkernelname()
 1.15 08-Nov-2007  joerg Add kvm_dump_header and implement kvm_dump_wrtheader on top of it.
This function allows the caller finer control of how the writes happen
and doesn't force stdio as interface. Optimise clear_gap a bit to not
fill the gap byte-wise. Bump minor version of libkvm.
 1.14 16-Jul-2005  christos branches: 1.14.10;
Cast large constant to int.
 1.13 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.12 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.11 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.10 26-Jun-2000  kleink branches: 1.10.2;
Do previous slightly different: /usr/share/misc/style no longer deems it ok
to rely on <sys/types.h> pulling in <sys/cdefs.h>; noticed by Simon Burge.
 1.9 26-Jun-2000  kleink Don't rely on <stdio.h> defining off_t, pull in <sys/types.h>.
 1.8 26-May-2000  simonb Prototypes for kvm interface to new KERN_PROC2 and KERN_PROC_ARGS sysctls.
 1.7 19-Apr-1996  leo Add kvm_dump* prototypes.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 19-Oct-1994  cgd be more careful with types.
 1.4 09-May-1994  cgd new kvm lib
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 01-Jun-1993  cgd add proto for kvm_getenv() call, to find environment variable string in
the same way kvm_getargs() gets argument string
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.10.2.1 23-Apr-2002  nathanw Make libkvm able to cope with a LWPified kernel.

Add a kvm_getlwps() function to retrieve the LWPs of a specific process.
 1.14.10.1 09-Jan-2008  matt sync with HEAD
 1.11 30-Oct-2024  riastradh Sprinkle <sys/featuretest.h> where _*_SOURCE macros are consulted.

Otherwise, the feature tests might come out wrong. For example,
header files that check for _NETBSD_SOURCE won't get the default when
no other _*_SOURCE macros are defined; header files that check for
_POSIX_C_SOURCE might miss _XOPEN_SOURCE, which is supposed to imply
a corresponding _POSIX_C_SOURCE.

PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
 1.10 19-Aug-2013  joerg branches: 1.10.38;
Add nl_langinfo_l, catopen_l and wcsftime_l.
 1.9 03-Feb-2005  perry branches: 1.9.54; 1.9.60;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.8 18-Jan-2004  yamt explicitly cast langinfo constants to nl_item.
 1.7 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.6 04-Jul-2003  tshiozak add definisions for ERA* and ALT_DIGITS.
 1.5 22-Mar-2001  tshiozak add "CODESET" symbol. (but not working yet)
 1.4 05-Sep-1999  kleink branches: 1.4.10;
Pull in <nl_types.h>, as suggested by XSH5.
 1.3 28-Apr-1995  jtc Winning Strategies has placed this code into the Public Domainsearch.h
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 21-Jun-1994  jtc Added langinfo.h header for nl_langinfo() function
 1.4.10.1 08-Apr-2001  nathanw Merge trunk onto branch.
 1.9.60.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.54.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.38.1 02-Aug-2025  perseant Sync with HEAD
 1.5 10-May-2008  christos branches: 1.5.8;
remove the const again - per core.
 1.4 28-Apr-2008  martin branches: 1.4.2;
Remove clause 3 and 4 from TNF licenses
 1.3 23-Apr-2008  plunky constify dirname(3) and basename(3)
 1.2 03-Feb-2005  perry branches: 1.2.24;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.1 02-Nov-1997  kleink Add <libgen.h> header, from XPG4.2.
 1.2.24.1 18-May-2008  yamt sync with head.
 1.4.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.5.8.2 10-May-2008  christos remove the const again - per core.
 1.5.8.1 10-May-2008  christos file libgen.h was added on branch christos-time_t on 2008-05-10 22:37:43 +0000
 1.45 09-Sep-2024  riastradh limits.h: Define PTHREAD_STACK_MIN and tidy up comments.

Define this to be 4096, which is (as far as I can tell) the smallest
possible page size on any architecture NetBSD supports. This should
be MIN_PAGE_SIZE instead, but I don't think that is exposed in any
way that doesn't badly pollute the namespace. We should maybe have a
__MIN_PAGE_SIZE defined in some header file exposed to userland.

Of course, applications actually need to allocate at least
sysconf(_SC_THREAD_STACK_MIN) = getpagesize() bytes, which may be
larger than PTHREAD_STACK_MIN.

The various feature flags (dates) like _POSIX_THREAD_ATTR_STACKADDR
are defined (or not defined) by unistd.h, not by limits.h, so there's
no value in mentioning them here -- and the comment is wrong about
most of them (we have implemented _POSIX_THREAD_ATTR_STACKADDR, for
example).

PR standards/45435: PTHREAD_KEYS_MAX et al. missing in <limits.h>
 1.44 15-Aug-2024  riastradh getentropy(3): Make this visible to POSIX.1-2024 applications.

Likewise GETENTROPY_MAX.

It is now part of POSIX:

https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/getentropy.html

Cite standard in man page too. While here, use `.Nm' rather than
`.Fn getentropy' for self-reference in the man page, for consistency
with other usage.

PR standards/58603: getentropy(3): update visibility and documentation
for POSIX.1-2024
 1.43 31-May-2022  riastradh branches: 1.43.2; 1.43.4;
libc: Reintroduce getentropy.

This was introduced two years ago when the getrandom/getentropy API
question was still open, and removed because the discussion was
ongoing. Now getentropy is more widely adopted and soon to be in
POSIX. So reintroduce the symbol into libc since we'll be keeping it
anyway. Discussion of details of the semantics, as interpreted by
NetBSD, is ongoing, but the symbol needs to get in before the
netbsd-10 branch. The draft POSIX text is
(https://www.opengroup.org/austin/docs/austin_1110.pdf):

SYNOPSIS
#include <unistd.h>

int getentropy(void *buffer, size_t length);

DESCRIPTION
The getentropy() function shall write length bytes of data
starting at the location pointed to by buffer. The output
shall be unpredictable high quality random data, generated by
a cryptographically secure pseudo-random number
generator. The maximum permitted value for the length
argument is given by the {GETENTROPY_MAX} symbolic constant
defined in <limits.h>.

RETURN VALUES
Upon successful completion, getentropy() shall return 0;
otherwise, -1 shall be retunred and errno set to indicate the
error.

ERRORS
The getentropy() function shall fail if:

[EINVAL] The value of length is greater than
{GETENTROPY_MAX}.

The getentropy() function may fail if:

[ENOSYS] The system does not provide the necessary
source of entropy.

RATIONALE
The getentropy() function is not a cancellation point.

Minor changes from the previous introduction of getentropy into libc:

- Return EINVAL, not EIO, on buflen > 256.
- Define GETENTROPY_MAX in limits.h.

The declaration of getentropy in unistd.h and definition of
GETENTROPY_MAX in limits.h are currently conditional on
_NETBSD_SOURCE. When the next revision of POSIX is finalized, we can
expose them also under _POSIX_C_SOURCE > 20yymmL as usual -- and this
can be done as a pullup without breaking existing compiled programs.
 1.42 15-Sep-2019  christos remove comment for incomplete x/open impl (kamil)
 1.41 15-Sep-2019  christos Remove the _INCOMPLETE_XOPEN_C063 stuff.
 1.40 04-Aug-2016  christos branches: 1.40.14;
Realtime signal support from GSoC 2016, Charles Cui.
 1.39 21-Jul-2016  njoly According to Opengroup online specifications[1], _POSIX_CPUTIME and
_POSIX_THREAD_CPUTIME options should be present in unistd.h not
limits.h. Move them with other options.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html
 1.38 10-Jun-2016  christos branches: 1.38.2;
GSoC 2016: Charles Cui: Add timer related macros
_POSIX_CPUTIME
_POSIX_THREAD_CPUTIME
_POSIX_DELAYTIMER_MAX
 1.37 10-Jun-2016  christos GSoC 2016: Charles Cui: add SEM_NSEMS_MAX
 1.36 08-Mar-2016  christos - GC pts_fired, and fix the comment about MAX_TIMERS
- Bump MAX_TIMERS to 36 so that we have 32 POSIX user timers which is the
minimum required.
 1.35 26-Feb-2016  christos We only have 28 timers available.
 1.34 29-May-2015  manu Make PTHREAD_KEYS_MAX dynamically adjustable

NetBSD's PTHREAD_KEYS_MAX is set to 256, which is low compared to
other systems like Linux (1024) or MacOS X (512). As a result some
setups tested on Linux will exhibit problems on NetBSD because of
pthread_keys usage beyond the limit. This happens for instance on
Apache with various module loaded, and in this case no particular
developper can be blamed for going beyond the limit, since several
modules from different sources contribute to the problem.

This patch makes the limit conigurable through the PTHREAD_KEYS_MAX
environement variable. If undefined, the default remains unchanged
(256). In any case, the value cannot be lowered below POSIX-mandated
_POSIX_THREAD_KEYS_MAX (128).

While there:
- use EXIT_FAILURE instead of 1 when calling err(3) in libpthread.
- Reset _POSIX_THREAD_KEYS_MAX to POSIX mandated 128, instead of 256.
 1.33 18-Nov-2012  manu branches: 1.33.8;
Add most system calls for POSIX extended API set, part 2, with test cases:
faccessat(2), fchmodat(2), fchownat(2), fstatat(2), mkdirat(2), mkfifoat(2),
mknodat(2), linkat(2), readlinkat(2), symlinkat(2), renameat(2), unlinkat(2),
utimensat(2), openat(2).

Also implement O_SEARCH for openat(2)

Still missing:
- some flags for openat(2)
- fexecve(2) implementation
 1.32 28-Mar-2012  christos branches: 1.32.2;
make CHAR_{MIN,MAX} work for both -fsigned-char and -funsigned-char
 1.31 06-Oct-2011  christos branches: 1.31.2;
Fix pthreads variables:
- Add missing stuff from Issue 6 (some of it commented out)
- Fix _POSIX_THREAD -> PTHREAD variable confusion
- Amend PTHREAD_KEYS_MAX to 256 since this is what libpthread defined internally
 1.30 16-Aug-2011  manu Add macros to hide OpenGroup extened API set 2 from GNU configure. This
is a temporary workaround until the implementation is completed.
 1.29 07-Jun-2010  tnozaki 1. MB_LEN_MAX switch MD to MI.
2. unfortunately hppa's MB_LEN_MAX is defined incorrectly 6 instead of 32
so we have to add more setlocale(3) __RENAME func, __setlocale50.
3. move setlocale1.c and setlocale32.c to lib/libc/compat/locale/*
prepareing for next libc major crunk.
4. bump libc minor version.
 1.28 27-Aug-2008  christos branches: 1.28.4; 1.28.6; 1.28.14;
Make _POSIX_TZNAME_MAX=6 per SUSv3, from Andy Shevchenko
 1.27 04-Aug-2008  matt Add _POSIX_HOST_NAME_MAX and _POSIX_SYMLOOP_MAX to <limits.h> and add some
references to them in <sys/param.h>
in <stdio.h> also export v*scanf when _ISOC99_SOURCE is defined

From andy dot shevchenko at gmail dot com.
 1.26 21-Sep-2007  rmind branches: 1.26.8;
- Correct the value of _POSIX_SYMLINK_MAX as defined in standard.
Closes PR/37007 by Ighighi.
- While here, increase _POSIX_CHILD_MAX as suggested by standard.
 1.25 07-Sep-2007  rmind Implementation of POSIX message queues.

Reviewed by: <ad>, <tech-kern>
 1.24 01-May-2007  rmind branches: 1.24.4;
- Create sysctl nodes for AIO.
- Add POSIX defined system variables and constants of AIO_LISTIO_MAX and
AIO_MAX values. Both with _POSIX_ASYNCHRONOUS_IO, provide them in
sysconf(3) and getconf(1) interfaces.
- Clean up sysconf(3) for handling sysctl nodes dynamically.
 1.23 10-Nov-2004  lukem Implement sysconf(3) _SC_GETGR_R_SIZE_MAX and _SC_GETPW_R_SIZE_MAX for
the 1003.1-2001 Thread Safe Functions (TSF) getgrnam_r(3) and getpwnam_r(3).

These are not implemented in sysctl(3) "user.*", since that adds a lot
of complexity in the implementation for no real benefit.
 1.22 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.21 16-Jul-2003  nathanw Add the _POSIX_THREAD and _POSIX_TIMER mandated minimum limits.
 1.20 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.19 18-Jan-2003  christos oops, erased word accidentally.
 1.18 18-Jan-2003  christos avoid TMP_MAX redefinition
 1.17 18-Nov-2002  kleink Update for 1003.1-2001 base and XSI changes.
 1.16 04-Aug-2002  soren Back out previous - I was confused.
 1.15 04-Aug-2002  soren Per IEEE 1003.1-2001, omit from <limits.h> those Pathname Variable Values
that may vary between filesystems: _POSIX_LINK_MAX, _POSIX_NAME_MAX, and
_POSIX_PATH_MAX. These are to be obtained from pathconf() instead.
 1.14 04-Aug-2002  soren As of IEEE (POSIX) 1003.1-2001, _POSIX_PATH_MAX must be at least 256 rather
than 255 and is now defined to include the terminating NUL.
 1.13 27-Sep-1999  kleink branches: 1.13.8;
1003.1c: add {LOGIN_NAME_MAX}.
 1.12 06-Sep-1999  kleink branches: 1.12.2;
Bump NL_TEXTMAX to 2048 (== _POSIX2_LINE_MAX, which is the minimum value
required by XSH5.)
 1.11 03-Aug-1998  kleink Per XSH5, define _XOPEN_IOV_MAX.
 1.10 08-Jul-1998  kleink For the sake of XPG3 and later, provide TMP_MAX; consistent with the defintion
in <stdio.h>. Also, rearrange name space protection a bit.
 1.9 02-Feb-1998  perry merge lite-2
 1.8 21-Oct-1996  jtc Fix typo: _POSIX_SSIZE_MAX was set to wrong value
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 05-Oct-1994  jtc Add constants required by XPG3
 1.5 12-Oct-1993  jtc POSIX2_VERSION macro is supposed to live in <unistd.h>
 1.4 24-Sep-1993  jtc Do not #define the _POSIX_FOO constants if compliling in strict ANSI mode.
Define the _POSIX_SSIZE_MAX, _POSIX_STREAM_MAX, and _POSIX_TZNAME_MAX constants
added in 1003.1-90.
 1.3 21-Sep-1993  jtc POSIX_EQUIV_CLASS_MAX was renamed POSIX_COLL_WEIGHTS_MAX in final draft
of POSIX.2.
Added definintion for _POSIX2_VERSION.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.12.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.8.2 10-Dec-2002  thorpej Sync with HEAD.
 1.13.8.1 13-Aug-2002  nathanw Catch up to -current.
 1.24.4.1 06-Nov-2007  matt sync with HEAD
 1.26.8.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.28.14.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.28.6.2 27-Aug-2008  christos Make _POSIX_TZNAME_MAX=6 per SUSv3, from Andy Shevchenko
 1.28.6.1 27-Aug-2008  christos file limits.h was added on branch christos-time_t on 2008-08-27 08:53:56 +0000
 1.28.4.1 17-Sep-2011  bouyer Pull up following revision(s) (requested by manu in ticket #1658):
sys/rump/include/rump/rump_syscalls.h: revision 1.52 via patch
sys/kern/init_sysent.c: revision 1.257 via patch
sys/rump/include/rump/rumpvnode_if.h: revision 1.12 via patch
lib/libc/sys/Makefile.inc: revision 1.208 via patch
sys/sys/syscallargs.h: revision 1.227 via patch
sys/kern/kern_exec.c: revision 1.317 via patch
sys/rump/librump/rumpkern/rump_syscalls.c: revision 1.74 via patch
include/limits.h: revision 1.30 via patch
sys/kern/syscalls.master: revision 1.251 via patch
sys/sys/vnode_if.h: revision 1.83 via patch
sys/sys/fcntl.h: revision 1.40 via patch
sys/sys/fcntl.h: revision 1.41 via patch
sys/kern/vfs_syscalls.c: revision 1.433 via patch
sys/rump/librump/rumpvfs/rumpvnode_if.c: revision 1.11 via patch
sys/kern/syscalls.c: revision 1.248 via patch
sys/sys/syscall.h: revision 1.244 via patch
lib/libc/sys/link.2: revision 1.25 via patch
include/unistd.h: revision 1.127 via patch
distrib/sets/lists/comp/mi: revision 1.1659 via patch
sys/sys/stat.h: revision 1.61 via patch
First stage of support for Extended API set 2. Most of the think is
unimplemented, except enough of linkat(2) to hardlink to a symlink.
Everything new in headers is guarded #ifdef _INCOMPLETE_XOPEN_C063 since
some software (e.g.: xcvs in our own tree) will assume they can use openat(2)
when AT_FDCWD is defined. _INCOMPLETE_XOPEN_C063 will go away once support
will be completed.
regen
improve comment about AT_* defines: they are not only used by linkat(2)
Add macros to hide OpenGroup extened API set 2 from GNU configure. This
is a temporary workaround until the implementation is completed.
 1.31.2.2 16-Jan-2013  yamt sync with (a bit old) head
 1.31.2.1 17-Apr-2012  yamt sync with head
 1.32.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.33.8.1 24-Nov-2015  martin Pull up following revision(s) (requested by manu in ticket #829):
lib/libpthread_dbg/pthread_dbg.c: revision 1.43 (via patch)
lib/libpthread/pthread_int.h: revision 1.91-1.92 (via patch)
lib/libc/stdlib/jemalloc.c: revision 1.37-1.38
lib/libpthread/pthread_tsd.c: revision 1.12-1.14 (via patch)
include/limits.h: revision 1.34 (via patch)
lib/libpthread/pthread.c: revision 1.146-1.147 (via patch)
lib/libpthread/pthread_key_create.3: revision 1.7 (via patch)

libpthread:

Make PTHREAD_KEYS_MAX dynamically adjustable
NetBSD's PTHREAD_KEYS_MAX is set to 256, which is low compared to
other systems like Linux (1024) or MacOS X (512). As a result some
setups tested on Linux will exhibit problems on NetBSD because of
pthread_keys usage beyond the limit. This happens for instance on
Apache with various module loaded, and in this case no particular
developper can be blamed for going beyond the limit, since several
modules from different sources contribute to the problem.
This patch makes the limit conigurable through the PTHREAD_KEYS_MAX
environement variable. If undefined, the default remains unchanged
(256). In any case, the value cannot be lowered below POSIX-mandated
_POSIX_THREAD_KEYS_MAX (128).

While there:
- use EXIT_FAILURE instead of 1 when calling err(3) in libpthread.
- Reset _POSIX_THREAD_KEYS_MAX to POSIX mandated 128, instead of 256.

Fix previous: Can't use calloc/malloc before we complete initialization
of the thread library, because malloc uses pthread_foo_specific, and it will
end up initializing itself incorrectly.

Thanks rump for not letting us use even mmap during initialization.

libc/jemalloc:

Fix non _REENTRANT build.
Defer using pthread keys until we are threaded.
From Christos, fixes PR port-arm/50087 by allowing malloc calls prior
to libpthread initialization.
 1.38.2.2 06-Aug-2016  pgoyette Sync with HEAD
 1.38.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.40.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.43.4.1 02-Aug-2025  perseant Sync with HEAD
 1.43.2.2 11-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #945):

include/limits.h: revision 1.45

limits.h: Define PTHREAD_STACK_MIN and tidy up comments.

Define this to be 4096, which is (as far as I can tell) the smallest
possible page size on any architecture NetBSD supports. This should
be MIN_PAGE_SIZE instead, but I don't think that is exposed in any
way that doesn't badly pollute the namespace. We should maybe have a
__MIN_PAGE_SIZE defined in some header file exposed to userland.

Of course, applications actually need to allocate at least
sysconf(_SC_THREAD_STACK_MIN) = getpagesize() bytes, which may be
larger than PTHREAD_STACK_MIN.

The various feature flags (dates) like _POSIX_THREAD_ATTR_STACKADDR
are defined (or not defined) by unistd.h, not by limits.h, so there's
no value in mentioning them here -- and the comment is wrong about
most of them (we have implemented _POSIX_THREAD_ATTR_STACKADDR, for
example).

PR standards/45435: PTHREAD_KEYS_MAX et al. missing in <limits.h>
 1.43.2.1 09-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #938):

lib/libc/gen/getentropy.3: revision 1.7
include/limits.h: revision 1.44
include/unistd.h: revision 1.167

getentropy(3): Make this visible to POSIX.1-2024 applications.

Likewise GETENTROPY_MAX.

It is now part of POSIX:
https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/getentropy.html

Cite standard in man page too. While here, use `.Nm' rather than
`.Fn getentropy' for self-reference in the man page, for consistency
with other usage.

PR standards/58603: getentropy(3): update visibility and documentation
for POSIX.1-2024
 1.13 28-Apr-2008  martin branches: 1.13.10;
Remove clause 3 and 4 from TNF licenses
 1.12 19-Mar-1999  thorpej branches: 1.12.44;
Move the link.h files for the different shlib formats via repository copy,
and rename them to match the executable format. Introduce a new link.h
file which automatically picks the correct header based on the target of
the toolchain.
 1.11 23-Dec-1996  pk <link.h> is now installed from the rtld source directory.
 1.10 09-Jan-1996  pk Define LD_HINTS_VERSION_2:
- no longer hash on minor version number in hints file.
- add list of ldconfig(8) search directories.
 1.9 23-Sep-1995  pk branches: 1.9.2;
Define `dlexit()' in crt<=>rtld interface (active in v4).
 1.8 05-Jun-1995  pk Put dlopen() et.al. declarations in separate header file for compatibility.
 1.7 04-Jun-1995  pk Revive library search paths.
 1.6 23-Dec-1994  pk Put a reserved field into use (weak symbol support).
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 24-May-1994  pk Enable dl*() prototypes.
 1.3 28-Jan-1994  pk Redone from scratch, but maintain SunOS compatibility.
 1.2 22-Oct-1993  pk Some definitions for the `ld.so.hints' file.
 1.1 17-Oct-1993  pk Moved <link.h> here from usr.bin/ld as it is needed by other modules
and utilities (eg. crt0, libc, nm).
 1.9.2.1 16-Feb-1996  pk Update from trunk; needed for rtld patch.
 1.12.44.1 18-May-2008  yamt sync with head.
 1.13.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.13.10.1 28-Apr-2008  martin file link.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.23 23-Jan-2016  dholland Apparently a recent round of vandalism by the C++ standards committee
includes disallowing the standard and historic type name "unsigned". Add
a gratuitous "int" to recent changes.

C++ is really a blight on the world.
 1.22 22-Jan-2016  dholland u_char, u_int, u_long -> unsigned char, unsigned, unsigned long

This makes these headers work without _NETBSD_SOURCE.
 1.21 28-Apr-2008  martin branches: 1.21.10;
Remove clause 3 and 4 from TNF licenses
 1.20 03-Feb-2005  perry branches: 1.20.24;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.19 14-Sep-2000  wiz Fix two typos
 1.18 09-Feb-2000  kristerw Const poisoning of dladdr (so that things build after the dlfcn.h change)
 1.17 19-Mar-1999  thorpej Move the link.h files for the different shlib formats via repository copy,
and rename them to match the executable format. Introduce a new link.h
file which automatically picks the correct header based on the target of
the toolchain.
 1.16 15-Dec-1998  pk Pull in <a.out.h>.
 1.15 19-Oct-1998  matt Add AUX_LABEL (need for VAX JSB/JMP "jmp" slots).
 1.14 05-Sep-1998  pk Assign my copyrights to TNF.
 1.13 14-May-1998  thorpej Need <dlfcn.h> for Dl_info.
 1.12 12-May-1998  pk Add `dladdr()' rtld entry point.
 1.11 03-Jan-1997  scottr Catch up with const changes to dlopen() and dlsym() prototypes in
<dlfcn.h>. Tested on i386 and hp300 for crt0.o and ld.so, verified
other references by inspection.
 1.10 09-Jan-1996  pk Define LD_HINTS_VERSION_2:
- no longer hash on minor version number in hints file.
- add list of ldconfig(8) search directories.
 1.9 23-Sep-1995  pk branches: 1.9.2;
Define `dlexit()' in crt<=>rtld interface (active in v4).
 1.8 05-Jun-1995  pk Put dlopen() et.al. declarations in separate header file for compatibility.
 1.7 04-Jun-1995  pk Revive library search paths.
 1.6 23-Dec-1994  pk Put a reserved field into use (weak symbol support).
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 24-May-1994  pk Enable dl*() prototypes.
 1.3 28-Jan-1994  pk Redone from scratch, but maintain SunOS compatibility.
 1.2 22-Oct-1993  pk Some definitions for the `ld.so.hints' file.
 1.1 17-Oct-1993  pk Moved <link.h> here from usr.bin/ld as it is needed by other modules
and utilities (eg. crt0, libc, nm).
 1.9.2.1 16-Feb-1996  pk Update from trunk; needed for rtld patch.
 1.20.24.1 18-May-2008  yamt sync with head.
 1.21.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.21.10.1 28-Apr-2008  martin file link_aout.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.13 22-Sep-2020  kamil Remove duplicate word in a comment
 1.12 21-Sep-2020  kamil Upgrade the SVR4 RTLD r_debug protocol to version 1

Changes:
- Add a new field r_ldbase in the r_debug struct.
- Set r_version to 1.

This harmonizes the support with OpenBSD and Linux.
FreeBSD uses version 0 (or no version).
Solaris uses version 2 that is not implemented elsewhere and relies on
SVR4 specific design and interfaces.

Update the code comments as r_debug and link_map is used by other software
than GDB, namely: sanitizers, rump, LLDB.
 1.11 21-Sep-2020  kamil Refine the documentation of r_debug

Obtained from OpenBSD link.h r.1.15.
 1.10 16-Oct-2010  skrll Implement dl_iterate_phdr.

Somewhat taken from FreeBSD. Manual page from OpenBSD.
 1.9 14-Oct-2010  skrll Move a comment so that it is correct.
 1.8 04-Nov-2009  pooka branches: 1.8.2;
typedef struct link_map as Link_map (for solaris-compat)
 1.7 11-Jan-2006  uwe branches: 1.7.28; 1.7.36;
Fix comment indentation after __P was deleted.
 1.6 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.5 19-Mar-1999  thorpej Move the link.h files for the different shlib formats via repository copy,
and rename them to match the executable format. Introduce a new link.h
file which automatically picks the correct header based on the target of
the toolchain.
 1.4 01-Mar-1999  christos KNF
 1.3 30-Oct-1998  jonathan gdb's shared-lib mapping code in solib.c has #ifdef dependencies on
DT_MIPS_RLD_MAP being defined on mips targets with shared libs. Since
netbsd's gdb config.h defines HAVE_LINK_H, link.h is expected to
provide it. So #include <machine/elf_machdep.h> to make it so.
 1.2 25-Mar-1998  mhitch Add support for mips.
 1.1 16-Dec-1996  cgd branches: 1.1.2;
First cut at an ELF shared loader. Originally from John Polstra's FreeBSD elf
kit, then hacked on by Matt Thomas <matt@3am-software.com>, then by me (to
make it work with new versions of the toolchain, etc.). This runs, but it's
in serious need of cleaning and/or a fair bit of reworking. See the README
file for more information, and a list of things to do.
 1.1.2.2 30-Oct-1998  cgd pull up rev 1.3 from trunk (jonathan)
 1.1.2.1 08-May-1998  mycroft Sync with trunk, per request of mycroft.
 1.7.36.1 21-Apr-2010  matt sync to netbsd-5
 1.7.28.2 17-Mar-2012  bouyer Pull up following revision(s) via patch (requested by skrll in ticket #1724):
rescue/list.ldd: revision 1.4
lib/libc/dlfcn/dlfcn_elf.c: revision 1.7
libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.57
distrib/sets/lists/comp/mi: revision 1.1512
share/man/man3/Makefile: revision 1.56
libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.58
usr.bin/ldd/ldd.c: revision 1.15
libexec/ld.elf_so/rtld.h: revision 1.84
share/man/man3/dl_iterate_phdr.3: revision 1.1
libexec/ld.elf_so/rtld.c: revision 1.129
libexec/ld.elf_so/arch/powerpc/ppc_reloc.c: revision 1.44
libexec/ld.elf_so/rtld.h: revision 1.89
libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.36
libexec/ld.elf_so/map_object.c: revision 1.41
libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.37
libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.46
include/link_elf.h: revision 1.10
libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.29
libexec/ld.elf_so/arch/vax/mdreloc.c: revision 1.26
libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.34
libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.31
libexec/ld.elf_so/arch/alpha/alpha_reloc.c: revision 1.35
libexec/ld.elf_so/Makefile: revision 1.94
libexec/ld.elf_so/arch/hppa/hppa_reloc.c: revision 1.32
libexec/ld.elf_so/Makefile: revision 1.95
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.31
libexec/ld.elf_so/Makefile: revision 1.96
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.32
libexec/ld.elf_so/reloc.c: revision 1.98
libexec/ld.elf_so/arch/arm/mdreloc.c: revision 1.33
sys/sys/exec_elf.h: revision 1.106
libexec/ld.elf_so/rtld.c: revision 1.130
libexec/ld.elf_so/load.c: revision 1.37
libexec/ld.elf_so/rtld.c: revision 1.131
libexec/ld.elf_so/load.c: revision 1.38
libexec/ld.elf_so/rtld.h: revision 1.90
libexec/ld.elf_so/headers.c: revision 1.36
libexec/ld.elf_so/rtld.h: revision 1.95
libexec/ld.elf_so/arch/i386/mdreloc.c: revision 1.30
libexec/ld.elf_so/arch/m68k/mdreloc.c: revision 1.25
libexec/ld.elf_so/symbol.c: revision 1.50
libexec/ld.elf_so/symbol.c: revision 1.51
libexec/ld.elf_so/arch/sparc/mdreloc.c: revision 1.43
libexec/ld.elf_so/symbol.c: revision 1.52
libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.27
libexec/ld.elf_so/symbol.c: revision 1.54
PR/39240: Satoshi Suetake: Don't fail when attempting to resolve weak symbols
when we are doing immediate binding, leave them alone and they will be dealt
with later during lazy binding. From skrll@
Implement negative cache checks for symbol lookups.
Uses the Donelist idea from FreeBSD.
Use alloca(3) instead of local xmalloc for creating our DoneLists.
This allows threaded programs to use us a little better, PR lib/43005.
Implement dl_iterate_phdr.
Somewhat taken from FreeBSD. Manual page from OpenBSD.
 1.7.28.1 08-Nov-2009  snj Pull up following revision(s) (requested by pooka in ticket #1125):
include/link_elf.h: revision 1.8
typedef struct link_map as Link_map (for solaris-compat)
 1.8.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.28 29-Apr-2016  joerg Go back to just using normal visibility for the locale symbols. Without
an actual specifier like dllimport, protected visibility is unusable.
 1.27 17-Mar-2016  christos disable dso protected for clang now, so that packages can be built.
(again this is the binutils warning about copy relocations on protected objects)
 1.26 08-Mar-2016  christos undo protected symbol hack.
 1.25 29-Jan-2016  christos disable dso protected to work around binutils bug
 1.24 17-May-2013  joerg Too many endif.
 1.23 17-May-2013  joerg Only provide LC_C_LOCALE under _NETBSD_SOURCE.
 1.22 17-May-2013  joerg Provide explicit LC_C_LOCALE accessor and drop the various NULL checks.
Provide LC_GLOBAL_LOCALE in a way that works with all locale functions.
Merge constant data used by the initial global locale and the C locale.
Drop function call layer for _current_locale() and directly return the
locale reference, not a pointer to it. Use protected access for global
variables, so that libc references can avoid the GOT overhead.
 1.21 30-Apr-2013  joerg Make that to process PATH_LOCALE the first time _find_category is
called. Use this to implement newlocale and provide duplocale/freelocale
as well. Based on patches by Takehiko Nozaki with simplications and fix
for the init order by myself.
 1.20 27-Apr-2013  joerg Include sys/featuretest.h before using _NETBSD_SOURCE.
 1.19 17-Apr-2013  joerg Add localeconv_l.
 1.18 14-Apr-2013  joerg Rename struct _locale_impl_t to struct _locale, since it will end up as
locale_t later.
 1.17 07-Jun-2010  tnozaki branches: 1.17.6; 1.17.12;
1. MB_LEN_MAX switch MD to MI.
2. unfortunately hppa's MB_LEN_MAX is defined incorrectly 6 instead of 32
so we have to add more setlocale(3) __RENAME func, __setlocale50.
3. move setlocale1.c and setlocale32.c to lib/libc/compat/locale/*
prepareing for next libc major crunk.
4. bump libc minor version.
 1.16 11-Jan-2009  christos branches: 1.16.4;
merge christos-time_t
 1.15 02-Jan-2009  tnozaki Fixes PR lib/39662, shortcomings in LC_{MONETARY,NUMERIC,TIME,MESSAGES} db format.
ok'ed by core and releng.
(thanks for agc@, snj@ and i'm sorry for long time patience).

[libc]
- localeio.[ch] and lc*.[ch] in src/lib/libc/locale was replaced by
new locale-db implementation using citrus_db backend,
see src/lib/libc/citrus/citrus_lc_*.[ch].
- add citrus_bcs_strtou?l.c. don't use strtou?l locale implementation
internally, because they're locale-aware function.
- add some stubs for multi-locale issue, see {current,global}_locale.c.
- remove some obsolete file, setrunelocale.c, ___runetype_mb.c.
- remove __savectype() from ctypeio.[ch].

[tools]
- mklocale(1): add new option ``-t'' that generates new style
LC_{MONETARY,NUMERIC,TIME,MESSAGES} locale-db format.
- chrtbl(1): added ctypeio.[ch] for __savectype().

[locale-db]
- added en_US.US-ASCII locale.
- removed some shareable locale definition file:
en_US.US-ASCII -> en_US.ISO8859-1, en_US.UTF-8
zh_CN.eucCN -> zh_CN.GB18030
and more...see src/share/locale/*/Makefile.
- remove obsoleted locale sr_YU, added new locale sr_ME, sr_RS.
- change locale name ja_JP.ISO2022-JP* -> ja_JP.ISO-2022-JP*
for X11's locale.alias file alignments.
- fix regression test, wrong wcs?width(3), NAN/INF usage.

i tested release-build following arch:
i386, amd64, hpc{mips,arm,sh}, sparc64, vax.

citrus_lc_*.[ch] also can read old-plain-text style locale-db.
so that backward compatibility is keeped, but lc*.[ch] can't read
new citrus_db'ed locale-db and localeio.c never check sanity,
so forward compatibility is broken ;-<

old mklocale(1) doesn't know -t option, so you have to rebuild toolchain.
 1.14 03-Feb-2005  perry branches: 1.14.34; 1.14.36;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.13 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.12 02-Jan-2001  kleink C99: add new parameters int_p_cs_precedes, int_n_cs_precedes,
int_p_sep_by_space, int_n_sep_by_space, int_p_sign_posn and
int_n_sign_posn to monetary locale information.
 1.11 21-Dec-2000  itojun first import of citrus LC_CTYPE locale. singlebyte only at this moment.
shot-term TODO:
- enable multibyte locales. this includes loadable locale modules
(#ifdef DLRUNE).
- populate LC_CTYPE definition files.
- other functions such as iconv()
- make libc functions more friendly with multibyte.
- multilingualize other LC_xx
- torture tests

XXX don't forget to "make depend" when you rebuild libc, multibyte.c is
moved from lib/libc/stdlib to lib/libc/locale.
 1.10 08-Aug-2000  tshiozak Preparation for the future introduction of multibyte locale.
- MB_LEN_MAX is increased to 32.
- To ensure binary compatibility for old executables
under multibyte locale, versioned setlocale is added.
- __mb_len_cur definision is added in setlocale.c
and enable it in stdlib.h .
It is also important for multibyte locale stuffs,
but I just forgot.
 1.9 10-Jan-2000  kleink branches: 1.9.2; 1.9.4;
Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
std C headers including it, and a kernel module written in C++ would benfit
as well.
 1.8 22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.7 02-Feb-1998  perry merge lite-2
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 29-Sep-1994  jtc I've decided to move the definitions of private structures, etc. to
<sys/localedef.h> like AIX and OSF/1.
 1.4 25-May-1994  jtc First of the locale support code is going in...
 1.3 02-Sep-1993  jtc Add POSIX's LC_MESSAGES define. According to a net posting, it is needed
for xview. Like the rest of the locale stuff, it doesn't do anything (yet).
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.9.4.1 09-Aug-2000  tshiozak pull up the following changes (approved by thorpej):
> cvs rdiff -r1.9 -r1.10 basesrc/include/locale.h
> cvs rdiff -r1.45 -r1.46 basesrc/include/stdlib.h
> cvs rdiff -r1.16 -r1.17 basesrc/lib/libc/locale/Makefile.inc
> cvs rdiff -r1.17 -r1.18 basesrc/lib/libc/locale/setlocale.c
> cvs rdiff -r0 -r1.2 basesrc/lib/libc/locale/setlocale_sb.c
> cvs rdiff -r1.6 -r1.7 syssrc/sys/arch/alpha/include/limits.h
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/arm26/include/limits.h
> cvs rdiff -r1.7 -r1.8 syssrc/sys/arch/arm32/include/limits.h
> cvs rdiff -r1.14 -r1.15 syssrc/sys/arch/i386/include/limits.h
> cvs rdiff -r1.12 -r1.13 syssrc/sys/arch/m68k/include/limits.h
> cvs rdiff -r1.13 -r1.14 syssrc/sys/arch/mips/include/limits.h
> cvs rdiff -r1.10 -r1.11 syssrc/sys/arch/pc532/include/limits.h
> cvs rdiff -r1.6 -r1.7 syssrc/sys/arch/powerpc/include/limits.h
> cvs rdiff -r1.2 -r1.3 syssrc/sys/arch/sh3/include/limits.h
> cvs rdiff -r1.11 -r1.12 syssrc/sys/arch/sparc/include/limits.h
> cvs rdiff -r1.7 -r1.8 syssrc/sys/arch/sparc64/include/limits.h
> cvs rdiff -r1.9 -r1.10 syssrc/sys/arch/vax/include/limits.h
>
> Outline:
>
> Preparation for the future introduction of multibyte locale.
> - MB_LEN_MAX is increased to 32.
> - To ensure binary compatibility for old executables
> under multibyte locale, versioned setlocale is added.
> - __mb_len_cur definision is added in setlocale.c
> and enable it in stdlib.h .
> It is also important for multibyte locale stuffs,
> but I just forgot.
 1.9.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.14.36.1 10-Jan-2009  christos sync with head
 1.14.34.1 15-Jan-2009  snj Pull up following revision(s) (requested by tnozaki in ticket #222):
distrib/sets/lists/base/mi: revision 1.788
distrib/utils/libhack/Makefile.inc: revision 1.23
distrib/utils/libhack/Makefile: revision 1.22
etc/mtree/NetBSD.dist: revision 1.387
include/locale.h: revision 1.15
lib/libc/citrus/Makefile.inc: revision 1.6
lib/libc/citrus/citrus_aliasname_local.h: revision 1.1
lib/libc/citrus/citrus_bcs.h: revision 1.5
lib/libc/citrus/citrus_bcs_strtol.c: revision 1.1
lib/libc/citrus/citrus_bcs_strtoul.c: revision 1.1
lib/libc/citrus/citrus_csmapper.c: revision 1.9
lib/libc/citrus/citrus_fix_grouping.h: revision 1.1
lib/libc/citrus/citrus_lc_ctype.c: revision 1.1
lib/libc/citrus/citrus_lc_messages.c: revision 1.1
lib/libc/citrus/citrus_lc_messages.h: revision 1.1
lib/libc/citrus/citrus_lc_monetary.c: revision 1.1
lib/libc/citrus/citrus_lc_monetary.h: revision 1.1
lib/libc/citrus/citrus_lc_numeric.c: revision 1.1
lib/libc/citrus/citrus_lc_numeric.h: revision 1.1
lib/libc/citrus/citrus_lc_template.h: revision 1.1
lib/libc/citrus/citrus_lc_template_decl.h: revision 1.1
lib/libc/citrus/citrus_lc_time.c: revision 1.1
lib/libc/citrus/citrus_lc_time.h: revision 1.1
lib/libc/citrus/citrus_module.c: revision 1.8
lib/libc/citrus/citrus_namespace.h: revision 1.7
lib/libc/citrus/modules/citrus_euc.c: revision 1.13
lib/libc/gen/Makefile.inc: revision 1.166
lib/libc/gen/isctype.c: revision 1.17 via patch
lib/libc/gen/tolower_.c: revision 1.10
lib/libc/gen/toupper_.c: revision 1.10
lib/libc/iconv/Makefile.inc: revision 1.3
lib/libc/iconv/iconv.c: revision 1.7
lib/libc/locale/Makefile.inc: revision 1.53
lib/libc/locale/___runetype_mb.c: file removal
lib/libc/locale/_wctrans.c: revision 1.7
lib/libc/locale/_wctrans_local.h: revision 1.3
lib/libc/locale/_wctype.c: revision 1.1
lib/libc/locale/_wctype_local.h: revision 1.1
lib/libc/locale/aliasname.c: revision 1.3
lib/libc/locale/aliasname_local.h: revision 1.2
lib/libc/locale/bsdctype.c: revision 1.1
lib/libc/locale/bsdctype.h: revision 1.1
lib/libc/locale/ctypeio.c: revision 1.8
lib/libc/locale/ctypeio.h: revision 1.2
lib/libc/locale/current_locale.c: revision 1.1
lib/libc/locale/dummy_lc_collate.c: revision 1.1
lib/libc/locale/dummy_lc_template.h: revision 1.1
lib/libc/locale/fix_grouping.c: revision 1.1
lib/libc/locale/fix_grouping.h: revision 1.1
lib/libc/locale/generic_lc_all.c: revision 1.1
lib/libc/locale/generic_lc_template.h: revision 1.1
lib/libc/locale/generic_lc_template_decl.h: revision 1.1
lib/libc/locale/global_locale.c: revision 1.1
lib/libc/locale/iswctype.c: file removal
lib/libc/locale/iswctype_mb.c: revision 1.1
lib/libc/locale/iswctype_sb.c: revision 1.6
lib/libc/locale/lcmessages.c: file removal
lib/libc/locale/lcmessages.h: file removal
lib/libc/locale/lcmonetary.c: file removal
lib/libc/locale/lcmonetary.h: file removal
lib/libc/locale/lcnumeric.c: file removal
lib/libc/locale/lcnumeric.h: file removal
lib/libc/locale/lctime.c: file removal
lib/libc/locale/lctime.h: file removal
lib/libc/locale/localeconv.c: revision 1.15
lib/libc/locale/localeio.c: revision 1.2
lib/libc/locale/localeio.h: revision 1.2
lib/libc/locale/localeio_lc_ctype.c: revision 1.1
lib/libc/locale/localeio_lc_messages.c: revision 1.1
lib/libc/locale/localeio_lc_monetary.c: revision 1.1
lib/libc/locale/localeio_lc_numeric.c: revision 1.1
lib/libc/locale/localeio_lc_time.c: revision 1.1
lib/libc/locale/multibyte.h: revision 1.4
lib/libc/locale/multibyte_amd1.c: revision 1.6
lib/libc/locale/multibyte_c90.c: revision 1.5
lib/libc/locale/nb_lc_messages_misc.h: revision 1.1
lib/libc/locale/nb_lc_monetary_misc.h: revision 1.1
lib/libc/locale/nb_lc_numeric_misc.h: revision 1.1
lib/libc/locale/nb_lc_template.h: revision 1.1
lib/libc/locale/nb_lc_template_decl.h: revision 1.1
lib/libc/locale/nb_lc_time_misc.h: revision 1.1
lib/libc/locale/nl_langinfo.c: revision 1.12
lib/libc/locale/rune.c: revision 1.31
lib/libc/locale/rune.h: revision 1.13
lib/libc/locale/rune_local.h: revision 1.11
lib/libc/locale/runeglue.c: revision 1.14
lib/libc/locale/runetable.c: revision 1.18
lib/libc/locale/setlocale.c: revision 1.55 via patch
lib/libc/locale/setlocale_local.h: revision 1.1
lib/libc/locale/setrunelocale.c: file removal
lib/libc/nls/Makefile.inc: revision 1.9
lib/libc/nls/catopen.c: revision 1.26
lib/libc/string/Makefile.inc: revision 1.68
lib/libc/string/wcscmp.c: revision 1.6
lib/libc/string/wcsncmp.c: revision 1.6
lib/libc/string/wcswidth.c: file removal
lib/libc/string/wmemcmp.c: revision 1.4
regress/lib/libc/locale/Makefile: revision 1.4
regress/lib/libc/locale/ctype1/Makefile: revision 1.4
regress/lib/libc/locale/ctype1/en_US.UTF-8.exp.uue: revision 1.2
regress/lib/libc/locale/ctype1/ja_JP.ISO-2022-JP.exp.uue: revision 1.1
regress/lib/libc/locale/ctype1/ja_JP.ISO-2022-JP.in.uue: revision 1.1
regress/lib/libc/locale/ctype1/ja_JP.ISO2022-JP.exp.uue: file removal
regress/lib/libc/locale/ctype1/ja_JP.ISO2022-JP.in.uue: file removal
regress/lib/libc/locale/ctype1/ja_JP.SJIS.exp.uue: revision 1.2
regress/lib/libc/locale/ctype1/ja_JP.eucJP.exp.uue: revision 1.2
regress/lib/libc/locale/ctype2/Makefile: revision 1.5
regress/lib/libc/locale/ctype2/ja_JP.ISO-2022-JP-2.in.uue: revision 1.1
regress/lib/libc/locale/ctype2/ja_JP.ISO2022-JP2.in.uue: file removal
regress/lib/libc/locale/ctype3/Makefile: revision 1.5
regress/lib/libc/locale/mbtowc/Makefile: revision 1.3
regress/lib/libc/locale/mbtowc/ja_JP.ISO-2022-JP: revision 1.1
regress/lib/libc/locale/mbtowc/ja_JP.ISO2022-JP: file removal
regress/lib/libc/locale/wcstod/wcstod_test.c: revision 1.2
share/locale/Makefile.locale: revision 1.1
share/locale/Makefile: revision 1.5
share/locale/ctype/Makefile: revision 1.28
share/locale/locale.alias: revision 1.11
share/locale/messages/Makefile: revision 1.5
share/locale/messages/en_US.ISO8859-1.src: file removal
share/locale/messages/en_US.US-ASCII.src: revision 1.1
share/locale/messages/ja_JP.ISO-2022-JP.src: revision 1.1
share/locale/messages/ja_JP.ct.src: revision 1.1
share/locale/messages/sr_ME.ISO8859-2.src: revision 1.1
share/locale/messages/sr_ME.ISO8859-5.src: revision 1.1
share/locale/messages/sr_YU.ISO8859-2.src: file removal
share/locale/messages/sr_YU.ISO8859-5.src: file removal
share/locale/messages/sr_YU.UTF-8.src: file removal
share/locale/messages/zh_CN.GB18030.src: file removal
share/locale/messages/zh_TW.eucTW.src: revision 1.1
share/locale/monetary/Makefile: revision 1.5
share/locale/monetary/af_ZA.ISO8859-1.src: revision 1.2
share/locale/monetary/am_ET.UTF-8.src: revision 1.2
share/locale/monetary/be_BY.CP1131.src: file removal
share/locale/monetary/be_BY.CP1251.src: revision 1.2
share/locale/monetary/be_BY.ISO8859-5.src: revision 1.2
share/locale/monetary/be_BY.UTF-8.src: revision 1.2
share/locale/monetary/bg_BG.CP1251.src: revision 1.2
share/locale/monetary/bg_BG.UTF-8.src: revision 1.2
share/locale/monetary/ca_ES.ISO8859-1.src: revision 1.2
share/locale/monetary/cs_CZ.ISO8859-2.src: revision 1.2
share/locale/monetary/cs_CZ.UTF-8.src: revision 1.2
share/locale/monetary/da_DK.ISO8859-1.src: revision 1.2
share/locale/monetary/de_AT.ISO8859-1.src: revision 1.2
share/locale/monetary/de_CH.ISO8859-1.src: revision 1.2
share/locale/monetary/de_DE.ISO8859-1.src: revision 1.2
share/locale/monetary/el_GR.ISO8859-7.src: revision 1.2
share/locale/monetary/en_AU.ISO8859-1.src: revision 1.2
share/locale/monetary/en_CA.ISO8859-1.src: revision 1.2
share/locale/monetary/en_GB.ISO8859-1.src: revision 1.2
share/locale/monetary/en_GB.UTF-8.src: revision 1.2
share/locale/monetary/en_IE.UTF-8.src: revision 1.2
share/locale/monetary/en_NZ.ISO8859-1.src: revision 1.2
share/locale/monetary/en_US.ISO8859-1.src: revision 1.2
share/locale/monetary/en_US.US-ASCII.src: revision 1.1
share/locale/monetary/es_ES.ISO8859-1.src: revision 1.2
share/locale/monetary/et_EE.ISO8859-15.src: revision 1.2
share/locale/monetary/fi_FI.ISO8859-1.src: revision 1.2
share/locale/monetary/fr_BE.ISO8859-1.src: revision 1.2
share/locale/monetary/fr_CA.ISO8859-1.src: revision 1.2
share/locale/monetary/fr_FR.ISO8859-1.src: revision 1.2
share/locale/monetary/he_IL.UTF-8.src: revision 1.2
share/locale/monetary/hi_IN.ISCII-DEV.src: revision 1.2
share/locale/monetary/hr_HR.ISO8859-2.src: revision 1.2
share/locale/monetary/hu_HU.ISO8859-2.src: revision 1.2
share/locale/monetary/hy_AM.ARMSCII-8.src: revision 1.2
share/locale/monetary/hy_AM.UTF-8.src: revision 1.2
share/locale/monetary/is_IS.ISO8859-1.src: revision 1.2
share/locale/monetary/it_IT.ISO8859-1.src: revision 1.2
share/locale/monetary/ja_JP.ISO-2022-JP.src: revision 1.1
share/locale/monetary/ja_JP.UTF-8.src: revision 1.2
share/locale/monetary/ja_JP.eucJP.src: revision 1.2
share/locale/monetary/kk_KZ.PT154.src: revision 1.2
share/locale/monetary/kk_KZ.UTF-8.src: revision 1.2
share/locale/monetary/ko_KR.UTF-8.src: revision 1.2
share/locale/monetary/ko_KR.eucKR.src: revision 1.2
share/locale/monetary/lt_LT.ISO8859-13.src: revision 1.2
share/locale/monetary/mn_MN.UTF-8.src: revision 1.2
share/locale/monetary/nl_BE.ISO8859-1.src: revision 1.2
share/locale/monetary/nl_NL.ISO8859-1.src: revision 1.2
share/locale/monetary/no_NO.ISO8859-1.src: revision 1.2
share/locale/monetary/pl_PL.ISO8859-2.src: revision 1.2
share/locale/monetary/pl_PL.UTF-8.src: revision 1.2
share/locale/monetary/pt_BR.ISO8859-1.src: revision 1.2
share/locale/monetary/pt_PT.ISO8859-1.src: revision 1.2
share/locale/monetary/ro_RO.ISO8859-2.src: revision 1.2
share/locale/monetary/ru_RU.CP1251.src: revision 1.2
share/locale/monetary/ru_RU.CP866.src: revision 1.2
share/locale/monetary/ru_RU.ISO8859-5.src: revision 1.2
share/locale/monetary/ru_RU.KOI8-R.src: revision 1.2
share/locale/monetary/ru_RU.UTF-8.src: revision 1.2
share/locale/monetary/sk_SK.ISO8859-2.src: revision 1.2
share/locale/monetary/sl_SI.ISO8859-2.src: revision 1.2
share/locale/monetary/sr_ME.ISO8859-2.src: revision 1.1
share/locale/monetary/sr_RS.ISO8859-2.src: revision 1.1
share/locale/monetary/sr_YU.ISO8859-2.src: revision 1.2
share/locale/monetary/sr_YU.ISO8859-5.src: revision 1.2
share/locale/monetary/sr_YU.UTF-8.src: revision 1.2
share/locale/monetary/sv_SE.ISO8859-1.src: revision 1.2
share/locale/monetary/tr_TR.ISO8859-9.src: revision 1.2
share/locale/monetary/uk_UA.CP1251.src: revision 1.2
share/locale/monetary/uk_UA.ISO8859-5.src: revision 1.2
share/locale/monetary/uk_UA.KOI8-U.src: revision 1.2
share/locale/monetary/uk_UA.UTF-8.src: revision 1.2
share/locale/monetary/zh_CN.GB18030.src: revision 1.2
share/locale/monetary/zh_CN.UTF-8.src: revision 1.2
share/locale/monetary/zh_CN.eucCN.src: revision 1.2
share/locale/monetary/zh_HK.Big5hkscs.src: revision 1.1
share/locale/monetary/zh_HK.UTF-8.src: revision 1.2
share/locale/monetary/zh_TW.Big5.src: revision 1.2
share/locale/numeric/Makefile: revision 1.4
share/locale/numeric/am_ET.UTF-8.src: file removal
share/locale/numeric/en_US.ISO8859-1.src: file removal
share/locale/numeric/en_US.US-ASCII.src: revision 1.1
share/locale/numeric/ja_JP.eucJP.src: file removal
share/locale/numeric/ko_KR.eucKR.src: file removal
share/locale/numeric/mn_MN.UTF-8.src: file removal
share/locale/numeric/sr_ME.ISO8859-2.src: revision 1.1
share/locale/numeric/sr_YU.ISO8859-2.src: file removal
share/locale/numeric/sr_YU.ISO8859-5.src: file removal
share/locale/numeric/zh_CN.eucCN.src: file removal
share/locale/time/Makefile: revision 1.5
share/locale/time/en_US.ISO8859-1.src: file removal
share/locale/time/en_US.US-ASCII.src: revision 1.1
share/locale/time/ja_JP.ISO-2022-JP.src: revision 1.1
share/locale/time/ja_JP.ct.src: revision 1.1
share/locale/time/sr_ME.ISO8859-2.src: revision 1.1
share/locale/time/sr_ME.ISO8859-5.src: revision 1.1
share/locale/time/sr_ME.UTF-8.src: revision 1.1
share/locale/time/sr_YU.ISO8859-2.src: file removal
share/locale/time/sr_YU.ISO8859-5.src: file removal
share/locale/time/sr_YU.UTF-8.src: file removal
share/locale/time/zh_CN.GB18030.src: file removal
share/locale/time/zh_TW.eucTW.src: revision 1.1
usr.bin/locale/locale.c: revision 1.6
usr.bin/mklocale/Makefile: revision 1.12
usr.bin/mklocale/lex.l: revision 1.14
usr.bin/mklocale/mklocaledb.c: revision 1.1
usr.bin/mklocale/yacc.y: revision 1.25
usr.sbin/chrtbl/Makefile: revision 1.8
usr.sbin/chrtbl/ctypeio.c: revision 1.1
usr.sbin/chrtbl/ctypeio.h: revision 1.1
Fixes PR lib/39662, shortcomings in LC_{MONETARY,NUMERIC,TIME,MESSAGES}
db format.
ok'ed by core and releng.
(thanks for agc@, snj@ and i'm sorry for long time patience).
[libc]
- localeio.[ch] and lc*.[ch] in src/lib/libc/locale was replaced by
new locale-db implementation using citrus_db backend,
see src/lib/libc/citrus/citrus_lc_*.[ch].
- add citrus_bcs_strtou?l.c. don't use strtou?l locale implementation
internally, because they're locale-aware function.
- add some stubs for multi-locale issue, see {current,global}_locale.c.
- remove some obsolete file, setrunelocale.c, ___runetype_mb.c.
- remove __savectype() from ctypeio.[ch].
[tools]
- mklocale(1): add new option ``-t'' that generates new style
LC_{MONETARY,NUMERIC,TIME,MESSAGES} locale-db format.
- chrtbl(1): added ctypeio.[ch] for __savectype().
[locale-db]
- added en_US.US-ASCII locale.
- removed some shareable locale definition file:
en_US.US-ASCII -> en_US.ISO8859-1, en_US.UTF-8
zh_CN.eucCN -> zh_CN.GB18030
and more...see src/share/locale/*/Makefile.
- remove obsoleted locale sr_YU, added new locale sr_ME, sr_RS.
- change locale name ja_JP.ISO2022-JP* -> ja_JP.ISO-2022-JP*
for X11's locale.alias file alignments.
- fix regression test, wrong wcs?width(3), NAN/INF usage.

i tested release-build following arch:
i386, amd64, hpc{mips,arm,sh}, sparc64, vax.

citrus_lc_*.[ch] also can read old-plain-text style locale-db.
so that backward compatibility is keeped, but lc*.[ch] can't read
new citrus_db'ed locale-db and localeio.c never check sanity,
so forward compatibility is broken ;-<
old mklocale(1) doesn't know -t option, so you have to rebuild toolchain.
 1.16.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.17.12.1 23-Jun-2013  tls resync from head
 1.17.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13 23-Jan-2016  dholland Apparently a recent round of vandalism by the C++ standards committee
includes disallowing the standard and historic type name "unsigned". Add
a gratuitous "int" to recent changes.

C++ is really a blight on the world.
 1.12 22-Jan-2016  dholland u_char, u_int, u_long -> unsigned char, unsigned, unsigned long

This makes these headers work without _NETBSD_SOURCE.
 1.11 11-Jan-2009  christos merge christos-time_t
 1.10 07-Oct-2007  christos branches: 1.10.16;
don't set obsolete flags in SETALL. From Anon Ymous
 1.9 07-Oct-2007  christos fix reversed comment.
 1.8 06-Oct-2007  christos split LOGIN_SETGROUP -> LOGIN_SETGID|LOGIN_SETGROUPS
 1.7 20-Dec-2005  christos branches: 1.7.10;
expose setuserpath and setuserenv, now used by xdm.
 1.6 11-Dec-2004  christos Sprinkle const.
 1.5 21-Sep-2000  ad Remove dup (WRT util.h) decl of secure_path().
 1.4 18-Sep-2000  ad First argument to secure_path() is const. XXX Why is it re-declared here?
 1.3 18-Jul-2000  ad ANSIfy, libutil part is done.
 1.2 04-Feb-2000  mjl Add login_getpwclass to libutil as convenience function for
programs originally for FreeBSD.
Add parsing of "setenv" parameter which can be used to set
up an initial environment on login.
 1.1 12-Jan-2000  mjl Add necessary support routines for login.conf.
 1.7.10.1 06-Nov-2007  matt sync with HEAD
 1.10.16.1 28-Dec-2008  christos more compat changes
- new functions
- adjust utmp size.
 1.15 04-Nov-2024  christos Undo previous lwp.h change.
 1.14 03-Nov-2024  christos Split __lwp_getprivate_fast and __lwp_*tcb from mcontext.h into a separate
lwp.h file.
 1.13 08-Dec-2017  christos branches: 1.13.16;
make _lwp_park return the remaining time to sleep in the "ts" argument
if it is a relative timestamp, as discussed in tech-kern.
XXX: pullup-8
 1.12 31-Jan-2014  christos __lwp_park60
 1.11 11-Jan-2009  christos branches: 1.11.10; 1.11.16;
merge christos-time_t
 1.10 28-Apr-2008  martin branches: 1.10.10;
Remove clause 3 and 4 from TNF licenses
 1.9 13-Nov-2007  ad branches: 1.9.6;
Add _lwp_ctl() - sorry, I thought I had checked this in yesterday along
with makelintstub.
 1.8 07-Nov-2007  ad Add _lwp_setname, _lwp_getname.
 1.7 07-Aug-2007  ad branches: 1.7.2;
Change the signature of _lwp_park() to accept an lwpid_t and second
hint pointer, but do so in a way that remains compatible with older
pthread libraries. This can be used to wake another thread before the
calling thread goes asleep, saving at least one syscall + involuntary
context switch. This turns out to be a fairly large win on the condvar
benchmarks that I have tried.
 1.6 09-Feb-2007  ad Change _lwp_unpark_all() to return a 'ssize_t'.
 1.5 16-Jan-2007  ad Add: _lwp_kill, _lwp_detach, _lwp_park, lwp_unpark, _lwp_unpark_all.
 1.4 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.3 02-Oct-2004  kent correct the return value type of _lwp_self()
 1.2 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.1 05-Mar-2001  nathanw branches: 1.1.2;
file lwp.h was initially added on branch nathanw_sa.
 1.1.2.3 17-Jan-2003  thorpej * Add prototypes for _lwp_getprivate(2) and _lwp_setprivate(2).
* While here, since this is a user header file, __P'ify prototypes.
 1.1.2.2 03-Feb-2002  nathanw Add _lwp_wakeup()
 1.1.2.1 05-Mar-2001  nathanw User-level support for LWPs and scheduler activations.
SVR4-style ucontext code by Klaus Klein.
 1.7.2.1 09-Jan-2008  matt sync with HEAD
 1.9.6.1 18-May-2008  yamt sync with head.
 1.10.10.2 28-Dec-2008  christos more compat changes
- new functions
- adjust utmp size.
 1.10.10.1 28-Apr-2008  christos file lwp.h was added on branch christos-time_t on 2008-12-28 01:15:39 +0000
 1.11.16.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.16.1 02-Aug-2025  perseant Sync with HEAD
 1.8 12-Mar-2019  christos remove global pointers, add get/seters.
 1.7 10-Mar-2019  christos catch up with name change.
 1.6 10-Mar-2019  christos add missing externs.
 1.5 09-Mar-2019  christos add copyright.
 1.4 09-Mar-2019  christos PR/54050: Ryo ONODERA: Add the jemalloc-specific api prototypes and extern.
 1.3 26-Oct-1994  cgd branches: 1.3.124;
new RCS ID format.
 1.2 02-Aug-1993  mycroft Add RCS identifiers, remove some completely useless RCS logs and patchkit
headers, and a few other insignificant changes.
 1.1 15-Apr-1993  deraadt Because so much stuff expects it..
 1.3.124.1 10-Jun-2019  christos Sync with HEAD
 1.72 09-Sep-2024  riastradh math.h: Add math_errhandling, MATH_ERRNO, MATH_ERREXCEPT.

XXX Should maybe put a __math_errhandling in machine/math.h, but only
VAX uses MATH_ERRNO and that's not likely to change any time soon, so
this will serve for now with less churn.

PR standards/56234: missing C99 frobs in <math.h>
 1.71 09-Sep-2024  riastradh math.h: Define FP_FAST_FMA, FP_FAST_FMAF, FP_FAST_FMAL.

These are not strictly necessary to define, really, so we haven't
exactly been nonconformant. But they tell programs when they can
enable fast paths by using the fma(3) family of functions.

PR standards/56234: missing C99 frobs in <math.h>
 1.70 07-May-2024  riastradh branches: 1.70.2;
math.h: Move declarations under appropriate namespace tests.

Not sure about _REENTRANT, but if gamma_r and lgamma_r go under that
(even if _NETBSD_SOURCE isn't defined), then lgammal_r probably
should too.
 1.69 22-Jan-2024  kre It seems that we need prototypes for long double math functions, even
when !__HAVE_LONG_DOUBLE -- they still exist, but just aren't...

This might unbreak several more builds.
 1.68 22-Jan-2024  kre This set of changes seem to be sufficient to make at least the
amd64 port build again after the long double math function infusion
from yesterday.

Feel free (without consulting me, I'm just hacking about) to revert
any of this and do it a better way.

Note: this is not intended to be complete, in particular, in <math.h>
I added prototypes only for the functions that are needed for a
successful build, not all of the new ones...
 1.67 27-Aug-2022  christos branches: 1.67.2;
Add sincos{,f,l} from FreeBSD
 1.66 22-Feb-2020  joerg Correct C99 / C++11 feature testing. Document remaining missing symbols.
 1.65 24-Jun-2018  christos branches: 1.65.2; 1.65.4;
Fix the rest of the functions that have been made visible by xopen5,
posix 2017, and c99.
 1.64 24-Jun-2018  christos PR/53393: coypu: move rint to the right section.
 1.63 16-Sep-2013  martin branches: 1.63.24;
Allow archs to provide __isinf() and __isnan() as inline functions instead
of macros.
 1.62 19-Apr-2013  joerg If __FLT_EVAL_METHOD__ exists and is in {0,1,2}, provide float_t and
double_t.
 1.61 11-Feb-2013  matt FP_ILOGBNAN should be INT_MAX
 1.60 09-Feb-2013  matt Define FP_ILOGB0 and FP_ILOGBNAN
 1.59 28-Jan-2013  matt Add missing long double functions
 1.58 05-May-2012  christos branches: 1.58.2;
oops, forgot to commit: add tgamma and tgammaf
 1.57 05-Feb-2012  matt branches: 1.57.2;
Use __INFINITY in preference to __builtin_inff(). Currently only VAX defines
__INFINITY and allows to use __builtin_huge_valf() instead since gcc4.5 will
error out unconditionally if __builtin_inf() is used.
 1.56 28-Jul-2011  joerg branches: 1.56.2;
Add ilogbl(3).
 1.55 26-Jul-2011  joerg Add scalbnl to libm.
 1.54 06-Feb-2011  christos remquo{,f} from FreeBSD via Stathis Kamperis
 1.53 15-Sep-2010  christos branches: 1.53.2;
Commit SoC long double support from Stathis Kamperis
 1.52 02-May-2010  dholland typo in comment
 1.51 23-Feb-2010  joerg PR 36988: ISO C99 mandates that HUGE_VAL, HUGE_VALF, HUGE_VALL and
INFINITY are constant expressions.

Use the GCC builtins if possible to implement them.
 1.50 11-Jan-2010  christos branches: 1.50.2;
Add exp2 and exp2m
 1.49 04-Oct-2009  christos oops forgot to commit that one--- Add f{dim,min,max}{,l,f}
 1.48 22-Feb-2009  martin Make NAN a compile time constant (with help from the compiler). Suggested
by krister. Fixes PR 40695.
Make references to the old construct (which we can't remove for binary
compatibility reasons) emit a linker warning.
 1.47 25-Apr-2008  christos branches: 1.47.8; 1.47.10; 1.47.12; 1.47.16;
make name const.
 1.46 22-Feb-2007  drochner branches: 1.46.10;
-get cabs() and cabsf() out of public view - these are historical and
conflict with C99 functions which are builtins in newer gcc
(actually, the old cabs() is ABI compatible with the new _complex one
on i386, but this is purely accidental)
remove public prototypes and manpages, move the code into a compat
subdirectory as libc does so that binary compatibility is kept
-add a manpage for the isgreater() etc macros, borrowed from FreeBSD
 1.45 06-Feb-2007  drochner add the isgreater() at al. comparision macros defined in C99 and SUSv3;
use just the primitive macros for now (identical to FreeBSD/DragonFly)
which don't use gcc internals, the rest can go in after some testing;
addresses PR standards/25520
 1.44 25-Mar-2006  xtraeme Add trunc() and truncf() C99 functions, from FreeBSD.
 1.43 23-Mar-2006  kleink Add nan(3), nanf(3), and nanl(3); welcome libm.so.0.4.
 1.42 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.41 21-Jul-2005  christos Add log2f
 1.40 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.39 12-Jul-2004  kleink Move round() to the C99 section.
 1.38 10-Jul-2004  junyoung lib/24252: Add C99 functions round(3) and roundf(3).
libm minor unchanged; ride a recent bump.

From FreeBSD.
 1.37 01-Jul-2004  drochner being here, add the (l)lround(f) functions to libm
(almost the same like lrint)
 1.36 30-Jun-2004  drochner shut up lint's "long long" warnings
 1.35 30-Jun-2004  drochner Add (l)lrint(f).
Being here, move some C99 function declarations into the appropriate
section (as discussed with kleink).
 1.34 04-Mar-2004  kleink branches: 1.34.2;
* Turn isinf(3) and isnan(3) into C99-style macros.
* Make it possible for ports to override these (i.e., VAX).
* Remove isnanl(), which was internal to libc only.
 1.33 04-Mar-2004  kleink Make lint happy for __fpmacro_unary_floating() users.
 1.32 20-Jan-2004  kleink Move FP_ROP and FP_DIRTYZERO from <math.h> to <vax/math.h> (where they
would have ended up if I hadn't missed the latter file in the commit).
 1.31 20-Jan-2004  matt Add FP_ROP and FP_DIRTYZERO to MD range for VAX.
 1.30 17-Jan-2004  uwe Close the comment after #endif.
 1.29 15-Jan-2004  kleink Add C99 fpclassify(), isfinite(), isnormal(), and signbit() macros.
 1.28 26-Oct-2003  kleink C99 7.12#4: provide INFINITY, which defaults to HUGE_VALF.
If infinities are not available, the machine-dependent header must define
__INFINITY as a positive constant of type float that overflows.
 1.27 25-Oct-2003  kleink C99: provide HUGE_VALF and HUGE_VALL.
 1.26 17-May-2003  thorpej Add long double support.
 1.25 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.24 19-Feb-2002  simonb Clean up some rampant code duplication wrt ieee number handling:
- Add alignment-safe double and float unions.
- Use the above for the __infinity and __nan constants on all
architectures that use the standard ieee754 representation of
those constants.
- Add a single copy of various ieee754 math functions (frexp, isinf,
isnan, ldexp and modf) that had numerous duplicates among the
arch-specific directories.
- Use the above functions on all architectures where the generic C
versions where used. Architectures that had local assembly
routines are untouched (for those functions only).
 1.23 05-Jan-2001  christos branches: 1.23.2;
protect the incomplete cabs declarations with #ifndef __MATH_PRIVATE__ so that
the code that defines the functions can declare them properly.
 1.22 13-Jun-2000  simonb Remove 'extern' from function declarations.
 1.21 04-Jan-2000  kleink branches: 1.21.2;
const -> __const and include <sys/cdefs.h> earlier; fixes PR lib/9052
by Takahiro Kambe.
 1.20 23-Dec-1999  kleink C99: Define a NAN macro in <math.h> which evaulates to a constant expression of
a single-precision quiet NaN; only to be defined on platforms that do support
this value.
 1.19 16-Aug-1999  kleink Add missing isinff() declaration.
 1.18 31-Jan-1999  christos This file has still missing prototypes: cabs and cabsf... At least comment
what the arguments should be.
 1.17 15-Nov-1998  christos s/void/const void/
 1.16 15-Nov-1998  christos cast to void * first to avoid lint warning.
 1.15 07-Sep-1998  kleink Oops, isinf() was never included in any X/Open interface specification.
 1.14 26-Jul-1998  mycroft const poisoning.
 1.13 11-May-1998  kleink Fix comment typo in previous.
 1.12 07-May-1998  kleink Reorganize name space protection.
 1.11 08-Apr-1998  tv C++ has a very different concept of "exception." Delimit struct exception
and matherr() with #ifndef __cplusplus.
 1.10 26-Oct-1994  cgd new RCS ID format.
 1.9 10-Aug-1994  jtc Added prototypes for float versions of math functions.
Removed prototypes for internal functions.
 1.8 01-Mar-1994  jtc Add cabs() and drem(), for BSD libm compatibility.
 1.7 14-Feb-1994  cgd Add missing _. reported by several folks.
 1.6 11-Feb-1994  jtc New math.h, based on fdlibm's fdlibm.h.
 1.5 11-Oct-1993  jtc Moved definition of M_FOO constants into !_ANSI_SOURCE && !_POSIX_SOURCE
conditional.
 1.4 04-Aug-1993  jtc Use __pure qualifier.
 1.3 09-Jul-1993  cgd update for better FP routines, from AT&T & elsewhere
 1.2 21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.21.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.23.2.2 22-Mar-2002  nathanw Catch up to -current.
 1.23.2.1 11-Mar-2002  nathanw Catch up to -current.
 1.34.2.2 16-Jul-2004  he Pull up revision 1.39 (via patch, requested by junyoung in ticket #666):
Move round() and roundf() to the C99 section, thereby fixing
a namespace issue.
 1.34.2.1 15-Jul-2004  he Pull up revision 1.38 (via patch, requested by junyoung in ticket #664):
Add C99 functions round(3) and roundf(3).
Bump the teeny version number for libm.
 1.46.10.1 18-May-2008  yamt sync with head.
 1.47.16.2 29-Apr-2011  matt Use GCC builtin for NAN (sync with current)
 1.47.16.1 21-Apr-2010  matt sync to netbsd-5
 1.47.12.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.47.10.2 25-Apr-2008  christos make name const.
 1.47.10.1 25-Apr-2008  christos file math.h was added on branch christos-time_t on 2008-04-25 21:20:58 +0000
 1.47.8.2 12-Mar-2010  riz Pull up following revision(s) (requested by snj in ticket #1330):
lib/libm/man/fmax.3: revision 1.1-1.2
lib/libm/src/s_fmin.c: revision 1.1-1.2
lib/libm/src/s_fdim.c: revision 1.1
lib/libm/src/s_fmaxl.c: revision 1.1
lib/libm/Makefile: revision 1.90
include/math.h: revision 1.49
lib/libm/src/s_fmaxf.c: revision 1.1
lib/libm/src/s_fmax.c: revision 1.1
lib/libm/shlib_version: revision 1.10
distrib/sets/lists/base/md.sparc64: revision 1.63 (via patch)
distrib/sets/lists/base/shl.mi: revision 1.495 (via patch)
lib/libm/src/s_fminl.c: revision 1.1
distrib/sets/lists/comp/mi: revision 1.1317
lib/libm/man/fdim.3: revision 1.1-1.3
lib/libm/src/s_fminf.c: revision 1.1
distrib/sets/lists/base/md.amd64: revision 1.70 (via patch)
add f{min,max,dim}{,l,f} from FreeBSD
These functions are going to first appear in 5.1, not 6.0.
 1.47.8.1 06-Mar-2010  sborrill Pull up the following revisions(s) (requested by joerg in ticket #1315):
include/math.h: revision 1.51

Address PR#36988: ISO C99 mandates that HUGE_VAL, HUGE_VALF, HUGE_VALL and
INFINITY are constant expressions.
Use the GCC builtins if possible to implement them.
 1.50.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.50.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.50.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.53.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.56.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.56.2.2 23-May-2012  yamt sync with head.
 1.56.2.1 17-Apr-2012  yamt sync with head
 1.57.2.1 09-May-2012  riz Pull up following revision(s) (requested by christos in ticket #232):
distrib/sets/lists/comp/mi: revision 1.1756
lib/libm/Makefile: revision 1.124
lib/libm/src/math_private.h: revision 1.17
lib/libm/src/b_tgamma.c: revision 1.1
lib/libm/man/lgamma.3: revision 1.22
lib/libm/src/b_log.c: revision 1.1
lib/libm/src/b_exp.c: revision 1.1
include/math.h: revision 1.58
lib/libm/src/s_tgammaf.c: revision 1.1
add tgamma{,f}
Add tgamma{,f} from FreeBSD via rudolf, netbsd at eq dot cz
oops, forgot to commit: add tgamma and tgammaf
 1.58.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.58.2.2 23-Jun-2013  tls resync from head
 1.58.2.1 25-Feb-2013  tls resync with head
 1.63.24.1 25-Jun-2018  pgoyette Sync with HEAD
 1.65.4.1 28-Feb-2022  martin Pull up following revision(s) (requested by gdt in ticket #1430):

include/math.h: revision 1.66

Correct C99 / C++11 feature testing. Document remaining missing symbols.
 1.65.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.67.2.1 11-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #950):

include/math.h: revision 1.71
include/math.h: revision 1.72
distrib/sets/lists/debug/mi: revision 1.448
tests/lib/libm/t_errhandling.c: revision 1.1
tests/lib/libm/t_errhandling.c: revision 1.2
tests/lib/libm/t_errhandling.c: revision 1.3
distrib/sets/lists/tests/mi: revision 1.1337
tests/lib/libm/Makefile: revision 1.50

math.h: Define FP_FAST_FMA, FP_FAST_FMAF, FP_FAST_FMAL.

These are not strictly necessary to define, really, so we haven't
exactly been nonconformant. But they tell programs when they can
enable fast paths by using the fma(3) family of functions.

PR standards/56234: missing C99 frobs in <math.h>

math.h: Add math_errhandling, MATH_ERRNO, MATH_ERREXCEPT.
XXX Should maybe put a __math_errhandling in machine/math.h, but only
VAX uses MATH_ERRNO and that's not likely to change any time soon, so
this will serve for now with less churn.
PR standards/56234: missing C99 frobs in <math.h>

math.h: Add missing file for math_errhandling test.
PR standards/56234: missing C99 frobs in <math.h>

Add __TEST_FENV define to fix vax build

libm/t_errhandling.c: Put __TEST_FENV before any #includes.

This pattern avoids any potential problem with transitive inclusions
of fenv.h. (No change here because nothing else this file includes
transitively pulls in fenv.h, but being in the habit of doing it this
way avoids a class of problems.)

PR standards/56234: missing C99 frobs in <math.h>
 1.70.2.1 02-Aug-2025  perseant Sync with HEAD
 1.9 19-Jan-2024  christos Add missing decls
 1.8 01-Aug-2023  mrg fix simple mis-matched function prototype and definitions.

most of these are like, eg

void foo(int[2]);

with either of these

void foo(int*) { ... }
void foo(int[]) { ... }

in some cases (such as stat or utimes* calls found in our header files),
we now match standard definition from opengroup.

found by GCC 12.
 1.7 01-Jul-2016  christos define block length
 1.6 26-Dec-2005  perry u_intN_t -> uintN_t
 1.5 25-Sep-2005  xtraeme Add missing prototype for the MD5FileChunk() function. (hi elad!)
 1.4 24-Sep-2005  elad Fix prototype.
 1.3 24-Sep-2005  elad Define MD2_DIGEST_LENGTH and MD2_DIGEST_STRING_LENGTH.
Noted by xtraeme@.
 1.2 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.1 19-Mar-2001  atatat branches: 1.1.2;
Oops. Forgot md2.h header file.
 1.1.2.2 08-Apr-2001  nathanw Merge trunk onto branch.
 1.1.2.1 19-Mar-2001  nathanw file md2.h was added on branch nathanw_sa on 2001-04-08 20:31:41 +0000
 1.5 01-Oct-2003  christos make some files symlinks from sys.
 1.4 30-Sep-2003  christos include <sys/md.?> versions.
 1.3 07-Jul-2000  ad Pull in <sys/cdefs.h>, since we're using __BEGIN_DECLS/__END_DECLS.
 1.2 30-Apr-1997  thorpej - Liberal application of suggestions in /usr/share/misc/style.
- Protect function prototypes with __BEGIN_DECLS/__END_DECLS
 1.1 30-Jan-1997  thorpej Include files for MD4/MD5 routines, from FreeBSD.
 1.5 01-Oct-2003  christos make some files symlinks from sys.
 1.4 30-Sep-2003  christos include <sys/md.?> versions.
 1.3 11-Dec-2000  itojun split /usr/include/sys/md5.h and /usr/include/md5.h completely.
future direction: nuke /usr/include/sys/md5.h, it shouldn't be there as
we don't provide libkern to userland.
 1.2 30-Apr-1997  thorpej Move md5.h to <sys/md5.h> so that it may be included by the kernel.
A symlink is used to preserve <md5.h> compatibility.
 1.1 30-Jan-1997  thorpej Include files for MD4/MD5 routines, from FreeBSD.
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.4 02-Feb-1998  perry merge lite-2
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.20 18-Sep-2021  christos Change the default for ACLs to be posix1e instead of nfsv4 to match FreeBSD.
Requested by chuq.
 1.19 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.18 09-Jan-2018  christos Merge autofs support from: Tomohiro Kusumi
XXX: Does not work yet
 1.17 21-Feb-2016  christos Add relatime.
 1.16 22-Jan-2016  dholland Has __BEGIN_DECLS, needs sys/types.h.
 1.15 19-Oct-2012  drochner Implement experimental support to pass notifications that a file
was deleted from the filesystem to the disk driver, commonly
known as "discard" or "trim".
fs/driver support is in ffs and ata wd for now.
This is what was posted here:
http://mail-index.netbsd.org/tech-kern/2012/02/28/msg012813.html
with minor cleanup, and the global switch replaced by a mount option.
 1.14 17-Jun-2011  manu branches: 1.14.2; 1.14.8;
Add mount -o extattr option to enable extended attributs (corrently only
for UFS1).
Remove kernel option for EA backing store autocreation and do it by
default. Add a sysctl so that autocreated attriutr size can be modified.
 1.13 12-Jan-2009  pooka branches: 1.13.4; 1.13.8;
Add MOPT_RUMP to STDOPTS so it will be correctly ignored by everyone
else apart from /sbin/mount.
(missed this portion of the file yesterday. it was in the wrong tree)
 1.12 11-Jan-2009  pooka Support mount -o rump, which uses the rump server instead of using
the kernel service. E.g. "mount -t efs -o rump /dev/sgidev /mnt"
runs effectively "rump_efs /dev/sgidev /mnt".
 1.11 31-Jul-2008  simonb branches: 1.11.4; 1.11.6;
Merge the simonb-wapbl branch. From the original branch commit:

Add Wasabi System's WAPBL (Write Ahead Physical Block Logging)
journaling code. Originally written by Darrin B. Jewell while
at Wasabi and updated to -current by Antti Kantee, Andy Doran,
Greg Oster and Simon Burge.

OK'd by core@, releng@.
 1.10 31-Oct-2006  mjf branches: 1.10.18; 1.10.20;
Revert the changes I introduced trying to solve tmpfs' NFS export problem.
Requested by yamt@
 1.9 24-Oct-2006  mjf Add support to allow a file system to not permit being exported over NFS.

Approved by elad@ and wrstuden@
 1.8 16-Oct-2006  christos add MOPT_NULL
 1.7 12-Feb-2006  chs convert "magiclinks" from a per-fs mount option to a system-wide sysctl.
as discussed on tech-kern quite some time ago.
 1.6 23-Jun-2005  thorpej Implement expansion of special "magic" strings in symlinks into
system-specific values. Submitted by Chris Demetriou in Nov 1995 (!)
in PR kern/1781, modified only slighly by me.

This is enabled on a per-mount basis with the MNT_MAGICLINKS mount
flag. It can be enabled at mountroot() time by building the kernel
with the ROOTFS_MAGICLINKS option.

The following magic strings are supported by the implementation:

@machine value of MACHINE for the system
@machine_arch value of MACHINE_ARCH for the system
@hostname the system host name, as set with sethostname()
@domainname the system domain name, as set with setdomainname()
@kernel_ident the kernel config file name
@osrelease the releaes number of the OS
@ostype the name of the OS (always "NetBSD" for NetBSD)

Example usage:

mkdir /arch/i386/bin
mkdir /arch/sparc/bin
ln -s /arch/@machine_arch/bin /bin
 1.5 03-Feb-2005  perry branches: 1.5.2;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.4 13-Oct-2003  thorpej "force" is not an inverted option; fix it.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.2 11-Apr-2003  christos add functions to retrieve option values.
 1.1 22-Mar-2003  jdolecek move getmntopts(3) to libutil, build and install also it's manpage
bump libutil minor
adjust individual mount_*/Makefile to use libutil getmntopts(3)
 1.5.2.2 20-Jan-2006  riz Back out tickets 490, 559, and 560, which added "magic symlinks", at
the request of chs@ (thorpej@ concurs), as there is consensus that
this should be changed to a system-wide tunable, rather than a mount
option.
 1.5.2.1 29-Dec-2005  riz Pull up following revision(s) (requested by thorpej in ticket #490):
lib/libc/sys/mount.2: revision 1.33
sys/sys/systm.h: revision 1.179
sys/sys/fstypes.h: revision 1.4
include/mntopts.h: revision 1.6
sys/conf/newvers.sh: revision 1.41
sys/kern/vfs_syscalls.c: revision 1.223
sys/conf/files: revision 1.720
sys/kern/vfs_lookup.c: revision 1.61
share/man/man7/symlink.7: revision 1.7
sbin/mount/mount.8: revision 1.47
sys/kern/init_main.c: revision 1.248 via patch
share/man/man4/options.4: revision 1.280 via patch
Implement expansion of special "magic" strings in symlinks into
system-specific values. Submitted by Chris Demetriou in Nov 1995 (!)
in PR kern/1781, modified only slighly by me.
This is enabled on a per-mount basis with the MNT_MAGICLINKS mount
flag. It can be enabled at mountroot() time by building the kernel
with the ROOTFS_MAGICLINKS option.
The following magic strings are supported by the implementation:
@machine value of MACHINE for the system
@machine_arch value of MACHINE_ARCH for the system
@hostname the system host name, as set with sethostname()
@domainname the system domain name, as set with setdomainname()
@kernel_ident the kernel config file name
@osrelease the releaes number of the OS
@ostype the name of the OS (always "NetBSD" for NetBSD)
Example usage:
mkdir /arch/i386/bin
mkdir /arch/sparc/bin
ln -s /arch/@machine_arch/bin /bin
 1.10.20.1 10-Jun-2008  simonb Initial commit of Wasabi System's WAPBL (Write Ahead Physical Block
Logging) journaling code. Originally written by Darrin B. Jewell
while at Wasabi and updated to -current by Antti Kantee, Andy Doran,
Greg Oster and Simon Burge.

Still a number of issues - look in doc/BRANCHES for "simonb-wapbl"
for more info.
 1.10.18.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.11.6.2 31-Jul-2008  simonb Merge the simonb-wapbl branch. From the original branch commit:

Add Wasabi System's WAPBL (Write Ahead Physical Block Logging)
journaling code. Originally written by Darrin B. Jewell while
at Wasabi and updated to -current by Antti Kantee, Andy Doran,
Greg Oster and Simon Burge.

OK'd by core@, releng@.
 1.11.6.1 31-Jul-2008  simonb file mntopts.h was added on branch christos-time_t on 2008-07-31 05:38:05 +0000
 1.11.4.2 22-Jan-2009  snj Pull up following revision(s) (requested by pooka in ticket #288):
include/mntopts.h: revision 1.13
Add MOPT_RUMP to STDOPTS so it will be correctly ignored by everyone
else apart from /sbin/mount.
(missed this portion of the file yesterday. it was in the wrong tree)
 1.11.4.1 22-Jan-2009  snj Pull up following revision(s) (requested by pooka in ticket #288):
include/mntopts.h: revision 1.12
sbin/mount/mount.8: revision 1.63
sbin/mount/mount.c: revision 1.88
Support mount -o rump, which uses the rump server instead of using
the kernel service. E.g. "mount -t efs -o rump /dev/sgidev /mnt"
runs effectively "rump_efs /dev/sgidev /mnt".
 1.13.8.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.13.4.3 22-Oct-2010  uebayasi Put back MOPT_XIP.
 1.13.4.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.13.4.1 11-Feb-2010  uebayasi Add the new "xip" mount option.
 1.14.8.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.14.2.1 30-Oct-2012  yamt sync with head
 1.5 30-Oct-2024  riastradh Sprinkle <sys/featuretest.h> where _*_SOURCE macros are consulted.

Otherwise, the feature tests might come out wrong. For example,
header files that check for _NETBSD_SOURCE won't get the default when
no other _*_SOURCE macros are defined; header files that check for
_POSIX_C_SOURCE might miss _XOPEN_SOURCE, which is supposed to imply
a corresponding _POSIX_C_SOURCE.

PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
 1.4 08-Dec-2019  kre branches: 1.4.10;

PR lib/54744 (bruno@haible.de)

Add missing __END_DECLS for C++ compiles.

XXX pullup -9 XXX pullup -8 (bug not present in -7).
 1.3 16-Aug-2017  joerg branches: 1.3.4; 1.3.6;
Add missing strfmon_l. Noticed by Bruno Haible. Add test case.
 1.2 21-Sep-2008  christos branches: 1.2.6; 1.2.56;
add missing attributes to the remaining calls, even the ones that gcc has
builtin attributes for (for symmetry and consistency). In the future this
might change to use compiler-neutral macros. On the other hand I don't
know of any other compiler that provides other macros with similar
functionality, so why bother?
 1.1 03-Apr-2005  christos Add FreeBSD's strfmon(3). From Rui Paulo. No bump this time. Take advantage
of the getpwent_r bump.
 1.2.56.2 08-Dec-2019  martin Pull up following revision(s) (requested by kre in ticket #1470):

include/monetary.h: revision 1.4

PR lib/54744 (bruno@haible.de)
Add missing __END_DECLS for C++ compiles.

XXX pullup -9 XXX pullup -8 (bug not present in -7).
 1.2.56.1 29-Aug-2017  martin Pull up following revision(s) (requested by joerg in ticket #215):
tests/lib/libc/locale/t_strfmon.c: revision 1.1
tests/lib/libc/locale/Makefile: revision 1.12
lib/libc/stdlib/strfmon.c: revision 1.11
distrib/sets/lists/debug/mi: revision 1.224
include/monetary.h: revision 1.3
distrib/sets/lists/tests/mi: revision 1.761
lib/libc/stdlib/strfmon.3: revision 1.6
lib/libc/stdlib/strfmon.3: revision 1.7
Add missing strfmon_l. Noticed by Bruno Haible. Add test case.
Typo fix.
 1.2.6.2 21-Sep-2008  christos add missing attributes to the remaining calls, even the ones that gcc has
builtin attributes for (for symmetry and consistency). In the future this
might change to use compiler-neutral macros. On the other hand I don't
know of any other compiler that provides other macros with similar
functionality, so why bother?
 1.2.6.1 21-Sep-2008  christos file monetary.h was added on branch christos-time_t on 2008-09-21 16:59:47 +0000
 1.3.6.1 09-Dec-2019  martin Pull up following revision(s) (requested by kre in ticket #531):

include/monetary.h: revision 1.4

PR lib/54744 (bruno@haible.de)

Add missing __END_DECLS for C++ compiles.

XXX pullup -9 XXX pullup -8 (bug not present in -7).
 1.3.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.10.1 02-Aug-2025  perseant Sync with HEAD
 1.16 24-Sep-2016  christos remove mpool_getf
 1.15 24-Sep-2016  christos sync with mit/kerberos db
 1.14 22-Nov-2013  christos branches: 1.14.8;
use a TAILQ instead of a CIRCLEQ, from FreeBSD
 1.13 26-Aug-2008  joerg branches: 1.13.2; 1.13.6; 1.13.28;
Convert db from UCB types to POSIX types. Prefer uint8_t for u_char as
it is mostly about the wire format.

Patched libc.so is bit-identical.

OK matt@
 1.12 26-Dec-2005  perry branches: 1.12.20;
u_intN_t -> uintN_t
 1.11 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.10 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.9 07-Jul-2000  ad Pull in <sys/cdefs.h>, since we're using __BEGIN_DECLS/__END_DECLS.
 1.8 10-Feb-1998  perry add/cleanup multiple inclusion protection.
 1.7 03-May-1996  cgd merge DB 1.85 import
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 17-Aug-1994  cgd branches: 1.5.2;
clean up import
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 14-Jun-1993  cgd update db code to v1.6 from vangogh, and put it in "db" rather than "DB"
 1.2 27-May-1993  cgd new vangogh db (v1.5)
 1.1 18-Apr-1993  proven branches: 1.1.1;
Updated header files for libdb.
 1.1.1.3 02-Feb-1998  perry import lite-2
 1.1.1.2 03-May-1996  cgd Import of Berkeley DB version 1.85
 1.1.1.1 17-Aug-1994  cgd update to 1.79
 1.5.2.2 17-Aug-1994  cgd clean up import
 1.5.2.1 17-Aug-1994  cgd file mpool.h was added on branch netbsd-1-0 on 1994-08-17 22:59:00 +0000
 1.12.20.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.13.28.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.6.2 26-Aug-2008  joerg Convert db from UCB types to POSIX types. Prefer uint8_t for u_char as
it is mostly about the wire format.

Patched libc.so is bit-identical.

OK matt@
 1.13.6.1 26-Aug-2008  joerg file mpool.h was added on branch christos-time_t on 2008-08-26 21:18:39 +0000
 1.13.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14.8.1 04-Nov-2016  pgoyette Sync with HEAD
 1.4 11-Jan-2009  christos merge christos-time_t
 1.3 26-May-2008  rmind branches: 1.3.8;
Adjust and thus unify my license.
 1.2 28-Nov-2007  rmind branches: 1.2.6; 1.2.8;
Unify the license: All rights reserved.
No functional change.
 1.1 07-Sep-2007  rmind branches: 1.1.2;
Implementation of POSIX message queues.

Reviewed by: <ad>, <tech-kern>
 1.1.2.3 09-Jan-2008  matt sync with HEAD
 1.1.2.2 06-Nov-2007  matt sync with HEAD
 1.1.2.1 07-Sep-2007  matt file mqueue.h was added on branch matt-armv6 on 2007-11-06 23:11:05 +0000
 1.2.8.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.2.6.1 04-Jun-2008  yamt sync with head
 1.3.8.2 08-Nov-2008  christos changes for 64 bit time_t
 1.3.8.1 26-May-2008  christos file mqueue.h was added on branch christos-time_t on 2008-11-08 21:13:13 +0000
 1.15 03-Feb-2010  roy Userland now builds and uses terminfo instead of termcap.

OK: core@, jdc@
 1.14 13-Sep-2005  christos compat code reorg
 1.13 28-Apr-2004  kleink XPG4.2: Change member `dsize' of struct datum from int to size_t.
Version dbm_{delete,fetch,firstkey,nextkey,store}() accordingly.
Fixes PRs standards/21402 from Ben Harris and standards/25343 from
Murray Armfield.
 1.12 27-Apr-2004  kleink Un-__P().
 1.11 27-Apr-2004  kleink Remove declaration of dbm_forder(), which is not implemented.
 1.10 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.9 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.8 07-Jul-2000  ad Pull in <sys/cdefs.h>, since we're using __BEGIN_DECLS/__END_DECLS.
 1.7 07-May-1998  kleink Reorganize name space protecion. Also, change file mode argument to
dbm_open() from int to mode_t.
 1.6 20-Jul-1995  jtc prototype dbm_error and dbm_clearerr
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 14-Jun-1993  cgd update db code to v1.6 from vangogh, and put it in "db" rather than "DB"
 1.2 18-Apr-1993  proven Updated header files for libdb.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6 28-Apr-2008  martin branches: 1.6.10;
Remove clause 3 and 4 from TNF licenses
 1.5 09-Nov-2006  yamt branches: 1.5.16;
add comments.
 1.4 15-May-2005  dsl Make the arg to getnetconfigent const char * to match the man page (and
likely calling code).
 1.3 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.2 28-May-2004  christos PR/25003: John Kohl: File is missing a copyright.
 1.1 02-Jun-2000  fvdl branches: 1.1.4;
New headers for the new RPC code (based on TI-RPC from Sun).
 1.1.4.2 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 02-Jun-2000  minoura file netconfig.h was added on branch minoura-xpg4dl on 2000-06-23 15:45:57 +0000
 1.5.16.1 18-May-2008  yamt sync with head.
 1.6.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6.10.1 28-Apr-2008  martin file netconfig.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.72 16-Feb-2024  jkoshy Note that the NI_WITHSCOPEID flag is obsolete.
 1.71 09-Aug-2021  andvar fix various typos in compatibility, mainly in comments.
 1.70 04-Jun-2020  nia Remove bogus tests for 64-bit i386 and SuperH
 1.69 19-Aug-2013  christos fix gethostbyaddr prototype per TOG.
 1.68 04-May-2013  riz Add missing #endif (Hi, Christos!)
 1.67 03-May-2013  christos PR/25827, PR/32373: addr AI_SRV
 1.66 27-Apr-2013  joerg machine/ansi.h is included by sys/ansi.h.
 1.65 17-Mar-2012  christos branches: 1.65.2;
Add AI_ADDRCONFIG
 1.64 05-May-2010  christos branches: 1.64.6; 1.64.8;
PR/43258: Hauke Fath: remove duplicate setservent declaration
 1.63 25-Apr-2010  joerg Add the constant database reader (cdbr(3)) and writer ((cdbw(3)).
They implement a space efficent write-once database with fast access
path. Switch the services(5) database to use cdb. The size of the
database file decreases from 2.1MB disk space to 307KB. Access
performance is about the same if setservent(0) is used and about an
order of magnitude faster otherwise. services_mkdb defaults to the new
format, but can optionally create the old db(3) format as well for
statically linked legacy applications.
 1.62 02-Oct-2009  tsarna branches: 1.62.2;
Introduce allocaddrinfo(3) to make writing getaddrinfo() nss plugins easier.
Discussed on tech-net.
 1.61 12-Apr-2009  christos merge libbind
 1.60 21-Jun-2008  christos branches: 1.60.4; 1.60.6; 1.60.8; 1.60.10; 1.60.14;
sync with bind-9-5-0
 1.59 10-May-2007  christos branches: 1.59.12; 1.59.14;
Move .db files for services and netgroup to /var/db per gimpy's request.
 1.58 30-Mar-2007  ghen Resolve conflicts.
 1.57 28-Jan-2007  christos another merge botch.
 1.56 27-Jan-2007  christos Merge back all our changes.
 1.55 24-Nov-2006  christos branches: 1.55.2; 1.55.4;
fix spelling of accommodate; from Zapher.
 1.54 27-Jul-2006  christos add services.db
 1.53 17-Feb-2006  ginsbach Add EAI_OVERFLOW as specified in RFC3493, POSIX and XPG6.
 1.52 24-Jan-2006  christos PR/32614: Yves-Emmanuel JUTARD: Typing error in some comment ;-)
 1.51 18-Apr-2005  kleink Move the (at this time private) get{proto,serv}ent_r() prototypes and
data structures into the libc sources until the interface gets redone.
Approved by christos.
 1.50 21-Mar-2005  kleink Add restrict qualifiers to getaddrinfo() and getnameinfo() arguments.
 1.49 17-Mar-2005  kleink Remove already #if 0'ed getipnode*() prototypes and related definitions;
we are not going to ship those.
 1.48 03-Feb-2005  perry branches: 1.48.2;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.47 16-Nov-2004  itojun remove NI_WITHSCOPEID
 1.46 07-Nov-2004  christos Resolve conflicts.
 1.45 17-Aug-2004  jmc Fix proto for gethostent to match reality (takes void args)
 1.44 17-Aug-2004  ginsbach Restore gethostent() as a supported interface. Yes, it maybe obsolete
but it is specified by IEEE Std 1003.1, 2004 Edition (POSIX) and
the X/Open standards (Issue 6 and XNS 5.2).

* revert change removing gethostent() from gethostbyname(3) man page
* delete kruft from gethnamaddr.c leaving only gethostent() as a
wrapper around _gethtent().
* revert recent changes to <netdb.h>
+ restore gethostent() prototype
+ restore freehostent() prototype; handle similar to non-shipped
getipnodby*() prototypes
+ use correct XOPEN_SOURCE version (520 not 500) for freeaddrinfo()
prototype; interface specified by XNS5.2 not XNS5

Reviewd by <christos> and <drochner>.
 1.43 11-Aug-2004  drochner Delete prototypes for gethostent() and freehostent();
there functions don't exist in libc.
 1.42 25-May-2004  christos notyet is in the users namespace as pointed out by klaus.
 1.41 25-May-2004  christos we don't implement getipnode*(), so don't define their flags for now. It
confuses some software (ntpd).
 1.40 24-May-2004  yamt remove a duplicated prototype of getprotoent_r.
 1.39 21-May-2004  christos Import selected changes from bind9. Follow the copyright structure there.
 1.38 08-May-2004  kleink * __sparc64__ -> __sparc__ && _LP64,
* add a comment on the purpose of __ai_pad0.
Both suggested by mrg.
 1.37 08-May-2004  kleink struct netnet.n_net used to be an unsigned long integer.

In XNS5, and subsequently in POSIX-2001 it was changed to socklen_t.

To accomodate for this while preserving binary compatibility with the
old interface, prepend or append 32 bits of padding, depending on
the (LP64 data model) architecture's endianness. Fixes PR
standards/21411 from Ben Harris.

This should be deleted the next time the libc major number is
incremented.

Also, update getnetbyaddr(3)'s `net' argument accordingly.
 1.36 14-Apr-2004  itojun fix comment (there could be more than 3 AI_xxx)
 1.35 14-Apr-2004  itojun implement AI_NUMERICSERV (as defined in RFC3493)
 1.34 20-Mar-2004  christos branches: 1.34.2;
Do not expose the current implementation of the serv*_r proto*_r functions,
since this is not how we will implement them when we do. From discussions
with Brian Ginsbach and Soda-san.
 1.33 23-Feb-2004  christos in servent and protent data:
- add a dummy field for extensions.
- add a line field to keep the current line buffer.
 1.32 19-Feb-2004  christos protoent_r/servent_r
 1.31 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.30 05-May-2003  bjh21 Header cleanup:
* IPv6 functions are in POSIX-2001, so make them visible there.
* freehostent(), getipnodebyaddr() and getipnodebyname() are _only_ in
XNS5.2, so don't expose them to XSH6 or POSIX applications.
 1.29 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.28 06-Jan-2003  wiz compatibility, not compatiblity.
 1.27 26-Aug-2002  itojun remove unused/unsupported AI_xx. notified by PR 18072
 1.26 22-May-2002  kleink Turn the flags argument to getnameinfo(3) back into an int (from unsigned
int); this is consistent with RFC2553, the current draft-ietf-ipngwg-
rfc2553bis-05 and the majority of deployed implementations.

Also, there is an effort under way to have this changed back to int in
XBD6/XSH6, XNS, and POSIX-2001 TC1.
 1.25 14-May-2002  kleink branches: 1.25.2;
More XNS5.2/POSIX-2001 alignment: change the flags argument to
getnameinfo() from int to unsigned int.
 1.24 14-May-2002  kleink Align with XNS5.2/POSIX-2001: change hostlen and servlen arguments to
getnameinfo() from size_t to socklen_t.
 1.23 14-May-2002  kleink struct addrinfo.ai_addrlen used to be a size_t, per RFC 2553.

In XNS5.2, and subsequently in POSIX-2001 and draft-ietf-ipngwg-rfc2553bis-02
it was changed to a socklen_t.

To accomodate for this while preserving binary compatibility with the
old interface, prepend or append 32 bits of padding, depending on
the (LP64 data model) architecture's endianness.

This should be deleted the next time the libc major number is
incremented.
 1.22 10-May-2002  kleink Update several name space/feature protection tests to check for
_XOPEN_SOURCE >= 520 (XNS 5.2), either rigging it for that version or
replacing the (wrong) test for >= 500.
 1.21 26-Apr-2001  kleink Change the `len' arguemtn to gethostbyaddr(3) from int to socklen_t in
accordance with XNS5.2; fixes PR standards/12703.
 1.20 30-Jul-2000  lukem branches: 1.20.2;
be consistent with #define<TAB> usage
 1.19 28-Jul-2000  kleink Avoid recursion with traditional cpp.
 1.18 04-Jun-2000  itojun branches: 1.18.2;
correct arg type for getnameinfo(3) for RFC2553 conformance.
 1.17 09-Feb-2000  itojun branches: 1.17.2;
revise extended scoped address format support. delimiter and the order
is changed, based on discussion in ipngwg scoped address cabal.
past code: fe80::1@de0
now: de0%fe80::1
this will be in sync with next extended address format proposal
(which should be final - I don't want to make this kind of change again).
 1.16 05-Jan-2000  mjl Correct typo in comment.
 1.15 20-Dec-1999  itojun hide functions that are not supplied.
 1.14 12-Dec-1999  itojun add #define for kame's extension to scoped IPv6 numeric address.
(see draft-ietf-ipngwg-scopedaddr-format-00.txt)
 1.13 03-Jul-1999  kleink branches: 1.13.4;
* Since we actually only need size_t to be defined, nuke the previous inclusion
of <sys/types.h> and define size_t via <machine/ansi.h>.
* Various namespace protection issues, using XNS5.2 D2.0 as a reference.
 1.12 01-Jul-1999  itojun define IPv6 library functions and structures, as defined in
RFC2292 and RFC2553.
define internal state structure for IPv6-transport resolver.

Commits for source code will follow.
 1.11 10-May-1998  kleink * Remove the inclusion of <sys/param.h>; the most common use for this was
the MAXHOSTNAMELEN constant whose semantics are not intended for network
database lookup operations, and which pollutes name space.
* Per XSH98, provide symbols from <inttypes.h>.
* Add various bits of name space protection.
 1.10 03-Feb-1998  perry fix/restore Id
 1.9 02-Feb-1998  perry merge lite-2
 1.8 13-Oct-1997  lukem rcsid fascism
 1.7 13-Apr-1997  mrg merge bind 4.9.5-P1.
 1.6 02-Feb-1996  mrg update these for bind 4.9.3-p1.
 1.5 03-Jul-1995  jtc Declare h_error as suggested by PR #1065 and done by many other systems.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 07-Apr-1994  deraadt new resolver. changes from 4.9.2 by <paul@vix.com>, as well as a number
of features and optimizations by myself.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.7 12-Apr-2009  christos import libbind include files.
 1.1.1.6 30-Mar-2007  ghen Import bind 9.4.0.
 1.1.1.5 27-Jan-2007  christos import files from bind-9-4-0-rc2
 1.1.1.4 07-Nov-2004  christos Import again.
 1.1.1.3 02-Feb-1998  perry import lite-2
 1.1.1.2 13-Apr-1997  mrg BIND 4.9.5-P1 include bits
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.13.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.17.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.18.2.4 04-Sep-2002  itojun pullup include/netdb.h 1.27 (itojun)

remove unused/unsupported AI_xx. notified by PR 18072
 1.18.2.3 01-May-2001  he Pull up revision 1.19 (requested by kleink):
Avoid traditional CPP recursion in definition of socklen_t.
Fixes PR#12761.
 1.18.2.2 30-Jul-2000  lukem revert previous (wrong branch )-:
 1.18.2.1 30-Jul-2000  lukem be consistent with #define<TAB> usage
 1.20.2.4 08-Jan-2003  thorpej Sync with HEAD.
 1.20.2.3 27-Aug-2002  nathanw Catch up to -current.
 1.20.2.2 21-Jun-2002  nathanw Catch up to -current.
 1.20.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.25.2.2 27-Aug-2002  lukem Pull up revision 1.27 (requested by itojun in ticket #730):
remove unused/unsupported AI_xx. notified by PR 18072
 1.25.2.1 25-May-2002  thorpej Resolve pullup-1-6 ticket #14 (itojun), original commit message:

> Turn the flags argument to getnameinfo(3) back into an int (from unsigned
> int); this is consistent with RFC2553, the current draft-ietf-ipngwg-
> rfc2553bis-05 and the majority of deployed implementations.
>
> Also, there is an effort under way to have this changed back to int in
> XBD6/XSH6, XNS, and POSIX-2001 TC1.
 1.34.2.1 11-Sep-2004  he branches: 1.34.2.1.2;
Pull up revisions 1.43-1.45 (requested by ginsbach in ticket #834):
Restore gethostent() as a supported interface. Yes, it
may be obsolete, but it is specified by IEEE Std 1003.1,
2004 Edition (POSIX) and the X/Open standards (Issue 66
and XNS 5.2).
Here: remove freehostent() declaration, since that one is
no longer in libc.
 1.34.2.1.2.2 05-Jul-2005  riz Pull up revisions 1.37 - 1.38 (requested by kleink in ticket #2015):
1.37:
struct netent.n_net used to be an unsigned long integer.
In XNS5, and subsequently in POSIX-2001 it was changed to socklen_t.
To accomodate for this while preserving binary compatibility with the
old interface, prepend or append 32 bits of padding, depending on
the (LP64 data model) architecture's endianness. Fixes PR
standards/21411 from Ben Harris.
This should be deleted the next time the libc major number is
incremented.
Also, update getnetbyaddr(3)'s `net' argument accordingly.

1.38:
* __sparc64__ -> __sparc__ && _LP64,
* add a comment on the purpose of __ai_pad0.
Both suggested by mrg.
 1.34.2.1.2.1 24-May-2005  riz Pull up revision 1.51 via patch (requested by kleink in ticket #1547):
Instead of pulling in all of <wchar.h>, just define wchar_t here.
Addresses PR lib/29987.
 1.48.2.2 21-Apr-2005  tron Pull up revision 1.51 (requested by kleink in ticket #172):
Move the (at this time private) get{proto,serv}ent_r() prototypes and
data structures into the libc sources until the interface gets redone.
Approved by christos.
 1.48.2.1 21-Mar-2005  tron Pull up revision 1.50 (requested by kleink in ticket #40):
Add restrict qualifiers to getaddrinfo() and getnameinfo() arguments.
 1.55.4.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.55.2.2 23-Jan-2011  bouyer Apply patch, requested by spz in ticket 1413:
dist/bind/ patch
include/resolv.h patch
include/arpa/nameser.h: patch
lib/libc/include/isc/assertions.h: patch
lib/libc/include/isc/eventlib.h patch
lib/libc/isc/assertions.c: patch
lib/libc/nameser/ns_parse.c patch
lib/libc/resolv/herror.c: patch
lib/libc/resolv/res_init.c patch
lib/libc/resolv/res_mkquery.c: patch
lib/libc/resolv/res_query.c patch
lib/libc/resolv/res_send.c: patch
usr.sbin/bind/Makefile.inc patch
usr.sbin/bind/include/config.h: patch
usr.sbin/bind/include/dns/code.h: patch
usr.sbin/bind/include/dns/enumclass.h: patch
usr.sbin/bind/include/dns/enumtype.h: patch
usr.sbin/bind/include/dns/rdatastruct.h: patch
usr.sbin/bind/include/isc/platform.h: patch
usr.sbin/bind/include/lwres/netdb.h: patch
usr.sbin/bind/include/lwres/platform.h: patch
usr.sbin/bind/libisc/Makefile: patch
lib/libc/inet/inet_addr.c new file

Update bind to 9.4-ESV-R4, latest version of the 9.4 line.
 1.55.2.1 17-May-2007  jdc branches: 1.55.2.1.2;
Add missing BIND 9.4.x include file and library changes (requested by
tron in ticket #662).
 1.55.2.1.2.1 23-Jan-2011  bouyer Apply patch, requested by spz in ticket 1413:
dist/bind/ patch
include/resolv.h patch
include/arpa/nameser.h: patch
lib/libc/include/isc/assertions.h: patch
lib/libc/include/isc/eventlib.h patch
lib/libc/isc/assertions.c: patch
lib/libc/nameser/ns_parse.c patch
lib/libc/resolv/herror.c: patch
lib/libc/resolv/res_init.c patch
lib/libc/resolv/res_mkquery.c: patch
lib/libc/resolv/res_query.c patch
lib/libc/resolv/res_send.c: patch
usr.sbin/bind/Makefile.inc patch
usr.sbin/bind/include/config.h: patch
usr.sbin/bind/include/dns/code.h: patch
usr.sbin/bind/include/dns/enumclass.h: patch
usr.sbin/bind/include/dns/enumtype.h: patch
usr.sbin/bind/include/dns/rdatastruct.h: patch
usr.sbin/bind/include/isc/platform.h: patch
usr.sbin/bind/include/lwres/netdb.h: patch
usr.sbin/bind/include/lwres/platform.h: patch
usr.sbin/bind/libisc/Makefile: patch
lib/libc/inet/inet_addr.c new file

Update bind to 9.4-ESV-R4, latest version of the 9.4 line.
 1.59.14.1 27-Jun-2008  simonb Sync with head.
 1.59.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.60.14.1 09-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.60.10.1 10-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.60.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.60.6.2 21-Jun-2008  christos sync with bind-9-5-0
 1.60.6.1 21-Jun-2008  christos file netdb.h was added on branch christos-time_t on 2008-06-21 20:12:50 +0000
 1.60.4.1 06-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.62.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.62.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.64.8.1 03-Jun-2012  jdc Pull up revisions:
src/lib/libc/net/getaddrinfo.c revision 1.98 - 1.100
src/include/netdb.h revision 1.65
(requested by khorben in ticket #278).

Add AI_ADDRCONFIG, which makes getaddrinfo() return only address with
families
that are already configured in the system.

PR 46206: fix programmed SIGSEGV
more work is needed as tests seem to indicate that name resolution now
does no seem to work (firefox reports Server not found)
thanks to Ryo ONODERA for testing.

PR pkg/46206
re-establish fqdn lookup when AI_ADDRCONFIG is used in hints
AI_ADDRCONFIG led to fqdn lookup being skipped as the systems didn't
configure any PF_UNSPEC addresses - check was too strict here.
Thnaks to Ryo ONODERA for testing.
 1.64.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.64.6.1 17-Apr-2012  yamt sync with head
 1.65.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.65.2.1 23-Jun-2013  tls resync from head
 1.10 21-Oct-2009  snj Remove 3rd and 4th clauses in christos' license. OK christos.
 1.9 10-May-2007  christos Move .db files for services and netgroup to /var/db per gimpy's request.
 1.8 27-Jul-2006  christos forgot to commit this.
 1.7 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.6 10-Jan-1999  lukem remove _ng_sl_*() prototypes; the functions have been dead for nearly 2 years
 1.5 27-Jul-1998  mycroft Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.4 26-Jul-1998  mycroft const poisoning.
 1.3 30-Aug-1996  thorpej branches: 1.3.2; 1.3.4;
RCS id police.
 1.2 27-Apr-1996  christos Added private functions.
 1.1 03-Dec-1994  christos Add netgroup.h
 1.3.4.2 31-Oct-1998  lukem update to current, fix copyrights, reimplement MAXDNSLUS (for now)
 1.3.4.1 23-May-1997  lukem Add necessary files for nsswitch, take 2
Remove support for "lookup" methods in resolv.conf
Remove prototypes for _ng_sl_*; these were replaced a long time ago
 1.3.2.1 06-Nov-1996  lukem initial nsswitch implementation
 1.14 30-Oct-2024  riastradh Sprinkle <sys/featuretest.h> where _*_SOURCE macros are consulted.

Otherwise, the feature tests might come out wrong. For example,
header files that check for _NETBSD_SOURCE won't get the default when
no other _*_SOURCE macros are defined; header files that check for
_POSIX_C_SOURCE might miss _XOPEN_SOURCE, which is supposed to imply
a corresponding _POSIX_C_SOURCE.

PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
 1.13 19-Aug-2013  joerg branches: 1.13.38;
Add nl_langinfo_l, catopen_l and wcsftime_l.
 1.12 28-Apr-2008  martin branches: 1.12.6; 1.12.10; 1.12.32;
Remove clause 3 and 4 from TNF licenses
 1.11 03-Feb-2005  perry branches: 1.11.24;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.10 06-Dec-2001  wiz Give the struct typedef'd to *nl_catd a name to avoid an error with gcc
2.95.3 ("non-local function `struct {anonymous} *const &
I18n::getCatalogFd() ' uses anonymous type").
Fixes problem reported in pkg/14477.
Ok'd by kleink.
 1.9 03-Oct-2000  sommerfeld branches: 1.9.2;
Allow passthrough format-string checking of catgets
 1.8 30-Jul-1997  jtc branches: 1.8.4; 1.8.12;
Fix files using old TNF copyright notice
 1.7 13-Jul-1997  christos Add missing __{BEGIN,END}_DECLS
 1.6 13-May-1996  jtc Add data structure declarations used in external message catalog format
 1.5 01-Mar-1995  jtc catclose returns int
 1.4 23-Dec-1994  cgd oops; one too many __const's
 1.3 20-Dec-1994  cgd make the char *'s that some of these routines take/return __const.
It quiets some warnings, and is the 'right thing' anyway.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 29-May-1994  jtc Added nl_types.h for message catalog functions
 1.8.12.1 18-Oct-2000  tv Pullup 1.9 [sommerfeld]:
Allow passthrough format-string checking of catgets.
 1.8.4.1 19-Oct-2000  he Pull up revision 1.9 (requested by sommerfeld):
Allow passthrough format-string checking of catgets, as part
of format string audit.
 1.9.2.2 28-Jan-2002  nathanw Catch up to -current.
 1.9.2.1 14-Jan-2002  nathanw Catch up to -current.
 1.11.24.1 18-May-2008  yamt sync with head.
 1.12.32.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.12.10.1 28-Apr-2008  martin file nl_types.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.12.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.38.1 02-Aug-2025  perseant Sync with HEAD
 1.14 21-Aug-2009  he Introduce a new accessor macro N_NAME() to access the n_name field
in struct nlist, since it's accessed differently depending on
whether we do a.out or not. Use this macro as appropriate in the
nlist* functions.
Also replace some includes of <a.out.h> with <nlist.h>, to fix build
problem for mips.
 1.13 26-Feb-2005  dsl Change __aconst to const so I can compile systat and vmstat with WARNS=3
 1.12 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.11 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.10 17-Dec-1998  pk Add the N_SET* symbol types.
 1.9 27-Jul-1998  mycroft Slight rearrangement.
 1.8 27-Jul-1998  mycroft Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.7 26-Jul-1998  mycroft const poisoning.
 1.6 01-Oct-1996  cgd prototype __fdnlist(), since it's used by things outside of libc (libkvm,
in particular).
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 19-Oct-1994  pk Define more symbol types which are in common use now.
 1.3 16-May-1994  cgd update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those. Kill varargs.h, because it can simply
be a link to the machine-dependent version.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.23 23-Jan-2016  dholland Apparently a recent round of vandalism by the C++ standards committee
includes disallowing the standard and historic type name "unsigned". Add
a gratuitous "int" to recent changes.

C++ is really a blight on the world.
 1.22 22-Jan-2016  dholland u_char, u_int, u_long -> unsigned char, unsigned, unsigned long

This makes these headers work without _NETBSD_SOURCE.
 1.21 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.20 28-Apr-2008  martin branches: 1.20.10;
Remove clause 3 and 4 from TNF licenses
 1.19 15-Oct-2006  christos branches: 1.19.16;
add a NULL callback initializer
 1.18 29-Nov-2005  christos sprinkle __UNCONST
 1.17 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.16 10-Nov-2004  lukem * Improve the comments in <nsswitch.h>
* Provide some more useful default ns_src arrays.
 1.15 04-Oct-2004  lukem * Re-number NS_FORCEALL from 1<<7 to 1<<8, moving it out of the "public"
bitrange for nsdispatch(3) return values.
* Tweak documentation comments in nsswitch.h
* Ensure the result from the back-end method is masked with
NS_STATUSMASK before nsdispatch(3) returns it.
 1.14 29-Sep-2004  lukem Implement NS_FORCEALL, which may be set in defaults[0].flags by a caller of
nsdispatch(3) to indicate that all available database methods for a source
will be invoked. This is useful for functions such as endgrent(3).
 1.13 24-Jul-2004  thorpej Add support for dynamically loading nsswitch modules on ELF platforms.
Adapted from FreeBSD. Maintains full backward API / ABI compatbility
with built-in-only nsdispatch().

While here, also make nsdispatch() itself thread-safe.
 1.12 09-Jul-2003  kristerw Remove variable names from prototypes.
 1.11 20-Dec-2000  christos remove declaration of _nsyylineno from here.
 1.10 13-Dec-2000  scw Declare _nsyylineno as extern since it belongs in the data section
(due to being initialised in nslexer.[cy]).
 1.9 13-Jun-2000  simonb Remove 'extern' from function declarations.
 1.8 28-Nov-1999  lukem branches: 1.8.2;
change retval of _nsdbtaddsrc and _nsdbtput
 1.7 18-Apr-1999  lukem branches: 1.7.4;
use _BSD_VA_LIST_ from <machine/ansi.h> instead of using va_list from
<[stdarg,varargs}.h>. as recommended by Klaus Klein.
 1.6 26-Jan-1999  lukem always add compat functions in NS_COMPAT_CB; make it the responsibility of
the methods to check that yp/hesiod is supported.
 1.5 19-Jan-1999  lukem * support extra two arguments to nsdispatch():
const char *method /* method name for dynamic linking */
const ns_src defaults[] /* list of defaults */
* bring ns_src into the public arena for above
* make NS_xxx_CB() expand to nothing instead of { src, NULL } - makes
the tables smaller
* convert 'typedef struct xyz { ... } xyz' -> 'typedef struct { ... } xyz'
(which is how it used to be before i experimented with (and ditched) TAILQs)
 1.4 18-Jan-1999  lukem actually set the cb_data field to the (,C) arg in NS_*_CB()
 1.3 16-Jan-1999  lukem remove NSSRC_NISPLUS for now, NSDB_NETWORKS is now implemented
 1.2 15-Jan-1999  lukem merge nsswitch into main branch
 1.1 06-Nov-1996  lukem branches: 1.1.2; 1.1.4;
file nsswitch.h was initially added on branch nsswitch.
 1.1.4.7 15-Jan-1999  lukem remove NS_MAXSTR
 1.1.4.6 15-Jan-1999  lukem constify _nsyyerror
 1.1.4.5 13-Jan-1999  lukem rework to support arbitrary source names
 1.1.4.4 31-Oct-1998  lukem update to current, fix copyrights, reimplement MAXDNSLUS (for now)
 1.1.4.3 26-May-1997  lukem change the layout of the bitmask from a u_char, with 4 flags and 16
sources (in the other 4 bits) to a u_int32_t, with potentially 24
flags and 256 sources (although keep NS_MAXSOURCE at 16 for now)
 1.1.4.2 23-May-1997  lukem add rcsid
 1.1.4.1 23-May-1997  lukem Add necessary files for nsswitch, take 2
Remove support for "lookup" methods in resolv.conf
Remove prototypes for _ng_sl_*; these were replaced a long time ago
 1.1.2.1 06-Nov-1996  lukem initial nsswitch implementation
 1.7.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.19.16.1 18-May-2008  yamt sync with head.
 1.20.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.20.10.1 28-Apr-2008  martin file nsswitch.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.2 10-Jan-2000  kleink Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
td C headers including it, and a kernel module written in C++ would benfit
as well.
 1.1 22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.43 16-Jan-2017  christos add _PATH_DEVZERO
 1.42 06-May-2015  pgoyette branches: 1.42.2; 1.42.4;
Add missing PATH_WATCHDOG (to complement PATH_SYSMON and PATH_POWER)
 1.41 03-Jun-2012  joerg Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
 1.40 27-Sep-2011  jruoho branches: 1.40.2; 1.40.4;
Define _PATH_CPUCTL.
 1.39 29-Dec-2010  pooka practice alphabet: "g before i except never" etc.
 1.38 25-Dec-2010  jmcneill add /dev/video, /dev/video0
 1.37 24-Apr-2010  jruoho Define _PATH_POWER and use it.
 1.36 03-Feb-2010  roy branches: 1.36.2;
getent cannot report on termcap as we now use terminfo.
 1.35 22-Dec-2009  pooka +_PATH_PUD
 1.34 28-Sep-2008  lukem branches: 1.34.4; 1.34.6; 1.34.12;
Support RESCUEDIR for _PATH_VI.
Fixes /rescue/disklabel -e
 1.33 04-Feb-2008  christos move gettytab to paths.h
 1.32 01-Feb-2008  christos add a couple more
 1.31 17-Jul-2007  pooka branches: 1.31.4;
_PATH_PUFFS
 1.30 11-Dec-2004  christos Add _PATH_FTPUSERS; sort.
 1.29 01-Dec-2004  christos Add _PATH_BPF
 1.28 11-Nov-2004  christos Add _PATH_DEV_PTS
 1.27 19-Aug-2004  christos Typo...
 1.26 19-Aug-2004  christos Rescue for _PATH_STDPATH
 1.25 03-Oct-2003  dsl Add _PATH_CONSTTY as "/dev/constty"
 1.24 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.23 25-Jun-2003  tshiozak Citrus iconv support (1)
add core engine of Citrus iconv and some support routines.
- iconv core (citrus_iconv)
- coded character set mapper (csmapper)
- encoding scheme database (esdb)
- standard encoding scheme handler (stdenc)
- basic character set manipulation utilities (bcs)
- mmap based infrastructure (citrus_lookup/_mmap/_memstream/_db)
- some source codes of new plugins (not built yet)
 1.22 03-May-2003  lukem add _PATH_RANDOM and _PATH_URANDOM
 1.21 24-Apr-2003  ragge Add _PATH_KSYMS.
 1.20 01-Jan-2003  augustss Add _PATH_SYSMON.
 1.19 17-Mar-2002  tshiozak refine i18n stuffs.
- add libc/citrus directory.
this directory contains the common stuffs not only for locale
but also other facilities relating to i18n (e.g. iconv).
- To keep the binary compatibility for the ctype modules easily,
the interface between libc and the modules is simplified.
- For the future integrated extension, module pool is renamed
from "/usr/lib/runemodule" to "/usr/lib/i18n".
In the future, this directory will contain the modules for "iconv",
"collation", etc.
- some cosmetic changes.
- Bug fix for runetype.h; __attribute__((__packed__)) is placed at
the wrong position and it is invalid unintentionally.
But, the all members of the structures seem well-aligned. Thus,
this bug causes no problem, hopefully.

HEADS UP:
- /usr/lib/rumemodule is obsoleted. If you use the multibyte locales,
you need to install /usr/lib/i18n/* from sys/lib/i18n_module .
- The binary compatibility of /usr/share/locale/*/LC_CTYPE is probably kept.
Perhaps, the bug fix about __packed__ mentioned above breaks the
compatibility... Be careful especially on 64bit platforms.
 1.18 31-Jan-2002  augustss Make the _PATH_AUDIO /dev/audio (instead of /dev/audio0) and similar for
sound and mixer.
 1.17 22-Oct-2001  lukem sort _PATH_CLOCKCTL
 1.16 16-Sep-2001  manu Added the path for the clockctl pseudodriver device.
 1.15 03-Jul-2000  mjl branches: 1.15.2;
Add PATH_SKEYKEYS.
 1.14 27-May-2000  matt branches: 1.14.2; 1.14.4;
Add _PATH_EMUL_AOUT.
 1.13 26-Mar-1999  mrg branches: 1.13.2;
add audio paths.
 1.12 08-May-1998  fair KNF for comments (sigh)
 1.11 07-Apr-1998  fair Update STDPATH and DEFPATH as suggested by PR#4304. Document more carefully
which is supposed to be used for what (they should not be the same; why
separate them in the first place, otherwise?).
 1.10 23-Apr-1997  lukem change _PATH_DEFTAPE from "/dev/rst0" to "/dev/nrst0", as confirmed by mycroft.
 1.9 15-Apr-1997  lukem add _PATH_DEFTAPE, defined to "/dev/rst0"
 1.8 12-Oct-1996  cgd add _PATH_KVMDB as "/var/db/kvm.db"
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 30-Sep-1994  jtc Added _PATH_LOCALE
 1.5 07-May-1994  cgd update
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 28-Apr-1993  cgd bsd->netbsd
 1.2 28-Apr-1993  cgd kernel name is bsd...
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.13.2.1 01-Jun-2000  he Pull up revision 1.14 (requested by matt):
Enable searching for libraries under /emul/aout, and make sure
that ELF libraries are not erroneously accepted.
 1.14.4.1 17-Jul-2000  mjl Pull up S/Key overhaul (RFC2289 compliance, new hash types,
ctype clean up) from current. Approved by thorpej.
 1.14.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.15.2.5 06-Jan-2003  thorpej Sync with HEAD.
 1.15.2.4 22-Mar-2002  nathanw Catch up to -current.
 1.15.2.3 11-Mar-2002  nathanw Catch up to -current.
 1.15.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.15.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.31.4.1 23-Mar-2008  matt sync with HEAD
 1.34.12.1 21-Apr-2010  matt sync to netbsd-5
 1.34.6.2 28-Sep-2008  lukem Support RESCUEDIR for _PATH_VI.
Fixes /rescue/disklabel -e
 1.34.6.1 28-Sep-2008  lukem file paths.h was added on branch christos-time_t on 2008-09-28 06:38:03 +0000
 1.34.4.1 09-Jan-2010  snj Pull up following revision(s) (requested by pooka in ticket #1205):
include/paths.h: revision 1.35
+_PATH_PUD
 1.36.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.40.4.1 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.40.2.1 30-Oct-2012  yamt sync with head
 1.42.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.42.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.44 26-Nov-2012  pooka revert previous commit since it breaks the build on NetBSD and
apparently that's considered important
 1.43 26-Nov-2012  pooka When including this from a tools build, avoid defining _PWD_H_ since
that macro causes DragonFly's util.h to define conflicting routines.
 1.42 11-Jan-2009  christos merge christos-time_t
 1.41 19-Oct-2007  christos branches: 1.41.16;
kill _NETBSD_TOOLS.
 1.40 18-Oct-2007  christos Introduce _NETBSD_TOOLS for symbols the are needed in tools build
 1.39 24-May-2005  kleink branches: 1.39.10;
Make namespace protection feature tests for reentrant functions more
accurate (and actually less restrictive).
 1.38 02-Apr-2005  christos Add getpwent_r, getgrent_r
 1.37 03-Feb-2005  perry branches: 1.37.2;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.36 12-Jan-2005  christos modify footprint of pw_gensalt().
 1.35 11-Jan-2005  christos Add pw_gensalt, remove bcrypt_gensalt.
 1.34 05-Oct-2004  lukem Overhaul the use of nsdispatch(3) by public APIs so that the back-end
methods use va_list in a manner that is directly related to the public API.
This makes it much easier to write dynamic nsswitch backends for getpwent(3).
Per my proposal on tech-userlevel.

Implement getpwgid_r() and getpwnam_r() APIs per the POSIX 1003.1, 2004 Ed.
These aren't fully reentrant or threadsafe yet, because the compat stuff
currently uses non-reentrant data sources (getnetgrent(3), getpwent(3)),
and there is probably some locking to be improved in the backends.
This will be fixed in the near future.
We also need to add _SC_GETPW_R_SIZE_MAX to sysconf(3).

Fix the compat `+' prototype override so getpwnam(3) and getpwuid(3) DTRT.

Improve the description of pw_class and pw_gecos.
 1.33 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.32 13-Oct-2003  agc branches: 1.32.2;
Move Jason Downs's code from a 4-clause to a 3-clause licence by
removing the advertising clause. Diffs provided in PR 22410 by Joel
Baker, confirmed to the board by Jason Downs.

With additional thanks to Jason Thorpe.
 1.31 18-Sep-2003  jdolecek remove pw_dup()
 1.30 09-Sep-2003  itojun prototype for pw_dup(3)
 1.29 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.28 05-May-2003  bjh21 bcrypt_gensalt() isn't defined in any X/Open standard I've got convenient
access to, so move it into the _NETBSD_SOURCE section.
 1.27 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.26 24-May-2002  itojun support bcrypt password. can be chosen by "blowfish" keyword in passwd.conf.
from openbsd
 1.25 27-Jan-2002  lukem branches: 1.25.2;
public prototypes should use __P(); fix entries for pwcache_{user,group}db()
 1.24 24-Jan-2002  lukem - Implement pwcache_userdb(3), which changes the routines that
user_from_uid(3) and uid_from_user(3) use to lookup user information.
- Implement pwcache_groupdb(3), which changes the routines that
group_from_gid(3) and gid_from_group(3) use to lookup group information.
- Ensure that private functions in pwcache.c are declared static
- Use strlcpy(3) instead of strncpy(3)
 1.23 23-Oct-2001  lukem - add _PATH_USERMGMT_CONF. resolves [bin/14305]
- add _PATH_PASSWD_CONF to be consistent with almost all other _PATH_xxx_CONF
defines, and change from using _PATH_PASSWDCONF to the former. keep the
latter for compatibility, although arguably it could be removed because
it was never in a release and was only used in one file in the tree.
 1.22 18-Sep-2000  ad branches: 1.22.2;
Clarify a comment.
 1.21 06-Jul-2000  ad Define _PATH_PASSWDCONF and _PASSWORD_NONDES.
 1.20 22-Dec-1999  kleink branches: 1.20.4;
NULL vs. NUL nit in comment.
 1.19 28-Jul-1998  mycroft Add gid_from_group() and uid_from_user().
 1.18 27-Jul-1998  mycroft Slight rearrangement.
 1.17 27-Jul-1998  mycroft Mark more functions returning internal buffers for const auditing.
 1.16 27-Jul-1998  mycroft Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.15 26-Jul-1998  mycroft const poisoning.
 1.14 22-Jun-1998  msaitoh pid/gid is not int but pid_t/gid_t (u_int32_t (unsigned!)).
 1.13 08-Jun-1998  lukem move pw_scan from util.h to pwd.h, add _PASSWORD_{OLDFMT,NOWARN} flags
 1.12 06-May-1998  kleink Reorganize name space protection.
 1.11 16-Aug-1997  lukem Define _PASSWORD_CHGNOW as -1. This is a `magic' pw_change value,
which login(1) detects and forces a password change during login.
Based on [bin/936] by Simon Gerraty <sjg@quick.com.au>
 1.10 27-Jun-1997  lukem Define _PASSWORD_WARNDAYS to 14. When a password or account expiry is due
at a time less than this, login(1) et al will warn the user.
 1.9 15-May-1996  jtc Added new header files for functions in libutil.
Added macro for master passwd lock file.
From Greg Hudson <ghudson@MIT.EDU>.
 1.8 28-Jul-1995  phil Improvements to YP support from Jason Downs.
 1.7 29-Apr-1995  cgd provide user_from_uid() proto if not _POSIX_SOURCE and not _XOPEN_SOURCE
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 17-May-1994  cgd XOPEN foo here, too
 1.4 16-May-1994  cgd update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those. Kill varargs.h, because it can simply
be a link to the machine-dependent version.
 1.3 25-Oct-1993  jtc X/Open 1170 defines the return type of setpwent() to be void -- a trival
change since our setpwent() allways succeeded.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.20.4.2 23-Jan-2002  he Pull up revision 1.22 (requested by jonathan):
Clarify a comment.
 1.20.4.1 23-Jan-2002  he Pull up revision 1.21 (requested by windsor):
Make the tree compile again after pull-up of minimal MD5 password
enhancement. Should fix PR#15345.
 1.22.2.3 21-Jun-2002  nathanw Catch up to -current.
 1.22.2.2 28-Jan-2002  nathanw Catch up to -current.
 1.22.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.25.2.1 26-Mar-2004  jmc Pullup rev 1.26 (requested by provos in ticket #1386)

Introduce bcrypt password scheme. Adds the arc4random API for creating
cryptographically strong random numbers.
 1.32.2.1 22-Jun-2004  tron Pull up revision 1.33 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.37.2.2 11-Jul-2005  tron Pull up revision 1.38 (requested by lukem in ticket #541):
Add getpwent_r, getgrent_r
 1.37.2.1 28-May-2005  tron Pull up revision 1.39 (requested by kleink in ticket #345):
Make namespace protection feature tests for reentrant functions more
accurate (and actually less restrictive).
 1.39.10.1 06-Nov-2007  matt sync with HEAD
 1.41.16.1 08-Nov-2008  christos changes for 64 bit time_t
 1.7 04-Apr-2017  sevan Add RCS tag.
 1.6 01-Feb-2012  dholland branches: 1.6.4; 1.6.24; 1.6.28;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)
 1.5 30-Jan-2012  dholland Add quota_quotaon() and quota_quotaoff(). Use them in quotaon(8).
 1.4 30-Jan-2012  dholland Add quota_getrestrictions() to report the semantic restrictions
associated with a particular quotahandle.
 1.3 29-Jan-2012  dholland Per the FS-independent schema, get one quotaval at a time from the
filesystem, instead of blocks and files together.

This results in fetching each FS-level quota entry twice and therefore
doing slightly more work, but (1) quota access isn't a critical path
and (2) after fetching the block values the file values will be hot in
the cache, so it won't add much total time.

Also move more of the FS-independent defintions from <quota.h> to
<sys/quota.h> so we can use them internally.

Step 4 of 5 for QUOTACTL_GET.

Note: this change requires a kernel version bump.
 1.2 29-Jan-2012  dholland Move second-layer proplib frobbing within ufs quota code up to the
first layer. (Step 2 of several for QUOTACTL_GET.)
 1.1 09-Jan-2012  dholland Add <quota.h> with the new libquota API.

This is the user/application API and does not include the kernel
interface. Definitions shared with the kernel are found in
<sys/quota.h>.

Since I've been working on a local branch I have taken the liberty of
moving the latest-so-far version of <quota.h> to the front of the
patch queue. This loses (a small amount of) history but has the
advantage of avoiding unnecessary version bumps of libquota.so.
 1.6.28.1 21-Apr-2017  bouyer Sync with HEAD
 1.6.24.1 26-Apr-2017  pgoyette Sync with HEAD
 1.6.4.2 17-Apr-2012  yamt sync with head
 1.6.4.1 01-Feb-2012  yamt file quota.h was added on branch yamt-pagecache on 2012-04-17 00:05:10 +0000
 1.3 22-Jan-2016  dholland Needs stdint.h.
 1.2 26-Dec-2005  perry u_intN_t -> uintN_t
 1.1 09-Sep-2003  itojun add randomid(3).
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.5 02-Feb-1998  perry merge lite-2
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 03-Apr-1994  cgd off_t -> long; structure compatible with old libraries... (OUCH!)
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.4 28-Apr-2008  martin branches: 1.4.10;
Remove clause 3 and 4 from TNF licenses
 1.3 03-Feb-2005  perry branches: 1.3.24;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.2 30-Jul-1997  jtc Fix files using old TNF copyright notice
 1.1 05-Feb-1996  jtc Add cpio.h, tar.h, and re_comp.h headers for POSIX & XPG4 conformance
 1.3.24.1 18-May-2008  yamt sync with head.
 1.4.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4.10.1 28-Apr-2008  martin file re_comp.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.17 30-Oct-2024  riastradh Sprinkle <sys/featuretest.h> where _*_SOURCE macros are consulted.

Otherwise, the feature tests might come out wrong. For example,
header files that check for _NETBSD_SOURCE won't get the default when
no other _*_SOURCE macros are defined; header files that check for
_POSIX_C_SOURCE might miss _XOPEN_SOURCE, which is supposed to imply
a corresponding _POSIX_C_SOURCE.

PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
 1.16 23-Feb-2021  christos branches: 1.16.8;
- Replace REG_ENOSYS (unused) with REG_ILLSEQ.
- Add REG_GNU
 1.15 14-Jan-2016  christos rename to regnsub
 1.14 14-Jan-2016  christos add reg{,a}sub
 1.13 13-Sep-2005  christos compat code reorg
 1.12 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.11 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.10 05-Feb-2003  kleink Sprinkle some restrict.
 1.9 09-Dec-1998  drochner Uhm - we can't expose __LIBC12_SOURCE__ to the public - it causes side
effects in the function renaming mess.
 1.8 08-Dec-1998  drochner regoff_t is used like size_t within the code, it should be defined
so instead of off_t. This makes some casts unnecessary.
We can't change the definition now due to binary compatibility, so
prepare for the next libc major version.
 1.7 06-May-1998  kleink For completeness, add REG_ENOSYS.
 1.6 02-Feb-1998  perry merge lite-2
 1.5 10-Jun-1996  explorer Include <sys/types.h>

POSIX.2 requires programs to include <sys/types.h> before including
<regex.h>. XPG4.2 makes <sys/types.h> optional for all headers.
 1.4 26-Oct-1994  cgd branches: 1.4.6;
new RCS ID format.
 1.3 12-Jan-1994  cgd update from latest regex package i could find...
 1.2 11-Nov-1993  jtc Update to Henry's alpha3.2 release.
 1.1 11-Nov-1993  jtc branches: 1.1.1;
Enable Henry Spencer's POSIX.2 compatible regular expression routines.
Disable is earlier V8-style routines.
 1.1.1.1 02-Feb-1998  perry import lite-2
 1.4.6.1 10-Jun-1996  explorer Include <sys/types.h>

POSIX.2 requires programs to include <sys/types.h> before including
<regex.h>. XPG4.2 makes <sys/types.h> optional for all headers.
 1.16.8.1 02-Aug-2025  perseant Sync with HEAD
 1.7 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.5 14-Sep-1998  tv __RENAME() the libcompat regexp routines so they will not be used by
programs that want -lcompat but use POSIX regex. Inspired by
<david@mono.org> in PR bin/1849.
 1.4 02-Feb-1998  perry merge lite-2
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.8 15-Nov-2012  christos use standard queue macros.
 1.7 12-Apr-2009  christos branches: 1.7.8; 1.7.10; 1.7.14;
merge libbind
 1.6 21-Jun-2008  christos branches: 1.6.4; 1.6.6; 1.6.8; 1.6.10; 1.6.14;
sync with bind-9-5-0
 1.5 30-Mar-2007  ghen branches: 1.5.12; 1.5.14;
Resolve conflicts.
 1.4 27-Jan-2007  christos Merge back all our changes.
 1.3 26-Dec-2005  perry branches: 1.3.4; 1.3.6;
u_intN_t -> uintN_t
 1.2 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.1 21-May-2004  christos branches: 1.1.1;
Initial revision
 1.1.1.4 12-Apr-2009  christos import libbind include files.
 1.1.1.3 30-Mar-2007  ghen Import bind 9.4.0.
 1.1.1.2 27-Jan-2007  christos import files from bind-9-4-0-rc2
 1.1.1.1 21-May-2004  christos import new and changed files from bind9
 1.3.6.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.3.4.1 17-May-2007  jdc Add missing BIND 9.4.x include file and library changes (requested by
tron in ticket #662).
 1.5.14.1 27-Jun-2008  simonb Sync with head.
 1.5.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.6.14.1 09-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.6.10.1 10-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.6.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.6.6.2 21-Jun-2008  christos sync with bind-9-5-0
 1.6.6.1 21-Jun-2008  christos file res_update.h was added on branch christos-time_t on 2008-06-21 20:12:50 +0000
 1.6.4.1 06-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.7.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.7.10.3 30-Jul-2013  msaitoh Pull up following revision(s) (requested by manu in ticket #887):
lib/libc/nameser/ns_samedomain.c 1.7
lib/libresolv/Makefile 1.12
lib/libresolv/dst_api.c 1.1
lib/libresolv/dst_internal.h 1.1
liib/libresolv/hmac_link.c 1.1
lib/libresolv/ns_date.c 1.1
lib/libresolv/ns_sign.c 1.1
lib/libresolv/ns_verify.c 1.1
lib/libresolv/res_findzonecut.c 1.1
lib/libresolv/res_mkupdate.c 1.1
lib/libresolv/res_mkupdate.h 1.1
lib/libresolv/res_private.h 1.1
lib/libresolv/res_sendsigned.c 1.1
lib/libresolv/res_update.c 1.1
lib/libresolv/support.c 1.1
include/res_update.h 1.8
lib/libresolv/dst_api.c 1.2
lib/libresolv/dst_internal.h 1.2
lib/libresolv/dst_api.c 1.3
lib/libresolv/hmac_link.c 1.2
lib/libresolv/ns_verify.c 1.2
lib/libresolv/res_mkupdate.c 1.2
lib/libc/nameser/ns_samedomain.c 1.8
Restore libresolv missing bits, including NS updates.
 1.7.10.2 14-Jun-2013  msaitoh Revert last libresolv change (ticket #887). That commit changed the major
version. It's not good. Discussed in current-users@
 1.7.10.1 13-Jun-2013  msaitoh Pull up following revision(s) (requested by manu in ticket #887):
lib/libc/nameser/ns_samedomain.c 1.7-1.8
lib/libresolv/Makefile 1.12
lib/libresolv/dst_api.c 1.1-1.3
lib/libresolv/dst_internal.h 1.1-1.2
lib/libresolv/hmac_link.c 1.1-1.2
lib/libresolv/ns_date.c 1.1
lib/libresolv/ns_sign.c 1.1
lib/libresolv/ns_verify.c 1.1-1.2
lib/libresolv/res_findzonecut.c 1.1
lib/libresolv/res_mkupdate.c 1.1-1.2
lib/libresolv/res_mkupdate.h 1.1
lib/libresolv/res_private.h 1.1
lib/libresolv/res_sendsigned.c 1.1
lib/libresolv/res_update.c 1.1
lib/libresolv/support.c 1.1
lib/libresolv/shlib_version 1.7
include/res_update.h 1.8
distrib/sets/lists/base/ad.mips64eb 1.102
distrib/sets/lists/base/ad.mips64el 1.101
distrib/sets/lists/base/md.amd64 1.178
distrib/sets/lists/base/md.sparc64 1.167
distrib/sets/lists/base/shl.mi 1.639
distrib/sets/lists/comp/ad.mips64eb 1.91
distrib/sets/lists/comp/ad.mips64el 1.93
distrib/sets/lists/comp/md.amd64 1.181
distrib/sets/lists/comp/md.sparc64 1.159
distrib/sets/lists/comp/shl.mi 1.238

Bring libresolv to its latest version which restore missing bits such
as DNS update.
 1.7.8.1 16-Jan-2013  yamt sync with (a bit old) head
 1.42 03-Sep-2021  andvar fix typos in comments, mainly s/extention/extension/ and s/sufficent/sufficient/
 1.41 30-Apr-2021  christos Default to check-names for safety.
 1.40 07-Nov-2012  christos add <netinet/in.h> because it is needed for sockaddr_in.
 1.39 09-Sep-2012  christos branches: 1.39.2;
make the default to not check names.
 1.38 24-Oct-2009  christos branches: 1.38.8; 1.38.10; 1.38.14;
expose res_check for the benefit of mDNS.
 1.37 20-Apr-2009  christos Bring back binary compatibility with the previous version of the resolver.
There was no room to allocate 16 bytes for _rnd in the struct in the _LP64
case, so we dynamically allocate now. Also put the _rnd field last, so that
we are bitwise compatible too. Now of course we've run out of space, so
next time will need to perform more evil tricks to fit.
 1.36 12-Apr-2009  christos merge libbind
 1.35 21-Jun-2008  christos branches: 1.35.4; 1.35.6; 1.35.8; 1.35.10; 1.35.14;
restore correct symbol protection and add a comment so that I don't
break this again.
 1.34 21-Jun-2008  christos sync with bind-9-5-0
 1.33 30-Mar-2007  ghen branches: 1.33.12; 1.33.14;
Resolve conflicts.
 1.32 27-Jan-2007  christos Merge back all our changes.
 1.31 26-Dec-2005  perry branches: 1.31.4; 1.31.6;
u_intN_t -> uintN_t
 1.30 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.29 07-Nov-2004  christos Resolve conflicts.
 1.28 09-Jun-2004  christos Provide an ifdef so that we can define an old style _res if we need to.
 1.27 04-Jun-2004  he Removr parameter names from __h_errno_set() function declaration.
Without this the vax port fails to compile the okheaders regression
test, because the "err" parameter name shadows a global variable.
 1.26 26-May-2004  christos PR/25707: Love: remove _LIBC from res_state as suggested, so that res_ninit
calls in userland don't trash memory.
 1.25 22-May-2004  christos Provide access to the 5 symbols the bind8 resolver libc did.
 1.24 22-May-2004  christos provide unconditional access to _res via __res_state(). This will abort
for multi-threaded programs.
 1.23 21-May-2004  christos resolve conflicts.
 1.22 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.21 09-Jul-2003  kristerw Remove variable names from prototypes.
 1.20 06-Jan-2003  wiz transmission, not transmition.
 1.19 09-Aug-2000  itojun branches: 1.19.2;
implement EDNS0 support, as EDNS0 support will be made mandatory for
IPv6 transport-ready resolvers/DNS servers. need careful configuration
when enable it. (default config is not affected).
see manpage for details.

XXX visible symbol __res_opt() is added, however, it is not supposed to be
called from outside, libc minor is not bumped.
 1.18 01-Jul-1999  itojun define IPv6 library functions and structures, as defined in
RFC2292 and RFC2553.
define internal state structure for IPv6-transport resolver.

Commits for source code will follow.
 1.17 17-Jan-1999  lukem revert part of previous; leave char lookups[4] in __res_state.
otherwise, complex versioning stuff will have to be performed so
that old binaries with a new libc.so don't barf
 1.16 16-Jan-1999  lukem remove MAXDNSLUS and lookups[]; unnecessary with nsswitch
 1.15 27-Jul-1998  mycroft Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.14 26-Jul-1998  mycroft const poisoning.
 1.13 03-Feb-1998  perry fix/restore Id
 1.12 02-Feb-1998  perry merge lite-2
 1.11 13-Oct-1997  lukem rcsid fascism
 1.10 13-Apr-1997  mrg branches: 1.10.2;
merge bind 4.9.5-P1.
 1.9 02-Feb-1996  mrg branches: 1.9.2;
update these for bind 4.9.3-p1.
 1.8 26-Oct-1994  cgd new RCS ID format.
 1.7 19-Oct-1994  cgd res_search() takes a const char * as the first arg.
 1.6 15-Oct-1994  deraadt u_int_{16,32}_t stuff
 1.5 13-Jun-1994  jtc Add prototypes for res_query() and res_search() to fix bug #250.
More extensive changes will come when bind-4.9.3 is released and
integrated.
 1.4 07-Apr-1994  deraadt new resolver. changes from 4.9.2 by <paul@vix.com>, as well as a number
of features and optimizations by myself.
 1.3 28-Jan-1994  deraadt support for lookup keyword in resolv.conf
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.8 12-Apr-2009  christos import libbind include files.
 1.1.1.7 30-Mar-2007  ghen Import bind 9.4.0.
 1.1.1.6 27-Jan-2007  christos import files from bind-9-4-0-rc2
 1.1.1.5 07-Nov-2004  christos Re-import these. I imported the old ones accidentally.
 1.1.1.4 21-May-2004  christos import new and changed files from bind9
 1.1.1.3 02-Feb-1998  perry import lite-2
 1.1.1.2 13-Apr-1997  mrg BIND 4.9.5-P1 include bits
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.9.2.1 06-Nov-1996  lukem initial nsswitch implementation
 1.10.2.2 31-Oct-1998  lukem update to current, fix copyrights, reimplement MAXDNSLUS (for now)
 1.10.2.1 23-May-1997  lukem Add necessary files for nsswitch, take 2
Remove support for "lookup" methods in resolv.conf
Remove prototypes for _ng_sl_*; these were replaced a long time ago
 1.19.2.1 08-Jan-2003  thorpej Sync with HEAD.
 1.31.6.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.31.4.2 23-Jan-2011  bouyer Apply patch, requested by spz in ticket 1413:
dist/bind/ patch
include/resolv.h patch
include/arpa/nameser.h: patch
lib/libc/include/isc/assertions.h: patch
lib/libc/include/isc/eventlib.h patch
lib/libc/isc/assertions.c: patch
lib/libc/nameser/ns_parse.c patch
lib/libc/resolv/herror.c: patch
lib/libc/resolv/res_init.c patch
lib/libc/resolv/res_mkquery.c: patch
lib/libc/resolv/res_query.c patch
lib/libc/resolv/res_send.c: patch
usr.sbin/bind/Makefile.inc patch
usr.sbin/bind/include/config.h: patch
usr.sbin/bind/include/dns/code.h: patch
usr.sbin/bind/include/dns/enumclass.h: patch
usr.sbin/bind/include/dns/enumtype.h: patch
usr.sbin/bind/include/dns/rdatastruct.h: patch
usr.sbin/bind/include/isc/platform.h: patch
usr.sbin/bind/include/lwres/netdb.h: patch
usr.sbin/bind/include/lwres/platform.h: patch
usr.sbin/bind/libisc/Makefile: patch
lib/libc/inet/inet_addr.c new file

Update bind to 9.4-ESV-R4, latest version of the 9.4 line.
 1.31.4.1 17-May-2007  jdc branches: 1.31.4.1.2;
Add missing BIND 9.4.x include file and library changes (requested by
tron in ticket #662).
 1.31.4.1.2.1 23-Jan-2011  bouyer Apply patch, requested by spz in ticket 1413:
dist/bind/ patch
include/resolv.h patch
include/arpa/nameser.h: patch
lib/libc/include/isc/assertions.h: patch
lib/libc/include/isc/eventlib.h patch
lib/libc/isc/assertions.c: patch
lib/libc/nameser/ns_parse.c patch
lib/libc/resolv/herror.c: patch
lib/libc/resolv/res_init.c patch
lib/libc/resolv/res_mkquery.c: patch
lib/libc/resolv/res_query.c patch
lib/libc/resolv/res_send.c: patch
usr.sbin/bind/Makefile.inc patch
usr.sbin/bind/include/config.h: patch
usr.sbin/bind/include/dns/code.h: patch
usr.sbin/bind/include/dns/enumclass.h: patch
usr.sbin/bind/include/dns/enumtype.h: patch
usr.sbin/bind/include/dns/rdatastruct.h: patch
usr.sbin/bind/include/isc/platform.h: patch
usr.sbin/bind/include/lwres/netdb.h: patch
usr.sbin/bind/include/lwres/platform.h: patch
usr.sbin/bind/libisc/Makefile: patch
lib/libc/inet/inet_addr.c new file

Update bind to 9.4-ESV-R4, latest version of the 9.4 line.
 1.33.14.1 27-Jun-2008  simonb Sync with head.
 1.33.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.35.14.1 09-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.35.10.1 10-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.35.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.35.6.2 21-Jun-2008  christos restore correct symbol protection and add a comment so that I don't
break this again.
 1.35.6.1 21-Jun-2008  christos file resolv.h was added on branch christos-time_t on 2008-06-21 20:24:41 +0000
 1.35.4.1 06-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.38.14.1 17-Aug-2017  martin Pull up following revision(s) (requested by mrg in ticket #721):
include/resolv.h: revision 1.40
sys/netinet/ip.h: revision 1.33-1.34
fix typo
make this standalone, like every others (except OpenBSD)
add <netinet/in.h> because it is needed for sockaddr_in.
 1.38.10.1 28-Nov-2012  riz Pull up following revision(s) (requested by christos in ticket #721):
include/resolv.h: revision 1.40
sys/netinet/ip.h: revision 1.33
sys/netinet/ip.h: revision 1.34
fix typo
make this standalone, like every others (except OpenBSD)
add <netinet/in.h> because it is needed for sockaddr_in.
 1.38.8.2 16-Jan-2013  yamt sync with (a bit old) head
 1.38.8.1 30-Oct-2012  yamt sync with head
 1.39.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.4 30-Oct-2006  christos kill crypto/rmd160.h and crypto/sha2.h, and instead make symlinks to
/usr/include from /usr/include/sys. This makes all the one way hash
header handling identical.
 1.3 24-Sep-2005  elad Use new location.

XXX This is left here for backwards compatibility.
 1.2 07-Jul-2000  ad Don't declare the "convenience functions" if _KERNEL is defined.
 1.1 05-Jul-2000  ad Pull in RIPEMD-160 functions from OpenBSD - this has the same API as our MD4,
MD5 and SHA1 stuff.
 1.8 22-Jan-2016  dholland Needs sys/types.h for mode_t, off_t, ssize_t, and others.
 1.7 16-Feb-2011  christos handle ssp
 1.6 31-Aug-2010  enami branches: 1.6.2;
Move prototype of isrmt() to rmt.h. It is a public interface
described in rmtops(3).
 1.5 03-Feb-2005  perry branches: 1.5.44;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.4 22-Oct-1997  thorpej Update for new function renaming nechanism.
 1.3 21-Oct-1997  thorpej Make this somewhat less yucky:
- Make this work with versioned stat(2)-family functions.
- Prototype the rmt(3) functions here, and make them match the prototypes
of the functions they're remapping.
- Allow rmtlib.c to include this in a way that doesn't remap any functions.
 1.2 09-Aug-1996  jtc branches: 1.2.4;
clean up comments, etc.
 1.1 09-Aug-1996  jtc Remote mag tape library from volume 18 of comp.sources.unix.
 1.2.4.2 22-Oct-1997  thorpej Pull up from trunk: update for new function renaming mechanism.
 1.2.4.1 21-Oct-1997  thorpej Pull up from trunk:

Make this somewhat less yucky:
- Make this work with versioned stat(2)-family functions.
- Prototype the rmt(3) functions here, and make them match the prototypes
of the functions they're remapping.
- Allow rmtlib.c to include this in a way that doesn't remap any functions.
 1.5.44.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.6.2.1 17-Feb-2011  bouyer Sync with HEAD
 1.7 19-Feb-2012  rmind Remove <sa.h> which has been obsolete since 2007.
 1.6 28-Apr-2008  martin branches: 1.6.6; 1.6.10;
Remove clause 3 and 4 from TNF licenses
 1.5 03-Feb-2005  perry branches: 1.5.24;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.4 02-Jan-2004  cl - libc.so.12.109 and libpthread.so.0.4
- add ssize_t stackinfo_offset argument to sa_register syscall
- remove sa_unblockyield syscall
- make __sigprocmask14 syscall weak
- in pthread__sa_start: catch up with 4-argument sa_register syscall
 1.3 16-Sep-2003  cl fix SA/pthread pagefault failure:
- prevent BLOCKED upcalls on double page faults and during upcalls
- make libpthread handle blocked threads which hold locks
- prevent UNBLOCKED upcalls from overtaking their BLOCKED upcall
this adds a new syscall sa_unblockyield
see also http://mail-index.netbsd.org/tech-kern/2003/09/15/0020.html
 1.2 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.1 05-Mar-2001  nathanw branches: 1.1.2;
file sa.h was initially added on branch nathanw_sa.
 1.1.2.3 17-Jan-2003  thorpej * This is a user header file; __P'ify prototypes.
* Fix a comment.
 1.1.2.2 31-Aug-2002  nathanw Add argument to sa_register() prototype.
 1.1.2.1 05-Mar-2001  nathanw User-level support for LWPs and scheduler activations.
SVR4-style ucontext code by Klaus Klein.
 1.5.24.1 18-May-2008  yamt sync with head.
 1.6.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6.10.1 28-Apr-2008  martin file sa.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.6.6.1 17-Apr-2012  yamt sync with head
 1.15 01-Aug-2022  wiz sched.h: keep __clone() visible under _NETBSD_SOURCE
 1.14 01-Aug-2022  wiz sched.h: format comment to follow KNF

requested by thorpej@
 1.13 01-Aug-2022  wiz sched.h: Linux documents clone and __clone as only available
when_GNU_SOURCE is defined - follow suit.

Ok martin@
 1.12 11-Jan-2009  christos branches: 1.12.52;
merge christos-time_t
 1.11 31-Oct-2008  rmind branches: 1.11.2;
Add sched_getaffinity_np() and sched_setaffinity_np() wrappers, mainly
for compatibility purposes.
 1.10 15-Jun-2008  rmind branches: 1.10.4;
Remove few no longer relevant comments.
 1.9 28-Apr-2008  martin branches: 1.9.2; 1.9.4;
Remove clause 3 and 4 from TNF licenses
 1.8 09-Oct-2005  kleink branches: 1.8.18;
Change the sched_*() functions to return -1 and set errno to ENOSYS
(per the standard) instead of returning ENOSYS. Noted by Ian Zagorskih
in PR kern/30970.
 1.7 03-Feb-2005  perry branches: 1.7.2;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.6 13-Dec-2004  nathanw __libc_thr_yield() signature now matches sched_yield().
Pointed out by Kouichirou Hiratsuka on current-users.
 1.5 10-Dec-2004  nathanw Use CPP macros to cause many libpthread functions used by applications
to be transformed into the do-nothing-when-libpthread-isn't-linked libc
stub names. This will permit library code that uses <pthread.h> and pthread
functions "defensively" to not need to link against libpthread and not need
to be patched to the threadlib.h API.
 1.4 08-Jul-2003  itojun branches: 1.4.4;
prototype must not have variable name
 1.3 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.2 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.1 17-Jul-2001  thorpej branches: 1.1.2;
A <sched.h> file, which provides the clone(2) prototypes, in order
to be compatible with Linux.
 1.1.2.9 18-Dec-2002  thorpej Move sched_param and policies into sys/sched.h, and give SCHED_OTHER
the value 0.
 1.1.2.8 11-Nov-2002  skrll Define SCHED_OTHER and remove SCHED_DEFAULT.
 1.1.2.7 08-Nov-2002  skrll Pull in sys/cdefs.h
 1.1.2.6 29-Oct-2002  thorpej Make this safe for C++.
 1.1.2.5 11-Apr-2002  thorpej _LIB_PTHREAD_SCHED_H -> _SCHED_H_
 1.1.2.4 23-Feb-2002  gmcgarry It's back with the pthreads bits.
 1.1.2.3 23-Feb-2002  gmcgarry sched.h is now part of the pthread library
 1.1.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.1.2.1 17-Jul-2001  nathanw file sched.h was added on branch nathanw_sa on 2001-10-08 20:13:46 +0000
 1.4.4.1 28-Oct-2005  jmc Pullup from trunk 1.7->1.8
 1.7.2.1 10-Oct-2005  tron Pull up following revision(s) (requested by kleink in ticket #875):
include/sched.h: revision 1.8
lib/libpthread/sched.c: revision 1.4
Change the sched_*() functions to return -1 and set errno to ENOSYS
(per the standard) instead of returning ENOSYS. Noted by Ian Zagorskih
in PR kern/30970.
 1.8.18.2 17-Jun-2008  yamt sync with head.
 1.8.18.1 18-May-2008  yamt sync with head.
 1.9.4.1 18-Jun-2008  simonb Sync with head.
 1.9.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.10.4.1 12-Nov-2008  snj Pull up following revision(s) (requested by rmind in ticket #47):
lib/libc/sys/sched.c: revision 1.2
include/sched.h: revision 1.11
Add sched_getaffinity_np() and sched_setaffinity_np() wrappers, mainly
for compatibility purposes.
 1.11.2.2 05-Jan-2009  christos version sched_rr_get_interval
 1.11.2.1 31-Oct-2008  christos file sched.h was added on branch christos-time_t on 2009-01-05 01:29:15 +0000
 1.12.52.1 03-Aug-2022  martin Pull up following revision(s) (requested by wiz in ticket #1484):

lib/libc/sys/clone.2: revision 1.14
lib/libc/sys/clone.2: revision 1.15
include/sched.h: revision 1.13
include/sched.h: revision 1.14
include/sched.h: revision 1.15

Remove mentions of CLONE_PID and CLONE_STOPPED

CLONE_PID was removed in Linux 2.5.15 and recycled for
CLONE_PIDFD since Linux 5.2.
CLONE_STOPPED was removed in Linux 2.6.38 and recycled
for CLONE_NEWCGROUP since Linux 4.6.

sched.h: Linux documents clone and __clone as only available
when_GNU_SOURCE is defined - follow suit.
Ok martin@

clone(2): document that _GNU_SOURCE must be defined for the prototypes
sched.h: format comment to follow KNF
requested by thorpej@
sched.h: keep __clone() visible under _NETBSD_SOURCE
 1.22 20-Jul-2014  christos amend the new destroy function to take function pointers.
 1.21 20-Jul-2014  christos Our hdestroy implementation was non-conformant because it freed the key of
each entry. Add a new function hdestroy1 that allows the user to control
what gets freed. Pointed out by Pedro Giffuni at FreeBSD.
 1.20 27-Apr-2013  joerg branches: 1.20.4;
Systematically include sys/featuretest.h when _NETBSD_SOURCE is used.
Some are redundant, but make verification with grep much easier.
 1.19 14-Sep-2011  christos branches: 1.19.2; 1.19.8;
add re-entrant versions of the hash api based on the GNU extensions.
 1.18 06-Jul-2005  drochner The source array of lsearch() shouldn't be "const".
Being here, cleanup the const castaway stuff.
 1.17 22-Mar-2005  kleink * Add restrict qualifiers to tdelete() function arguments.
* Const-poison tfind()'s rootp argument, per SVID Issue 1 and later.
 1.16 03-Feb-2005  perry branches: 1.16.2;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.15 26-Jul-2003  salo netbsd.org->NetBSD.org
 1.14 20-Dec-2000  christos deal with bsearch duplicate declaration.
 1.13 13-Jun-2000  simonb Remove 'extern' from function declarations.
 1.12 22-Feb-1999  christos branches: 1.12.8;
Add internal structure used by the t* routines, protected via an ifdef
 1.11 16-Feb-1999  kleink Per XSI5, make ENTRY.data a typeless pointer.
 1.10 16-Feb-1999  kleink Per XSI5, let hcreate() take a size_t argument.
 1.9 08-Aug-1995  jtc Added declarations for hsearch(), hdestroy(), and hcreate().
 1.8 30-Jul-1995  jtc add prototypes for tsearch, etc. functions
 1.7 29-Apr-1995  jtc Winning Strategies has placed this code into the Public Domain.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 21-May-1994  cgd add _BSD's to ansi types
 1.4 29-Jan-1994  jtc Fix spelling error in Copyright notice
 1.3 22-Oct-1993  jtc Added prototypes for lfind() and lsearch().
 1.2 21-Oct-1993  jtc Define size_t if it hasn't been allready.
 1.1 21-Oct-1993  jtc Added X/Open 1170's <search.h> header --- it only declares bsearch, insque,
and remque at this time. The remainder of the functions will be added as
time allows.
 1.12.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.16.2.2 04-Aug-2005  tron Pull up revision 1.18 (requested by drochner in ticket #632):
The source array of lsearch() shouldn't be "const".
Being here, cleanup the const castaway stuff.
 1.16.2.1 23-Mar-2005  tron Pull up revision 1.17 (requested by kleink in ticket #51):
* Add restrict qualifiers to tdelete() function arguments.
* Const-poison tfind()'s rootp argument, per SVID Issue 1 and later.
 1.19.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.8.1 23-Jun-2013  tls resync from head
 1.19.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.20.4.1 10-Aug-2014  tls Rebase.
 1.5 24-Apr-2016  dholland Define SEM_VALUE_MAX in only one place.

Adding a whole extra header file just for this is not the optimal
solution... but stuffing it in with anything else exposes things that
otherwise wouldn't be.

Nothing in userland should use <sys/semaphore.h> directly, and if some
foolish third-party software should decide to do so anyway in spite of
the instructions to the contrary I will ruthlessly break it later when
the big kernel includes cleanup finally happens.

Reported by Kamil Rytarowski, and, as it turns out, also by Klaus
Heinz in 2008.
 1.4 08-Mar-2012  joerg Implement sem_timedwait.
 1.3 28-Apr-2008  martin branches: 1.3.6; 1.3.10;
Remove clause 3 and 4 from TNF licenses
 1.2 21-Jan-2003  kleink branches: 1.2.30;
Need <sys/cdefs.h>.
 1.1 20-Jan-2003  christos add support for p1003.1b semaphores. From FreeBSD
 1.2.30.1 18-May-2008  yamt sync with head.
 1.3.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.10.1 28-Apr-2008  martin file semaphore.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.3.6.1 17-Apr-2012  yamt sync with head
 1.26 05-Nov-2011  joerg Add __returns_twice for the attribute of the same name. This makes the
attribute explicit based on the functions GCC gives it too.
 1.25 12-Aug-2009  matt branches: 1.25.8;
Allow <machine/setjmp.h> to override the type using in jmpbuf.
 1.24 24-Dec-2007  perry branches: 1.24.20;
change some __attribute__s to __keywords
 1.23 13-Sep-2005  christos branches: 1.23.10;
compat code reorg
 1.22 15-Apr-2005  christos Add no-return attribute to all longjmp flavors. Approved by kleink.
 1.21 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.20 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.19 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.18 07-Mar-2000  jdolecek make the #ifdef __LIBC12_SOURCE__ consistent with usage in <signal.h>
and <sys/stat.h>
Fixes misc/6520.
 1.17 15-Jan-1999  castor Avoid introducing new prefix '__JB' -- '_JB' is fine.
 1.16 14-Jan-1999  castor Remove bogus RCS Id.
 1.15 14-Jan-1999  castor Allow MD setjmp.h to specify attributes for jmp_buf, so more
stringent alignment requirements can be satisfied.
 1.14 14-Sep-1998  thorpej Fix typo in previous, and also don't version _setjmp/_longjmp; after
more careful analysis, I realized that they don't access the extended
jmp_buf data area, and thus would not have changed.
 1.13 14-Sep-1998  thorpej Version setjmp(), longjmp(), _setjmp(), _longjmp(), sigsetjmp(), and
siglongjmp(). The size of struct sigcontext, and thus the size
of jmp_buf and sigjmp_buf on some platforms, has changed.
 1.12 06-May-1998  kleink Reorganize name space protection.
 1.11 20-Dec-1994  cgd *jmp_buf -> arrays of longs, and make the definition of _JBLEN mach. dep.
header-dependent.
 1.10 10-Dec-1994  jtc Kill warnings about sigsetjmp() and siglongjmp() being missing.
 1.9 26-Oct-1994  cgd new RCS ID format.
 1.8 16-May-1994  cgd update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those. Kill varargs.h, because it can simply
be a link to the machine-dependent version.
 1.7 27-Nov-1993  briggs Add defined(mc68000) || defined(__mc68000__) to the hp300 define for
_JBLEN. This will aid the integration of the five or so m68k ports,
I should think.
 1.6 19-Oct-1993  jtc Remove warnings wrt. sigsetjmp() && siglongjmp(), now that there is
an implementation for one of the ports. Other-port people need to
provide this for their ports. I have a program that tests the
setjmp/longjmp family of routines rather thouroughly it is needed.
 1.5 19-Oct-1993  deraadt _JBLEN is 9 on the sparc; I think.
 1.4 01-Sep-1993  cgd kill typo. you check if things are "defined", not "defgined". 8-)
 1.3 01-Sep-1993  deraadt addition of the pc532 architecture
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.23.10.1 09-Jan-2008  matt sync with HEAD
 1.24.20.1 19-Aug-2009  matt Add a _BSD_JBSLOT_T_ which can be defined in <machine/setjmp.h> if you need
a wider type than "long".
 1.25.8.1 10-Nov-2011  yamt sync with head
 1.8 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.6 10-Feb-1998  perry add/cleanup multiple inclusion protection.
 1.5 02-Feb-1998  perry merge lite-2
 1.4 05-Jun-1995  pk Prototypes (PR#1097)
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.4 01-Oct-2003  christos make some files symlinks from sys.
 1.3 30-Sep-2003  christos Include <sys/sha1.h> instead of copying its contents.
 1.2 09-Jul-2003  kristerw Remove variable names from prototypes.
 1.1 31-Mar-2002  bjh21 branches: 1.1.2;
split /usr/include/sys/sha1.h and /usr/include/sha1.h completely.
future direction: nuke /usr/include/sys/sha1.h, it shouldn't be there as
we don't provide libkern to userland.

This mirrors the same change for md5.h made by itojun on 2000/12/11.
 1.1.2.2 25-Apr-2002  nathanw Catch up to -current.
 1.1.2.1 31-Mar-2002  nathanw file sha1.h was added on branch nathanw_sa on 2002-04-25 04:07:10 +0000
 1.60 09-Sep-2024  rillig signal.h: sync comment with code, remove trailing whitespace
 1.59 02-Nov-2021  christos branches: 1.59.4;
Expose sigaltstack, stack_t and friends to Posix Issue 5 (200809L) References:

https://man7.org/linux/man-pages/man2/sigaltstack.2.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaltstack.html
 1.58 01-Nov-2021  thorpej Version the sigaction(2) libc wrapper. The new version uses the "siginfo"
trampoline exclusively, thus relegating "sigcontext"-style handlers (which
have not been documented for many years now) to the dustbin of the compat
library.
 1.57 08-Jan-2019  joerg Provide global variables with C linkage, otherwise they will create
conflicts for C++ modules use.
 1.56 09-May-2017  kre branches: 1.56.8; 1.56.10;


Add the new signalname/signalnext/signalnumber interface to libc.

This as discussed on current-users in the thread
entitled:
Proposal: new libc/libutil functions to map SIGXXXX <-> "XXXX"
that can be found (starting at):
http://mail-index.netbsd.org/current-users/2017/04/28/msg031600.html

These functions provide the mechanism to enable applications
to divorce themselves from internal details of the signal
implementation.

Libc minor bumped, prototypes in <signal.h>, sets lists updated (and sorted).

One and all: feel free to improve the sources & man page (etc), but
please do not change the function signatures without discussion.
 1.55 31-Jul-2015  kamil branches: 1.55.6;
Do as POSIX says, define the timespec structure in <signal.h>

Extract struct timespec from <sys/time.h> and put into a separate header.

This solution is minimally invasive.
 1.54 27-Aug-2010  christos The signal number argument in psignal is int not unsigned int.
Add psiginfo.
 1.53 31-Jul-2010  joerg Define a new __c99inline macro for compilers known to implement the C99
behavior. This unbreaks GCC 4.4's libgfortran build with the old
signal.h logic, because GCC decided to put the body for the sigsetop
functions in multiple objects.
 1.52 04-May-2010  plunky handle the difference between C99 and GNUC semantics of inline
functions with external linkage, by using "inline" for STDC and
"extern inline" for GNUC

(as noted by joerg@, using static inline may be clearer)
 1.51 11-Jan-2009  christos branches: 1.51.4;
merge christos-time_t
 1.50 03-Mar-2008  dholland branches: 1.50.12;
Add a comment noting that the definition of __errno is now replicated in
signal.h. Per request of joerg@
 1.49 24-Feb-2008  dholland signal.h is not supposed to define errno, so use ___errno instead.
Adjust errno.h in a compatible fashion to avoid -Wredundant-decls issues.
I have run a build to check the tree for places where errno.h is missing,
and fixed the cases I found, but there might be more in MD code.
 1.48 07-Jan-2006  kleink branches: 1.48.10; 1.48.16;
pthread_sigmask(): Add restrict qualifier to set, oset args.
 1.47 27-Dec-2005  perry inline -> __inline for selected things (specifically, the header
file is POSIX visible and the usage isn't #ifdef _KERNEL)

Discussed with core. I may need to go farther than this but for now
compilations done with gcc -ansi (i.e. firefox) will be okay.
 1.46 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.45 15-Sep-2005  drochner use __inline as before, otherwise "gcc -ansi" blows up
 1.44 13-Sep-2005  christos compat code reorg
 1.43 22-Mar-2005  kleink Add restrict qualifiers to remaining <signal.h> function arguments.
 1.42 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.41 20-Jan-2005  drochner Remove the remains of "struct sigcontext" and sigreturn() from the
user visible namespace.
These weren't supported interfaces for a while (it just happened to
work with COMPAT_16 kernels).
There are still internal uses in compat code and as jmp_buf format,
but this is all md code which uses <machine/signal.h>.
with christos' agreement
 1.40 31-Dec-2004  christos Provide forward struct declarations for struct sigcontext*; this will allow
us to get rid of them in the machine/signal.h files.
 1.39 10-Dec-2004  nathanw Use CPP macros to cause many libpthread functions used by applications
to be transformed into the do-nothing-when-libpthread-isn't-linked libc
stub names. This will permit library code that uses <pthread.h> and pthread
functions "defensively" to not need to link against libpthread and not need
to be patched to the threadlib.h API.
 1.38 01-Jul-2004  kleink Resolve some namespace protection confusion between XPG4.2 and 5/1003.1b,
making _XOPEN_SOURCE_EXTENDED work again. Fixes PR lib/26077.
 1.37 23-May-2004  kleink Implement sigemptyset() and sigfillset() not as macros but as inline
functions, just like the rest of the sigsetops. From J.T.Conklin
in PR lib/25627; originally prompted to work around problems with
an application but also fixing one important bug: per POSIX, these
functions may be additionally implemented as macros, iff they evaluate
their macros only once. This was not the case.
 1.36 12-Sep-2003  christos branches: 1.36.2;
don't put __libc_sigaction14 under __LIBC12_SOURCE__. It is wrong, because
then we have to define __LIBC12_SOURCE__ from __sigaction14_sigtramp.c and
that has the side effect of redefining struct sigaction to the old one.
 1.35 11-Sep-2003  christos s/COMPAT_16/__HAVE_SIGINFO/ pointed out by wiz.
 1.34 11-Sep-2003  christos sigreturn is not visible unless COMPAT_16 is enabled.
 1.33 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.32 18-Jul-2003  nathanw Synchronize the featuretest set for pthreads stuff to
_POSIX_C_SOURCE >= 199506L, _XOPEN_SOURCE >= 500, or _NETBSD_SOURCE.
 1.31 18-Jul-2003  thorpej Back out previous; it is not correct.
 1.30 18-Jul-2003  lukem for now, pull in <pthread_types.h> to get pthread_t for the
pthread_kill() prototype to work ...

this is probably not the correct long term solution, but the tree is
currently broken without it...
 1.29 17-Jul-2003  nathanw Now that sys/types.h defines pthread_t, the forward structure
declaration for pthread_st isn't necessary (and is why I missed that
it was necessary before, as I already had the sys/types.h change in my
local tree).
 1.28 17-Jul-2003  bjh21 Change !_ANSI_SOURCE to _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE.
 1.27 17-Jul-2003  martin Use a forward declaration equivalent to pthread_t instead of the
(undefined here) pthread_t.
 1.26 16-Jul-2003  nathanw Give the pthread_kill() prototype here, as required.
 1.25 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.24 15-Feb-2003  jdolecek add POSIX sigtimedwait(), sigwaitinfo(), sigwait() - wait for queued signals

note these are for non-threaded programs only - libpthread will provide
it's own thread-aware wrapper
 1.23 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.22 15-Jan-2003  kleink Add sighold(3), sigignore(3), sigrelse(3) and sigset(3) to libc.
Fixes PR lib/19212, now redesignated standards/19212, from David Laight.
 1.21 18-Dec-2000  christos branches: 1.21.2;
protect against multiple declarations. This also fixes a problem where
the inline functions would compile differently depending on if errno.h
was included or not.
 1.20 09-Dec-1998  christos Add /*LINTED*/ comments to sigfillset() and sigemptyset(). (void)sig*set(s);
produced warnings.
 1.19 30-Nov-1998  thorpej Change the type of sys_siglist and sys_signame from const char *const [] to
const char *const *, and rename them to __sys_siglist14 and __sys_signame14.
This will prevent the size of the exported symbol from changing when more
signals are added to the list.
 1.18 24-Oct-1998  kleink Rely on <sys/featuretest.h> defining _REENTRANT if appropriate.
 1.17 01-Oct-1998  kleink In the inlined sigset_t operations, redirect the error indicator assignment via
*__errno() when compiling _REENTRANT (or the like) code.
 1.16 21-Sep-1998  thorpej Declare the size of sys_siglist[] and sys_signame[] to be SIGUSR2+1
instead of _NSIG for now; we need to change these to char **'s, and do
a symbol renaming trick on them, eventually (a'la what Todd did with
libbfd's target match array).
 1.15 13-Sep-1998  thorpej __LIBCxx_SOURCE__ refers to the library major number, not the NetBSD release
number.
 1.14 12-Sep-1998  mycroft Minor KNFing.
 1.13 12-Sep-1998  mycroft Do the syscall versioning.
 1.12 25-May-1998  kleink Reorganize name space protection, mostly related to interfaces introduced in
XPG 4.2.
 1.11 29-Nov-1997  kleink Modify the recent sigaltstack() interface change to use the __RENAME() scheme;
add __sigaltstack14().
 1.10 26-Nov-1997  kleink Update sigaltstack() to use stack_t parameters.
 1.9 18-Nov-1997  kleink Move inclusion of <sys/types.h> before that of <sys/signal.h>.
 1.8 29-Feb-1996  jtc Add prototype for sigaltstack; from John Kohl in PR #2129
 1.7 28-May-1995  jtc Definition equating NSIG to _NSIG has been moved to <sys/signal.h>
 1.6 28-May-1995  jtc Use _NSIG instead of NSIG or constant 32.
Define NSIG equal to _NSIG if !ANSI && !POSIX.
 1.5 10-Jan-1995  jtc Don't include <sys/types.h> if _ANSI_SOURCE is defined.
 1.4 05-Jan-1995  jtc We removed the sigaddset(), sigdelset(), and sigismember() macros, although
they were POSIX.1 compliant, because users have misinterpreted the spec and
have written programs that depend on -1 being returned when a signal number
is out of range. This made initialization of signal masks significantly
more expensive.

This change uses GCC's inline function extension to provide macro-like
signal mask manipulation functions. Since most of the time constants
like SIGINT is used, gcc is able to remove unused range checking code.
Gcc is also smart enough to coalesce adjacent sigemptyset(), sigaddset(),
sigdelset(), and sigfullset() calls into a single assignment.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 12-Aug-1994  jtc Removed macro definitions of sigaddset(), segdelset(), & sigismember()
so that the function implementations (which have invalid signal error
checking) are used.
 1.1 11-May-1994  cgd branches: 1.1.1; 1.1.2;
user-land signal include file
 1.1.2.1 12-Aug-1994  mycroft update from trunk
 1.1.1.1 02-Feb-1998  perry import lite-2
 1.21.2.3 17-Jan-2003  thorpej Sync with HEAD.
 1.21.2.2 16-Jan-2003  thorpej * Move the pthread_sigmask() prototype to <signal.h>.
* Don't include <signal.h> in <pthread.h>.
* Add code to the signal trampoline to convert from the ucontext
to a sigcontext, and back again (XXX though, only callee-save
regs for _UC_USER contexts).

This is necessary in order to support e.g. GCC's libjava, which depends
on the traditional Unix semantics of changes made to the sigcontext
being visible when the handler returns.
 1.21.2.1 02-Oct-2002  thorpej libc:
Internally rename __sigaction14 to __libc_sigaction14. Provide a
weak alias of __sigaction14 -> __libc_sigaction14.

libpthread:
Use __libc_sigaction14 to actually register the signal handler, rather
than using __sigaction_sigtramp() directly with a hard-coded trampoline
version. While we don't actually use the libc trampoline, we want to
avoid depending on any COMPAT_* kernel options down the road (this is
already the case for the VAX port).

Be explicit about which version of the signal interface we're interposing
(...14), and build pthread_sig.c with __LIBC12_SOURCE__ (required to get
the libc-internal interfaces).
 1.36.2.2 02-Jul-2004  he Pull up revision 1.38 (requested by kleink in ticket #579):
Resolve some namespace protection confusion between XPG4.2
and 5/1003.1b, making _XOPEN_SOURCE_EXTENDED work again.
Fixes PR#26077.
 1.36.2.1 25-May-2004  jmc Pullup rev 1.37 (requested by kleink in ticket #381)

Implement sigemptyset() and sigfillset() not as macros but as inline
functions. PR#25627
 1.48.16.1 24-Mar-2008  keiichi sync with head.
 1.48.10.1 23-Mar-2008  matt sync with HEAD
 1.50.12.1 08-Nov-2008  christos changes for 64 bit time_t
 1.51.4.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.51.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.55.6.1 11-May-2017  pgoyette Sync with HEAD
 1.56.10.1 10-Jun-2019  christos Sync with HEAD
 1.56.8.1 18-Jan-2019  pgoyette Synch with HEAD
 1.59.4.1 02-Aug-2025  perseant Sync with HEAD
 1.5 07-Nov-2021  christos Commit the userland portion of the posix_spawn_chdir project by Piyush Sachdeva
 1.4 22-Feb-2012  martin branches: 1.4.2;
Use C++ compatible declaration for posix_spawn (instead of the C99 specific
posix one).
 1.3 21-Feb-2012  martin Make this include file C++ save, using the new __conly_restrict.
 1.2 20-Feb-2012  martin Add missing __BEGIN_DECLS, from Henning Petersen in PR misc/46058.
 1.1 11-Feb-2012  martin branches: 1.1.2;
Add userland part of posix_spawn. Libc functions imported from FreeBSD.
Based on Charles Zhang's summer of code project.
 1.1.2.2 23-Feb-2012  riz Pull up following revision(s) (requested by martin in ticket #36):
include/spawn.h: revision 1.4
lib/libc/gen/posix_spawnp.c: revision 1.2
Use C++ compatible declaration for posix_spawn (instead of the C99 specific
posix one).
 1.1.2.1 20-Feb-2012  sborrill Pull up the following revisions(s) (requested by martin in ticket #14):
include/spawn.h: revision 1.2
sys/kern/kern_exec.c: revision 1.341
sys/uvm/uvm_glue.c: revision 1.157
tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.3

posix_spawn: fix kernel bug when passing empty fileactions (PR kern/46038)
and add a test case for this. Fix potential race condition, doublefreeing
of memory and memory leaks in error cases.
 1.4.2.2 17-Apr-2012  yamt sync with head
 1.4.2.1 22-Feb-2012  yamt file spawn.h was added on branch yamt-pagecache on 2012-04-17 00:05:10 +0000
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.5 02-Feb-1998  perry merge lite-2
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 19-Apr-1993  mycroft Add reinclusion protection.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.2 25-Aug-2024  christos PR/58640: Riastradh: Provide sys/stdalign.h
 1.1 02-Oct-2016  kamil branches: 1.1.2; 1.1.28;
Import <stdalign.h>

This header conforms to the C11 standard
Reference: ISO/IEC 9899:201x 7.15 Alignment <stdalign.h>

According to ISO/IEC 9899:201x (draft) 7.15 Alignment <stdalign.h> defines
four macros:
- alignas which expands to _Alignas
- alignof which expands to _Alignof
- __alignas_is_defined and __alignof_is_defined which both expand to 1

The _Alignas declaration appears as one of the type specifiers to modify
the alignment requirement of the object being declared.

The _Alignof operator is used to query the alignment requirement of its
operand type.

ISO/IEC N3242=11-0012 (C++1x) and ISO/IEC N3797 (C++1y) both note a header
<cstdalign> which defines only __alignas_is_defined and shall not define
the alignas macro. It misses the alignof case as it's probably based on an
older C1x draft, which defined only alignas. Assume that this is a bug in
the standard and treat alignof the same way as alignas in C++11.

Allow to define alignas and alignof in C++ prior the C++11 standard. It
might be broken but a nonstandard C++ compiler might support C11-like
_Alignas and _Alignof. Note that it's fatal for g++(1) v.5.4.
 1.1.28.1 02-Aug-2025  perseant Sync with HEAD
 1.1.2.2 04-Nov-2016  pgoyette Sync with HEAD
 1.1.2.1 02-Oct-2016  pgoyette file stdalign.h was added on branch pgoyette-localcount on 2016-11-04 14:48:51 +0000
 1.3 15-Oct-1994  mycroft Clean up deleted files.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6 29-Jul-2015  christos move stdbool.h to sys, reuire pool.h to include <sys/stdbool.h> for bool,
centralize definitions of bool, true, false, to <sys/stdbool.h>
 1.5 26-Apr-2013  joerg Define __bool_true_false_are_defined for C++ as well.
 1.4 26-Apr-2013  joerg Do not define bool/true/false for C++.
 1.3 28-Apr-2008  martin branches: 1.3.6; 1.3.10; 1.3.32;
Remove clause 3 and 4 from TNF licenses
 1.2 20-May-2004  kleink branches: 1.2.24;
Make it possible to use <stdbool.h> in C++ applications.
Fixes PR lib/25597 from Takuya SHIOZAKI.
 1.1 02-Feb-2002  thorpej branches: 1.1.2; 1.1.6;
ISO C / SUSv3 <stdbool.h>.
 1.1.6.1 22-May-2004  he Pull up revision 1.2 (requested by kleink in ticket #368):
Make it possible to use <stdbool.h> in C++ applications.
Fixes PR#25597.
 1.1.2.2 11-Mar-2002  nathanw Catch up to -current.
 1.1.2.1 02-Feb-2002  nathanw file stdbool.h was added on branch nathanw_sa on 2002-03-11 21:07:50 +0000
 1.2.24.1 18-May-2008  yamt sync with head.
 1.3.32.1 23-Jun-2013  tls resync from head
 1.3.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.10.1 28-Apr-2008  martin file stdbool.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.3.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.25 08-Oct-2024  christos PR/58729: Taylor R Campbell: container_of is not documented or available
in userland
 1.24 13-May-2020  joerg branches: 1.24.8;
Remove trailing whitespace
 1.23 01-Mar-2020  kamil Revert previous

Requested by joerg who wants to fix (ab)users.
 1.22 01-Mar-2020  kamil Fix typo in a comment
 1.21 01-Mar-2020  kamil Expose max_align_t to C99/C++

max_align_t does not depend on any pre-C99 or !C++ language feature.

This structure is in use in 3rd party essential C++ code as an extension
for older language revisions and in gnu99 code in the NetBSD distribution
(RTLD's build rules define -std=gnu11 just for exposing this struct).

Exposing max_align_t from the central NetBSD header avoid duplicate
definition in 3rd party code that could differ and produce ABI mismatched
binaries between -std= revisions.

This problem does not exist on OSs like Linux as they get this namespace
visibility defined inside LLVM or GNU toolchain headers. NetBSD ships with
its own stddef.h, rather than relying on a toolchain and its internal
extensions.
 1.20 20-Mar-2016  christos use foo - 0 instead of testing for defined(foo); from joerg@
 1.19 20-Mar-2016  christos PR/50983: David Shao: Protect stddef;
also make the pointer void *.
 1.18 17-Mar-2016  mrg add max_align_t. C11 defines this and GCC 5.3 really wants it.

XXX: language laywers, please feel free to fix this as necessary.
 1.17 12-Dec-2013  matt Make ptrdiff_t available in the kernel.
 1.16 15-Nov-2009  christos branches: 1.16.8; 1.16.14;
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.15 21-Aug-2006  thorpej branches: 1.15.26; 1.15.36;
Use __GNUC_PREREQ__() for the GCC 4 test, too.
 1.14 21-Aug-2006  christos __offsetof__ is a builtin, so we need __GNU_PREREQ
 1.13 21-Aug-2006  christos gcc-3.3 does not have __offsetof__, but gcc-3.4 eems to require it:

From the redhat web page:

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gcc/offsetof.html

__offsetof__ (expression)
is equivalent to the parenthesized expression, except that the
expression is considered an integral constant expression even if
it contains certain operators that are not normally permitted in
an integral constant expression. Users should never use __offsetof__
directly; the only valid use of __offsetof__ is to implement the
offsetof macro in <stddef.h>.
 1.12 21-Aug-2006  christos g++-4 does not like &0->member, so we have to use the built-in offsetof().
g++-3 does not have a built-in offsetof(), but we cannot use the c version,
otherwise we break with -Wold-style-cast.
Inspired by the DF version, but a bit different.
 1.11 21-Aug-2006  skd Use gcc's builtin function. This permits c++ compiliation of const
expressions using offsetof. Boost-python relies on this, for example.
 1.10 07-Aug-2003  agc branches: 1.10.4; 1.10.6; 1.10.12;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.9 10-Nov-2000  tshiozak u_long -> unsigned long in "offsetof" macro.
Using u_long causes <stddef.h> to undesirably depend on <sys/types.h> .
BTW: Why is the cast needed?
 1.8 06-Jul-2000  christos de-lint
 1.7 10-Jan-2000  kleink branches: 1.7.2;
Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
std C headers including it, and a kernel module written in C++ would benfit
as well.
 1.6 22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.5 02-Feb-1998  perry merge lite-2 sccs id, but as per jt, don't switch to using lite-2 rune_t's
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 21-May-1994  cgd add _BSD's to ansi types
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.10.12.5 24-Aug-2006  tron Pull up following revision(s) (requested by joerg in ticket #48):
include/stddef.h: revision 1.15
Use __GNUC_PREREQ__() for the GCC 4 test, too.
 1.10.12.4 24-Aug-2006  tron Pull up following revision(s) (requested by joerg in ticket #48):
include/stddef.h: revision 1.14
__offsetof__ is a builtin, so we need __GNU_PREREQ
 1.10.12.3 24-Aug-2006  tron Pull up following revision(s) (requested by joerg in ticket #48):
include/stddef.h: revision 1.13
gcc-3.3 does not have __offsetof__, but gcc-3.4 eems to require it:
From the redhat web page:
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gcc/offsetof.html
__offsetof__ (expression)
is equivalent to the parenthesized expression, except that the
expression is considered an integral constant expression even if
it contains certain operators that are not normally permitted in
an integral constant expression. Users should never use __offsetof__
directly; the only valid use of __offsetof__ is to implement the
offsetof macro in <stddef.h>.
 1.10.12.2 24-Aug-2006  tron Pull up following revision(s) (requested by joerg in ticket #48):
include/stddef.h: revision 1.12
g++-4 does not like &0->member, so we have to use the built-in offsetof().
g++-3 does not have a built-in offsetof(), but we cannot use the c version,
otherwise we break with -Wold-style-cast.
Inspired by the DF version, but a bit different.
 1.10.12.1 24-Aug-2006  tron Pull up following revision(s) (requested by joerg in ticket #48):
include/stddef.h: revision 1.11
Use gcc's builtin function. This permits c++ compiliation of const
expressions using offsetof. Boost-python relies on this, for example.
 1.10.6.5 01-Nov-2006  tron Pull up following revision(s) (requested by joerg in ticket #1473):
include/stddef.h: revision 1.15
Use __GNUC_PREREQ__() for the GCC 4 test, too.
 1.10.6.4 01-Nov-2006  tron Pull up following revision(s) (requested by joerg in ticket #1473):
include/stddef.h: revision 1.14
__offsetof__ is a builtin, so we need __GNU_PREREQ
 1.10.6.3 01-Nov-2006  tron Pull up following revision(s) (requested by joerg in ticket #1473):
include/stddef.h: revision 1.13
gcc-3.3 does not have __offsetof__, but gcc-3.4 eems to require it:
From the redhat web page:
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gcc/offsetof.html
__offsetof__ (expression)
is equivalent to the parenthesized expression, except that the
expression is considered an integral constant expression even if
it contains certain operators that are not normally permitted in
an integral constant expression. Users should never use __offsetof__
directly; the only valid use of __offsetof__ is to implement the
offsetof macro in <stddef.h>.
 1.10.6.2 01-Nov-2006  tron Pull up following revision(s) (requested by joerg in ticket #1473):
include/stddef.h: revision 1.12
g++-4 does not like &0->member, so we have to use the built-in offsetof().
g++-3 does not have a built-in offsetof(), but we cannot use the c version,
otherwise we break with -Wold-style-cast.
Inspired by the DF version, but a bit different.
 1.10.6.1 01-Nov-2006  tron Pull up following revision(s) (requested by joerg in ticket #1473):
include/stddef.h: revision 1.11
Use gcc's builtin function. This permits c++ compiliation of const
expressions using offsetof. Boost-python relies on this, for example.
 1.10.4.1 03-Sep-2006  riz Pull up following revision(s) (requested by joerg in ticket #10676):
include/stddef.h: revision 1.11
include/stddef.h: revision 1.12
include/stddef.h: revision 1.13
include/stddef.h: revision 1.14
include/stddef.h: revision 1.15
Use gcc's builtin function. This permits c++ compiliation of const
expressions using offsetof. Boost-python relies on this, for example.
g++-4 does not like &0->member, so we have to use the built-in offsetof().
g++-3 does not have a built-in offsetof(), but we cannot use the c version,
otherwise we break with -Wold-style-cast.
Inspired by the DF version, but a bit different.
gcc-3.3 does not have __offsetof__, but gcc-3.4 eems to require it:
From the redhat web page:
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gcc/offsetof.html
__offsetof__ (expression)
is equivalent to the parenthesized expression, except that the
expression is considered an integral constant expression even if
it contains certain operators that are not normally permitted in
an integral constant expression. Users should never use __offsetof__
directly; the only valid use of __offsetof__ is to implement the
offsetof macro in <stddef.h>.
__offsetof__ is a builtin, so we need __GNU_PREREQ
Use __GNUC_PREREQ__() for the GCC 4 test, too.
 1.15.36.1 20-May-2011  bouyer Pull up following revision(s) (requested by joerg in ticket #1611):
include/inttypes.h: revision 1.7
include/stddef.h: revision 1.16
include/wchar.h: revision 1.28
include/stdlib.h: revision 1.90
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.15.26.1 20-May-2011  bouyer Pull up following revision(s) (requested by joerg in ticket #1611):
include/inttypes.h: revision 1.7
include/stddef.h: revision 1.16
include/wchar.h: revision 1.28
include/stdlib.h: revision 1.90
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.16.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.8.1 02-Aug-2025  perseant Sync with HEAD
 1.104 11-Sep-2021  rillig stdio.h: remove outdated comment for vscanf

When these functions where added to stdio.h 1.72 on 2008-08-04, the
conditional included _NETBSD_SOURCE.

The additional condition was removed in stdio.h 1.99 from 2020-03-20,
but the comment was not updated.
 1.103 11-Sep-2021  rillig stdio.h: sync comment for struct __sFILE with reality

In stdio.h 1.1 from 1993-03-21, the struct had a member named _ub for
the ungetc buffer. That member was repurposed in stdio.h 1.42 from
2001-12-07 in order to support wide characters.

Remove the reference to the 'WARNING above' since there is no such
warning and even when this comment was added in stdio.h 1.20 from
1998-02-02, there was none.
 1.102 11-Sep-2021  rillig stdio.h: remove outdated comment about fpos_t

The 'fairly grotesque' from 1994-04-03 referred to the conditional
definition of the type fpos_t, using two different integer types that
both happened to be 64-bit.

When stdio was changed on 2012-01-22 to keep track of the mbstate, the
conditional type definition was removed and the comment no longer made
sense.
 1.101 11-Sep-2021  rillig stdio.h: fix typo in comment
 1.100 11-Sep-2021  rillig stdio.h: fix typo in comment
 1.99 20-Mar-2020  joerg Fix visibility of various C99 features, esp. for C++11.
 1.98 13-Dec-2019  mrg move P_tmpdir from "/var/tmp/" to "/tmp/".

the main effect of this is to make GCC and other libiberty using
tools use /tmp instead of /var/tmp for compiler temp files,
which can be a bottleneck on larger systems.

a survey of other platforms shows only OSX also uses /var/tmp,
everyone else has switched to /tmp long ago.


cons: some smaller systems may have a smaller /tmp than /var/tmp,
and this may cause builds to fail with out of space earlier.
point the build to /var/tmp using TMPDIR in this case.

one can argue that setting TMPDIR would work around this, but we
want to have the effect for all users without having special setup.
 1.97 17-Mar-2016  christos branches: 1.97.8; 1.97.16; 1.97.18;
gcc 5, my patience is waning.
 1.96 24-Mar-2015  wiz Put fseeko, ftello, pread, and pwrite in the POSIX 2001 namespace.
Ok christos, apb, martin
 1.95 05-Mar-2015  dholland One vscanf_l is ample.
 1.94 04-Mar-2015  christos PR/49715: Henning Petersen: Missing _*_DECLS in stdio.h around popenve.
 1.93 20-Jan-2015  christos add popenve().
 1.92 13-Oct-2014  christos add open_{,w}memstream
 1.91 07-Aug-2014  christos branches: 1.91.2;
cast to LHS type and minor KNF.
 1.90 23-May-2014  joerg Fix use of getline and friends in C++ code.
 1.89 19-May-2014  kleink Move declarations of getdelim() and getline() from the (incorrect) ANSI C
section to POSIX-2008. From Jarmo Jaakkola in PR standards/48788.
 1.88 04-May-2013  christos branches: 1.88.4;
add the signal safe prototypes
 1.87 26-Apr-2013  joerg Don't pollute the name space with the various stdio macros for C++.
 1.86 19-Apr-2013  joerg Add missing __BEGIN_DECLS/__END_DECLS.
 1.85 19-Apr-2013  joerg Add scanf_l and wscanf_l families.
 1.84 19-Apr-2013  joerg Add explicit locale versions for the printf family. Replace asprintf,
snprintf and sprintf with simple wrappers around the corresponding
va_list functions to reduce code duplication.
 1.83 17-Apr-2013  joerg White space
 1.82 18-Apr-2012  christos branches: 1.82.2;
specify size of the array to help -fmudflap
 1.81 27-Mar-2012  christos funopen2()
 1.80 22-Jan-2012  christos branches: 1.80.2;
From tnozaki@: make fpos_t a complex object that keeps track of the parse
state of the stream. Change argument of the seek function to funopen() from
fpos_t to off_t. Make f{g,s}etpos() use the new fpos_t struct, while providing
backwards compatible entry points. Approved by releng@
 1.79 17-Jul-2011  joerg branches: 1.79.2;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.78 24-Sep-2010  tnozaki add fmemopen(3) derrived from POSIX:2008.
libc minor bump.
 1.77 06-Sep-2010  christos Add dprintf and vdprintf. XXX: Might ifdef it if too many things break.
 1.76 25-Feb-2010  joerg Consistently use __printflike and __scanflike.
 1.75 11-Jan-2010  joerg branches: 1.75.2;
Use a proper char */size_t pair in __sfileext to keep track of the line
buffer for fgetln and fgetwln. Simplifies code by dropping the INT_MAX
related logic. Drop conditionals around FREELB, free(NULL) is valid.
 1.74 13-Jul-2009  roy Add implementations for getdelim(3) and getline(3).
 1.73 21-Sep-2008  christos branches: 1.73.6;
add missing attributes to the remaining calls, even the ones that gcc has
builtin attributes for (for symmetry and consistency). In the future this
might change to use compiler-neutral macros. On the other hand I don't
know of any other compiler that provides other macros with similar
functionality, so why bother?
 1.72 04-Aug-2008  matt Add _POSIX_HOST_NAME_MAX and _POSIX_SYMLOOP_MAX to <limits.h> and add some
references to them in <sys/param.h>
in <stdio.h> also export v*scanf when _ISOC99_SOURCE is defined

From andy dot shevchenko at gmail dot com.
 1.71 13-Mar-2008  christos branches: 1.71.4;
Since _file is a short, check that the fd fits in it, otherwise bail with
EMFILE. We treat _file as an unsigned short to double our range, with a
special case for -1 (closed). Make a note of what we should do about stdio
if we ever bump libc. We could change _file in the future compatibly to an
int by putting it in the extension space but for now we don't bother.
 1.70 02-Aug-2007  kristerw branches: 1.70.2; 1.70.6; 1.70.8;
Do not include SSP files unless _FORTIFY_SOURCE > 0.
 1.69 30-May-2007  tls Match usage of FORTIFY_SOURCE on other platforms by not requiring special
include path: the normal header files now include the "SSP" ones (which one
should note are not really named right: SSP and FORTIFY_SOURCE are independent
features).

Disable USE_SSP on targets where the compiler doesn't support it at all
(mips, alpha) or it's known broken (sh3). But enable FORTIFY_SOURCE,
without SSP, on those platforms -- tested on mipsel.
 1.68 02-Feb-2007  christos remove __SAFE
 1.67 09-Dec-2006  bjh21 defined(_NETBSD_SOURCE) is equivalent to (!defined(_ANSI_SOURCE) &&
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)), so there's no
need to check both of them.
 1.66 22-Nov-2006  christos branches: 1.66.2;
Don't expose _ss functions for 4.0. Requested by core.
 1.65 27-Oct-2006  christos - flags should be unsigned short instead of short.
- add __SAFE flag, to indicate that we want async-signal-safe functionality
only.
- add snprintf_ss, and vsnprintf_ss; these are undocumented on purpose.
 1.64 10-May-2006  mrg add __BEGIN_DECLS/__END_DECLS around snprintf() & vsnprintf() prototypes.
 1.63 27-Dec-2005  perry inline -> __inline for selected things (specifically, the header
file is POSIX visible and the usage isn't #ifdef _KERNEL)

Discussed with core. I may need to go farther than this but for now
compilations done with gcc -ansi (i.e. firefox) will be okay.
 1.62 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.61 25-May-2005  kleink Include <sys/ansi.h> after <sys/cdefs.h>; from Neil Booth in PR lib/30072.
 1.60 25-May-2005  kleink Belatedly move snprintf() and vnsnprintf() into the XPG4.2/C99 section.
 1.59 25-May-2005  kleink Add restrict qualifiers to fopen()/freopen() arguments.
 1.58 09-Feb-2005  kleink branches: 1.58.2;
A little libc namespace housekeeping exercise:
* Make vfprintf_unlocked() an internal function, c.f. __svfscanf_unlocked().
* Add internal names for arc4random(), endnetpath(), fhstatvfs(),
fstatvfs(), mkstemp(), shquote(), statvfs(), taddr2uaddr(), uaddr2taddr(),
uuid_create_nil(), uuid_is_nil(), and wcwidth().
* Include namespace.h where supposed to.
 1.57 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.56 01-Jul-2004  kleink Tidy up the namespace: lint -> __lint__.
 1.55 10-May-2004  drochner remove fgetstr() from public sight
 1.54 21-Apr-2004  christos add fgetstr
 1.53 07-Aug-2003  agc branches: 1.53.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.52 05-Jun-2003  bjh21 P_tmpdir isn't in POSIX, so only define it for _XOPEN_SOURCE and
_NETBSD_SOURCE.
 1.51 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.50 27-Feb-2003  kleink As with _REENTRANT, don't provide simple non-locking macro versions of
several functions when _PTHREADS is defined (usually via cc -pthread).
 1.49 18-Jan-2003  christos avoid TMP_MAX redefinition
 1.48 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.47 20-Dec-2002  atatat Spelling police. "__resitrct" was not spelled cirectly enough.
 1.46 30-Nov-2002  lukem - Migrate fparseln(3) from libutil to libc, where it should have been in
the first place...
- Bump libutil major (to 7.0) and libc minor (to 12.91).
 1.45 24-May-2002  thorpej * Move the prototype of __svfscanf from <stdio.h> to libc/stdio/local.h.
* Add prototype for vfscanf to <stdio.h>.
* Remove #define of vfscanf to __svfscanf from <stdio.h>.
* Include local.h in libc files which need __svfscanf.
* Add vfscanf weak alias to __svfscanf.

Fixes standards/16997.

NOTE: libc minor not bumped -- ride on the bump to 12.84 made by
itojun today.
 1.44 24-May-2002  thorpej Parameterize the vfscanf macro's arguments. Without them, 3rd party
software can become greatly confused.

This fixes 4 GCC 3.2 testsuite failures.

This is a stop-gap measure which can be easily applied to the 1.6
release branch. A different fix for the trunk is forthcoming.
 1.43 24-May-2002  thorpej Add a scanf format attribute to __svfscanf().
 1.42 07-Dec-2001  yamt branches: 1.42.2;
- make FILE structure extensible without breaking binary-compatibility.
- add fputwc, fgetwc, fwide and related functions.
- add hooks needed to maintain the orientation of file stream.
 1.41 29-Dec-2000  kleink branches: 1.41.2;
Sprinkle some __restrict into stdio.
 1.40 18-Dec-2000  christos protect against multiple declarations.
 1.39 15-Nov-2000  briggs Move fmtcheck() prototype to stdio.h. It makes more sense to declare it
with the formatting functions with which it is meant to be used. Thanks
to Klaus Klein for "encouraging" me to make this change.
 1.38 28-Jul-2000  kleink Avoid recursion with traditional cpp.
 1.37 23-Jul-2000  mycroft This is a HACK so that libc can compile with -ansi.
 1.36 16-Jul-2000  enami - Fix couple of typos.
- Protect some func. decls. added recently with __{BEGIN,END}_DECLS.
 1.35 15-Jul-2000  drochner fix obvious typo
 1.34 08-Jul-2000  kleink XCU5: Add fseeko() and ftello() functions which provide the functionality of
fseek() and ftell(), respectively, but operate on file offsets of type off_t.
 1.33 26-Jun-2000  kleink Get rid of the inclusion of <sys/types.h> and define fpos_t using __off_t.
 1.32 10-Jan-2000  kleink Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
std C headers including it, and a kernel module written in C++ would benfit
as well.
 1.31 22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.30 20-Nov-1998  kleink * Bring *_unlocked() declarations in scope if _REENTRANT is defined, too; add
similar protection for the definitions of the macro versions.
* Don't define a macro version of fileno() in a _REENTRANT environment.
 1.29 28-Sep-1998  kleink Move 1003.1c-1995 declarations inside the appropriate name space protection
wrapper, and make sure we won't use these decl's as such with C++ linkage(!).
Also, make _XOPEN_SOURCE protection of popen()/pclose() decl's a bit more
restrictive.
 1.28 28-Aug-1998  tv Use __format__, __printf__ for consistency
 1.27 28-Aug-1998  perry add asprintf and vasprintf, originally written by Todd Miller for OpenBSD
 1.26 30-Jul-1998  mycroft __Namespace__ __protection__.
 1.25 27-Jul-1998  mycroft Nuke tmpnam() as well.
 1.24 27-Jul-1998  mycroft If __AUDIT__ is defined, remove some traditional interfaces: gets, sprintf,
vsprintf, tempnam, mktemp, getwd.
 1.23 11-May-1998  drochner add missing backslash
 1.22 11-May-1998  kleink Reorganize name space protection.
 1.21 14-Feb-1998  kleink If standards-compliance is requested by defining the preprocessor symbols
_POSIX_SOURCE or _XOPEN_SOURCE at compile time, use __RENAME() to call
__posix_rename() instead of rename() in order to remove the requirement of
linking against libposix.
 1.20 02-Feb-1998  perry merge lite-2
 1.19 19-Jan-1998  jtc Added function declarations for flockfile(), ftrylockfile(), funlockfile(),
getc_unlocked(), getchar_unlocked(), putc_unlocked(), & putchar_unlocked().
Added macro definitions for the latter four functions.

Changed so that getc(), putc(), clearerr(), feof() and ferror() macros
are not defined if _REENTRANT is defined so that thread-safe function
versions will be used instead.
 1.18 25-Apr-1996  jtc Fix typo, __STRICT_ANSI_ -> __STRICT_ANSI__
 1.17 20-Jan-1996  jtc Removed declarations for sys_nerr & sys_errlist (moved to errno.h)
 1.16 25-Mar-1995  jtc change second arg of fgets() from size_t to int
 1.15 22-Mar-1995  jtc Removed const qualifier from ftell's FILE * argument. It's not ANSI,
and the recent change to flush output causes it to be changed.
 1.14 26-Oct-1994  cgd new RCS ID format.
 1.13 22-May-1994  cgd _VA_LIST_ -> _BSD_VA_LIST_
 1.12 21-May-1994  cgd add _BSD's to ansi types
 1.11 03-Apr-1994  cgd fpos_t is now a 64-bit quantity
 1.10 04-Jan-1994  cgd rename fgetline() and sharpen axe for bostic...
 1.9 02-Dec-1993  mycroft Add `const's to sys_errlist decl to match 4.4.
 1.8 01-Dec-1993  jtc Use GCC's format attribute (for bug detection with -Wformat).
 1.7 11-Oct-1993  jtc Restore define for L_cuserid and add cuserid prototype.
It was provided, but not documented.
 1.6 06-Oct-1993  jtc cuserid() was removed by 1990's revision of 1003.1, and we never provided it
so don't define the L_cuserid constant.
 1.5 04-Oct-1993  jtc fread and fwrite both return size_t, not int.
 1.4 04-Oct-1993  cgd sscanf takes a const char * as the first arg; the man page was (already)
correct.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 17-Apr-1993  sef `inline' is not present in gcc when -ansi is given; use __inline instead.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.41.2.7 29-Dec-2002  thorpej Sync with HEAD.
 1.41.2.6 10-Dec-2002  thorpej Sync with HEAD.
 1.41.2.5 21-Jun-2002  nathanw Catch up to -current.
 1.41.2.4 02-May-2002  nathanw Add prototypes for vfprintf_unlocked() and __svfscanf_unlocked().
 1.41.2.3 28-Jan-2002  nathanw Catch up to -current.
 1.41.2.2 14-Jan-2002  nathanw Catch up to -current.
 1.41.2.1 16-Nov-2001  thorpej Enable the flockfile()/funlockfile()/ftrylockfile() prototypes.
 1.42.2.1 24-May-2002  perry resolve 1.6 pullup tickets #12 and #20, submitted by thorpej.
This change pulls up revisions 1.43 and 1.44

Original messages:

> Add a scanf format attribute to __svfscanf().

and

> Parameterize the vfscanf macro's arguments. Without them, 3rd party
> software can become greatly confused.
>
> This fixes 4 GCC 3.2 testsuite failures.
>
> This is a stop-gap measure which can be easily applied to the 1.6
> release branch. A different fix for the trunk is forthcoming.
 1.53.2.1 02-Jul-2004  he branches: 1.53.2.1.2;
Pull up revision 1.56 (requested by kleink in ticket #580):
Tidy up the namespace: lint -> __lint__.
 1.53.2.1.2.2 29-May-2005  riz Pull up revision 1.60 via patch (requested by kleink in ticket #1556):
Belatedly move snprintf() and vnsnprintf() into the XPG4.2/C99 section.
 1.53.2.1.2.1 29-May-2005  riz Pull up revision 1.61 (requested by kleink in ticket #1555):
Include <sys/ansi.h> after <sys/cdefs.h>; from Neil Booth in PR lib/30072.
 1.58.2.3 28-May-2005  tron Pull up revision 1.60 (requested by kleink in ticket #348):
Belatedly move snprintf() and vnsnprintf() into the XPG4.2/C99 section.
 1.58.2.2 28-May-2005  tron Pull up revision 1.61 (requested by kleink in ticket #346):
Include <sys/ansi.h> after <sys/cdefs.h>; from Neil Booth in PR lib/30072.
 1.58.2.1 28-May-2005  tron Pull up revision 1.59 (requested by kleink in ticket #344):
Add restrict qualifiers to fopen()/freopen() arguments.
 1.66.2.3 24-Aug-2007  liamjfoy Pull up following revision(s) (requested by kristerw in ticket #833):
include/unistd.h: revision 1.112
lib/libc/ssp/snprintf_chk.c: revision 1.4
lib/libc/ssp/sprintf_chk.c: revision 1.4
lib/libc/ssp/vsprintf_chk.c: revision 1.4
lib/libc/ssp/gets_chk.c: revision 1.4
include/stdio.h: revision 1.70
lib/libc/ssp/vsnprintf_chk.c: revision 1.4
lib/libc/ssp/fgets_chk.c: revision 1.4
include/strings.h: revision 1.12
include/string.h: revision 1.33
Do not include SSP files unless _FORTIFY_SOURCE > 0.
Update includes so that this builds for USE_FORT=no too.
 1.66.2.2 22-Jul-2007  liamjfoy Pull up to netbsd-4 (requested by christos in ticket #773):

Move libssp to libc.
 1.66.2.1 07-May-2007  pavel branches: 1.66.2.1.2;
Pull up following revision(s) (requested by manu in ticket #607):
lib/libc/arch/i386/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoa.c: revision 1.2-1.3
lib/libc/arch/x86_64/gen/isnanl.c: revision 1.6
lib/libc/gdtoa/gdtoaimp.h: revision 1.6
sys/arch/m68k/include/ieee.h: revision 1.13
usr.bin/xlint/lint1/scan.l: revision 1.36-1.37
lib/libc/stdio/snprintf_ss.c: revision 1.4
lib/libc/arch/i386/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfscanf.c: revision 1.38
sys/arch/sparc/include/ieee.h: revision 1.11-1.12
lib/libc/gdtoa/dtoa.c: revision 1.4
lib/libc/stdio/Makefile.inc: revision 1.35
lib/libc/stdio/fvwrite.c: revision 1.17
lib/libc/arch/m68k/gen/fpclassifyl.c: revision 1.2
lib/libc/arch/i386/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isinfl.c: revision 1.6
lib/libc/arch/x86_64/gen/isfinitel.c: revision 1.2
lib/libc/stdio/vfprintf.c: revision 1.55-1.57
lib/libc/stdio/vsnprintf_ss.c: revision 1.3
lib/libc/stdio/vfwprintf.c: revision 1.10
sys/arch/x86/include/ieee.h: revision 1.10
lib/libc/gdtoa/dmisc.c: revision 1.3
lib/libc/gdtoa/Makefile.inc: revision 1.5
sys/arch/hppa/include/ieee.h: revision 1.10
lib/libc/arch/x86_64/gen/fpclassifyl.c: revision 1.3
lib/libc/arch/i386/gen/fpclassifyl.c: revision 1.2
sys/sys/ieee754.h: revision 1.7
lib/libc/gdtoa/gdtoa.h: revision 1.7
include/stdio.h: revision 1.67-1.68
lib/libc/gdtoa/hdtoa.c: revision 1.1-1.4
lib/libc/gdtoa/ldtoa.c: revision 1.1-1.4
defined(_NETBSD_SOURCE) is equivalent to (!defined(_ANSI_SOURCE) &&
!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)), so there's no
need to check both of them.
Fix for issue reported in PR lib/35401 as well as related overflow bugs.
deal with hex doubles.
Instead of abusing stdio to get a signal-safe version of sprintf, provide one.
remove __SAFE
add long double and hex double support from freebsd.
make this compile.
add new prototypes.
add the new files to the build. Note I am not bumping libc now, because
these are not used yet.
Merge the int bit with the high fraction bit. Add constants/macros
needed by gdtoa.
add constants used by gdtoa
since the int bit is merged, do the explicit math.
ext_int bit is no more.
ext_int bit is no more.
- merge change from freebsd
- add support for building as vfprintf.c
- XXX: we strdup to simplify the freeing logic. This should be fixed for
efficiency in the vfprintf case.
use vfwprintf.c
enable wide doubles.
some int -> size_t
deal with sparc64 that has 112 bits of mantissa.
make extended precision gdtoa friendly.
int/size_t changes
make this gdtoa friendly.
remove dup definition
use dtoa() instead of returning empty when we don't have extended precision
information.
Fix previous, add forgotten pointer dereference in the call to dtoa().
Add a cheesy workaround marked XXX for the situation where the
strtod() implementation available in the environment does not
handle hex floats.
Discussed with and suggested by christos
From Christos: gdtoa fixes for m68k. M68k ports should build now, but
printing extended precision is a little off.
vax does not have <machine/ieee.h> or long double
It would be nice if the compiler provided something like __IEEE_MATH__
bring in FreeBSD's vfscanf() to gain multi-byte/collation support.
Unfortunately it is too difficult to make vfwscanf and this share
the same code like I did with printf, because for string parsing
the code is too different.
 1.66.2.1.2.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.70.8.2 02-Aug-2007  kristerw Do not include SSP files unless _FORTIFY_SOURCE > 0.
 1.70.8.1 02-Aug-2007  kristerw file stdio.h was added on branch matt-mips64 on 2007-08-02 21:49:10 +0000
 1.70.6.1 24-Mar-2008  keiichi sync with head.
 1.70.2.1 23-Mar-2008  matt sync with HEAD
 1.71.4.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.73.6.2 21-Sep-2008  christos add missing attributes to the remaining calls, even the ones that gcc has
builtin attributes for (for symmetry and consistency). In the future this
might change to use compiler-neutral macros. On the other hand I don't
know of any other compiler that provides other macros with similar
functionality, so why bother?
 1.73.6.1 21-Sep-2008  christos file stdio.h was added on branch christos-time_t on 2008-09-21 16:59:47 +0000
 1.75.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.75.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.79.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.79.2.2 23-May-2012  yamt sync with head.
 1.79.2.1 17-Apr-2012  yamt sync with head
 1.80.2.1 03-Jun-2014  msaitoh Pull up following revision(s) (requested by kleink in ticket #1066):
src/include/stdio.h 1.89-1.90

Move declarations of getdelim() and getline() from the (incorrect) ANSI C
section to POSIX-2008. From Jarmo Jaakkola in PR standards/48788.
 1.82.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.82.2.1 23-Jun-2013  tls resync from head
 1.88.4.1 10-Aug-2014  tls Rebase.
 1.91.2.1 25-Mar-2015  snj Pull up following revision(s) (requested by wiz in ticket #642):
include/stdio.h: revision 1.96
include/unistd.h: revision 1.145
Put fseeko, ftello, pread, and pwrite in the POSIX 2001 namespace.
Ok christos, apb, martin
 1.97.18.1 30-Mar-2020  martin Pull up following revision(s) (requested by mrg in ticket #811):

include/stdio.h: revision 1.98

move P_tmpdir from "/var/tmp/" to "/tmp/".

the main effect of this is to make GCC and other libiberty using
tools use /tmp instead of /var/tmp for compiler temp files,
which can be a bottleneck on larger systems.

a survey of other platforms shows only OSX also uses /var/tmp,
everyone else has switched to /tmp long ago.

cons: some smaller systems may have a smaller /tmp than /var/tmp,
and this may cause builds to fail with out of space earlier.
point the build to /var/tmp using TMPDIR in this case.

one can argue that setting TMPDIR would work around this, but we
want to have the effect for all users without having special setup.
 1.97.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.97.8.1 29-Mar-2020  martin Pull up following revision(s) (requested by mrg in ticket #1526):

include/stdio.h: revision 1.98

move P_tmpdir from "/var/tmp/" to "/tmp/".

the main effect of this is to make GCC and other libiberty using
tools use /tmp instead of /var/tmp for compiler temp files,
which can be a bottleneck on larger systems.

a survey of other platforms shows only OSX also uses /var/tmp,
everyone else has switched to /tmp long ago.

cons: some smaller systems may have a smaller /tmp than /var/tmp,
and this may cause builds to fail with out of space earlier.
point the build to /var/tmp using TMPDIR in this case.

one can argue that setting TMPDIR would work around this, but we
want to have the effect for all users without having special setup.
 1.130 02-Mar-2025  riastradh libc: New _r variants of heapsort, mergesort, qsort.

Also kheapsort_r for kernel/standalone use.

These variants allow the caller to pass a cookie through to the
comparison function, e.g. if you want to sort an array of indices
into a buffer.

qsort_r is new in POSIX.1-2024; the others are obvious analogues of
our nonstandard extensions for heapsort and mergesort.

PR lib/58931: qsort_r() missing
 1.129 17-Feb-2025  nia stdlib: Move mkostemp out of the _OPENBSD_SOURCE block.
 1.128 02-Nov-2024  nia libc: Expose mkostemp(3) to POSIX.1-2024 applications.
 1.127 11-Oct-2024  riastradh stdlib.h: Expose reallocarray only for POSIX 2024 or NetBSD/OpenBSD.

reallocarray(3) is new in POSIX 2024, so it should not be exposed if
you ask for an older POSIX standard like _POSIX_C_SOURCE=200809L.

PR standards/58741
 1.126 09-Sep-2024  riastradh stdlib.h: Use same test for def. of lldiv_t as for decl. of lldiv(3).

The !_ANSI_SOURCE conditional was a leftover from before we had
_NETBSD_SOURCE in sys/featuretest.h already defined conditionally on
!_ANSI_SOURCE.

So just nix the !_ANSI_SOURCE part -- and while here, reorder and
reformat the conditional around lldiv_t so it matches the conditional
around lldiv(3) byte-for-byte, just to make it more obvious.

PR standards/56402: Definition of lldiv_t with ANSI_SOURCE and
POSIX_SOURCE
 1.125 28-Oct-2022  wiz branches: 1.125.2; 1.125.4;
put reallocarray() in the public namespace

reallocarray() will be part of the next POSIX release, see
https://austingroupbugs.net/view.php?id=1218

adapt an errno value to match POSIX expectations

As discussed on tech-userlevel
 1.124 05-Oct-2022  nia Remove hacky gcc2-specific alloca definition.
 1.123 03-Jul-2021  christos PR/56250: Michael Forney: mkstemp/mkdtemp not declared with
_POSIX_C_SOURCE=200809L
 1.122 26-May-2020  joerg Avoid depending on namespace pollution in stdlib.h.
 1.121 05-Jan-2019  maya We can make a stronger guarantee than __pure.
abs/labs don't read global memory.

Make GCC 9 happier.
 1.120 15-Aug-2018  martin PR standards/53525: move getsubopt() to stdlib.h
 1.119 07-Oct-2017  christos branches: 1.119.2; 1.119.4;
remove recallocarray
 1.118 07-Oct-2017  christos add recallocarray (used by openssh-7.6)
 1.117 01-Jul-2016  christos add hmac(3)
 1.116 07-Nov-2015  nros Add the C11 function aligned_alloc to libc.
 1.115 17-Feb-2015  joerg Move reallocarray under _OPENBSD_SOURCE where it belongs.
 1.114 17-Feb-2015  joerg Introduce reallocarr(3) for easy (re)allocation of memory with overflow
checks. Compared to OpenBSD's reallocarray, makes it easier to avoid memory
leaks on allocation failures and it doesn't depend on malloc(0) != NULL
for correct error checking. Compared to plain realloc, it also avoids
the problem of intermediate integer overflows. The trade-off is the use
of void * to side step C type system with regard to generic pointer to
pointer.
 1.113 05-Feb-2015  christos add reallocarray
 1.112 18-Jan-2015  christos remove restrict to match with OpenBSD prototype (Kamil Rytarowski)
 1.111 16-Jan-2015  christos Add strtonum protected with _OPENBSD_SOURCE
 1.110 18-Jun-2014  christos add mkostemp{s,} mkstemps from FreeBSD
 1.109 12-Jun-2014  christos rename to 60
 1.108 12-Jun-2014  christos fix srandom and initstate signatures (from enh at google)
 1.107 08-Jan-2014  christos branches: 1.107.2;
add ptsname_r
 1.106 26-Apr-2013  christos add at_quick_exit and quick_exit
 1.105 26-Apr-2013  joerg Provide the long long routines for C++11 code.
 1.104 19-Apr-2013  joerg Add MB_CUR_MAX_L.
 1.103 18-Apr-2013  joerg Add mblen_l, mbstowcs_l, wctomb_l, mbtowc_l and wcstombs_l.
 1.102 18-Apr-2013  joerg Add strtof_l, strtod_l and strtold_l.
 1.101 16-Apr-2013  joerg Add strtol_l and friends. Switch _citrus_bcs_strtol to use plain
strtol_l unless in tools mode. Add note to retire the BCS code on the
next libc major bump.
 1.100 21-Jun-2012  christos branches: 1.100.2;
sprinkle restrict in realpath(3)
 1.99 03-Jun-2012  joerg Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
 1.98 20-Apr-2012  christos PR/46360: YAMAMOTO Takashi: Restore NetBSD-5 compatibility with putenv()
copying the passed string (which is not ToG compliant), instead of using
it directly in the environment arrat as it should. Needs to be pulled up
to NetBSd-6.
 1.97 16-Mar-2011  christos branches: 1.97.4; 1.97.6;
remove commaize_number.
 1.96 15-Mar-2011  pooka put in a proto for commaize_number()
(nb. doing this purely as the minimum work solution to get a working build)
 1.95 04-Feb-2011  christos add arc4random_{buf,uniform}, from OpenBSD.
 1.94 22-Dec-2010  jruoho branches: 1.94.2;
Use __constfunc(3) instead of __attribute__((const)) directly.
 1.93 01-Oct-2010  christos make putenv POSIX compliant.
 1.92 01-Jun-2010  plunky later versions of pcc may define __GNUC__ for compatibility reasons, so
having a system definition for alloca is counter productive as it seems
fairly common to use

#ifdef __GNUC__
#define alloca ..
#endif

in user-headers (eg see usr.sbin/gspa/gspa/gspa_ass.h)

So, defang this definition as we don't otherwise provide alloca on NetBSD
 1.91 25-Feb-2010  joerg Consistently use __printflike and __scanflike.
 1.90 15-Nov-2009  christos branches: 1.90.2;
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.89 20-Jul-2009  joerg Add a fast, platform independent hash function to libc.
The algorithm used is the Jenkins hash. The name (mi_vector_hash)
reflects the nature of the hash function.
Add glue for libc ATF tests and include a test case to make sure that
(mis)alignment and endianess are handled correctly.

Bump libc minor to 169.
 1.88 20-Jan-2009  drochner cleanup after devmajor_t:
-since getdevmajor(3) is now binary compatible again with <=5.0
there is no need to rename, I've just left a __getdevmajor50 symbol
temporarily for those who track -current
-update manpage
 1.87 20-Jan-2009  drochner Change major()/minor() to return 32-bit types again, called
devmajor_t/devminor_t, as proposed on tech-kern.
This avoids 64-bit arithmetics and 64-bit printf formats in parts
of the kernel where it is not really useful, and helps clarity.
 1.86 11-Jan-2009  christos merge christos-time_t
 1.85 21-Jun-2008  gmcgarry branches: 1.85.4; 1.85.6; 1.85.12;
Use __builtin_alloc() with pcc.
 1.84 07-Apr-2008  yamt branches: 1.84.4; 1.84.6;
RANDOM_MAX: don't rely on integer overflow.
 1.83 01-Apr-2008  drochner everyone else assumes that defining "_XOPEN_SOURCE" means XPG4.2,
so remove comparisions against the numerical values "3" or "4"
 1.82 28-Feb-2008  christos add RANDOM_MAX define from anon ymous
 1.81 02-Feb-2008  christos branches: 1.81.2;
Add csetexpandtc()
 1.80 24-Dec-2007  perry change some __attribute__s to __keywords
 1.79 14-Dec-2007  christos humanize_number was the only function in <util.h> that is not in libutil.
Move it to stdlib.h and add dehumanize_number.
 1.78 19-Nov-2007  ad Enable posix_memalign().
 1.77 22-Apr-2007  ragge branches: 1.77.4;
The alloca() arg type check is broken (cpp do not do string comparisions)
so make it marginally less broken so that it works with other compilers
than gcc.
Probably the check can be removed, I doubt anyone will try to use gcc1
anymore.
 1.76 15-Mar-2006  kleink Add strtof(3) and strtold(3); welcome libc 12.137.
 1.75 26-Dec-2005  perry u_intN_t -> uintN_t
 1.74 24-Dec-2005  perry __const__ -> const
This is in an __attribute__ so it isn't really necessary, but it gets
it out of the listing of __keyword__s...
 1.73 26-Sep-2005  kleink Move getenv_r() to the local section.
 1.72 25-Sep-2005  christos Add getenv_r and ttyname_r
 1.71 13-Sep-2005  christos compat code reorg
 1.70 11-Jun-2005  christos Add a macro __MKTEMP_OK__ that renames mktemp() to _mktemp() for uses that
have been checked, so that the linker does not warn us. There are valid
uses for mktemp() such as for creating filenames that are going to be
targets of the rename system call. Discussed with lukem.
 1.69 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.68 16-Dec-2004  atatat Add a function called getdevmajor().

It tells you the major device number for whatever character or block
device you ask it. This is sort of the inverse of devname(3) but not
quite, since it's backed by the kernel (sysctl's kern.drivers
information) and not a database cobbled together from the contents of
the filesystem.
 1.67 27-May-2004  christos Add unix/98 pty function prototypes.
 1.66 23-Apr-2004  christos more const sprinkling on cget* suggested by kleink.
 1.65 23-Apr-2004  christos constify the db name vector argument.
 1.64 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.63 08-Jul-2003  kristerw Do not give names to the parameters in function prototypes (those names
reduces the usefulness of the gcc -Wshadow flag).
 1.62 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.61 14-Apr-2003  kleink Well, _The_ Open Group.
 1.60 14-Apr-2003  kleink Use the real TOG specification name for references.
 1.59 07-Apr-2003  kleink 1003.1-2001 has introduced unsetenv() which differs from the current
implementation in not permitting a "name=value" argument.
* Add a conforming __unsetenv13() and do function renaming for
unsetenv(); preserve old symbol with old behavior.
* Make visible setenv() and unsetenv() for 1003.1-2001 feature selection
macros; resolves PR standards/20479.
 1.58 01-Mar-2003  bjh21 Add _Exit(), for C99 and POSIX-2001.
Proposed on tech-userlevel to a resounding silence in April last year.
 1.57 29-Nov-2002  lukem add strsuftoll(3) and strsuftollx(3) - parse a string for a number
with an optional suffix, product (two numbers separated by `x'), and
provide range checking
 1.56 24-May-2002  itojun add arc4random(3). from openbsd
 1.55 28-Mar-2001  kleink branches: 1.55.2;
Don't declare qdiv() when qdiv_t wasn't defined previously; fixes PR lib/11557
from Richard Earnshaw.
 1.54 21-Mar-2001  kleink Sprinkle some restrict qualifiers.
 1.53 10-Mar-2001  cgd add prototypes for shquote() and shquotev()
 1.52 19-Feb-2001  cgd branches: 1.52.2;
add prototypes for getprogname and setprogname
 1.51 20-Dec-2000  christos deal with bsearch duplicate declaration.
 1.50 15-Nov-2000  briggs Move fmtcheck() prototype to stdio.h. It makes more sense to declare it
with the formatting functions with which it is meant to be used. Thanks
to Klaus Klein for "encouraging" me to make this change.
 1.49 20-Oct-2000  briggs Add {__,}fmtcheck(), a function specified by Bill Sommerfeld to check
a user-supplied format string against a fallback format string to ensure
that they will consume arguments of the same type.

libc minor bump for new API entry point.
 1.48 03-Oct-2000  sommerfeld Allow format-arg checking for setproctitle
 1.47 10-Aug-2000  kleink ISO/IEC 9899:1999: MB_CUR_MAX expands to a positive integer expression with
type size_t (not int).

(Incompatible ABI change, ignored due to a window of just two days.)
 1.46 08-Aug-2000  tshiozak Preparation for the future introduction of multibyte locale.
- MB_LEN_MAX is increased to 32.
- To ensure binary compatibility for old executables
under multibyte locale, versioned setlocale is added.
- __mb_len_cur definision is added in setlocale.c
and enable it in stdlib.h .
It is also important for multibyte locale stuffs,
but I just forgot.
 1.45 06-Mar-2000  kleink branches: 1.45.2; 1.45.4;
Add ISO C99 long long integer general utility interfaces; partially addresses
PR standards/9482.
 1.44 10-Jan-2000  kleink Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
std C headers including it, and a kernel module written in C++ would benfit
as well.
 1.43 22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.42 06-Feb-1999  kleink Add l64a_r(), a reentrant version of l64a(); found in the Multithreading
Extension of SVID4.
 1.41 30-Jul-1998  mycroft __Namespace__ __protection__.
 1.40 28-Jul-1998  mycroft Sprinkle in some __attribute__((noreturn))s.
 1.39 27-Jul-1998  mycroft Actually, FreeBSD calls this mkdtemp(). No point in creating a new name.
 1.38 27-Jul-1998  mycroft Add a mktempdir(), like mkstemp(), but it creates a directory.
 1.37 27-Jul-1998  mycroft Slight rearrangement.
 1.36 27-Jul-1998  mycroft If __AUDIT__ is defined, remove some traditional interfaces: gets, sprintf,
vsprintf, tempnam, mktemp, getwd.
 1.35 27-Jul-1998  mycroft Mark more functions returning internal buffers for const auditing.
 1.34 26-Jul-1998  mycroft const poisoning.
 1.33 01-Jun-1998  kleink * Further name space protection reorganization: distinguish between various
issues of the XPG.
* Move setkey() prototype from <unistd.h> to this file. (XPG4)
* Move mkstemp(), mktemp(), ttyslot() and valloc() prototypes from <unistd.h>
to this file. (XPG4.2)
 1.32 11-May-1998  kleink Reorganize name space protection.
 1.31 04-Feb-1998  kleink Per XPG4.2, change the `n' argument of initstate() to size_t. (Since it was
recently changed from int to long (lite-2 import), I saw no reason to delay
this `alignment'.)
 1.30 02-Feb-1998  perry merge lite-2
 1.29 31-Jan-1998  thorpej Fix the prototypes for srandom() and initstate() after the libc/stdlib lite-2
merge (ints -> longs). The only platform on which this might have caused
a problem is the Alpha, and it happens to be safe because the first 6 arguments
are passed in registers on the Alpha (and are thus implicitly promoted to
longs anyhow).
 1.28 16-Oct-1997  christos devname is (dev_t, mode_t) not (int, int)
 1.27 14-Jul-1997  mikel some minor KNF
 1.26 13-Jul-1997  christos Add missing rand_r prototype
 1.25 27-Dec-1995  jtc Add __dead qualifier to abort() and exit(); PR 1845
 1.24 22-Mar-1995  jtc added prototype for qabs()
 1.23 21-Mar-1995  jtc Moved conditional #include of <sys/types.h> to near the top of file.
Defined qdiv_t typedef.
Declared qdiv function.
 1.22 17-Dec-1994  jtc fix typo
 1.21 16-Dec-1994  jtc add prototype for realpath()
 1.20 26-Oct-1994  cgd new RCS ID format.
 1.19 07-Aug-1994  jtc Add strtoq() & strtouq() declarations
 1.18 02-Jul-1994  deraadt add 3 protos
 1.17 16-Jun-1994  mycroft Update *sort() prototypes.
 1.16 21-May-1994  cgd add _BSD's to ansi types
 1.15 07-May-1994  jtc add new getopt(3) extern variable optreset
 1.14 14-Apr-1994  cgd setproctitle proto
 1.13 25-Jan-1994  cgd kill third arg to getbsize.
 1.12 25-Jan-1994  cgd getbsize takes a (somewhat bogus, IMO) third parameter
 1.11 24-Jan-1994  cgd add protos for getbsize() (in libutil) and the getcap routines (in libc)
 1.10 13-Nov-1993  jtc stdlib.h should define NULL -- Ansi C, Section 7.10.
 1.9 22-Oct-1993  jtc Fix typo in last checkin.
 1.8 22-Oct-1993  jtc Added prototypes for a64l() & l64a().
 1.7 13-Oct-1993  jtc Moved declarations for cfree, setenv, putenv and the rand48 family
into !_ANSI_SOURCE && !_POSIX_SOURCE conditional.
Added extern for getopt's optopt variable.
 1.6 11-Oct-1993  jtc #include <machine/ansi.h>, declare size_t typedef.
Only include <sys/types.h> if !_POSIX_SOURCE.
 1.5 07-Oct-1993  brezak Rand48 routines from martin@ntkupc1.tuwien.ac.at (Martin Birgmeier)
 1.4 01-Aug-1993  mycroft Add RCS identifiers.
 1.3 08-Jun-1993  brezak GCC2 defines alloca() differently.
 1.2 25-Mar-1993  cgd patch from rich murphy (rich@rice.edu) to fix alloca prototype
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.45.4.2 10-Aug-2000  kleink Pull up rev. 1.47 (approved by thorpej):
ISO/IEC 9899:1999: MB_CUR_MAX expands to a positive integer
expression with type size_t.
 1.45.4.1 09-Aug-2000  tshiozak pull up the following changes (approved by thorpej):
> cvs rdiff -r1.9 -r1.10 basesrc/include/locale.h
> cvs rdiff -r1.45 -r1.46 basesrc/include/stdlib.h
> cvs rdiff -r1.16 -r1.17 basesrc/lib/libc/locale/Makefile.inc
> cvs rdiff -r1.17 -r1.18 basesrc/lib/libc/locale/setlocale.c
> cvs rdiff -r0 -r1.2 basesrc/lib/libc/locale/setlocale_sb.c
> cvs rdiff -r1.6 -r1.7 syssrc/sys/arch/alpha/include/limits.h
> cvs rdiff -r1.1 -r1.2 syssrc/sys/arch/arm26/include/limits.h
> cvs rdiff -r1.7 -r1.8 syssrc/sys/arch/arm32/include/limits.h
> cvs rdiff -r1.14 -r1.15 syssrc/sys/arch/i386/include/limits.h
> cvs rdiff -r1.12 -r1.13 syssrc/sys/arch/m68k/include/limits.h
> cvs rdiff -r1.13 -r1.14 syssrc/sys/arch/mips/include/limits.h
> cvs rdiff -r1.10 -r1.11 syssrc/sys/arch/pc532/include/limits.h
> cvs rdiff -r1.6 -r1.7 syssrc/sys/arch/powerpc/include/limits.h
> cvs rdiff -r1.2 -r1.3 syssrc/sys/arch/sh3/include/limits.h
> cvs rdiff -r1.11 -r1.12 syssrc/sys/arch/sparc/include/limits.h
> cvs rdiff -r1.7 -r1.8 syssrc/sys/arch/sparc64/include/limits.h
> cvs rdiff -r1.9 -r1.10 syssrc/sys/arch/vax/include/limits.h
>
> Outline:
>
> Preparation for the future introduction of multibyte locale.
> - MB_LEN_MAX is increased to 32.
> - To ensure binary compatibility for old executables
> under multibyte locale, versioned setlocale is added.
> - __mb_len_cur definision is added in setlocale.c
> and enable it in stdlib.h .
> It is also important for multibyte locale stuffs,
> but I just forgot.
 1.45.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.52.2.3 10-Dec-2002  thorpej Sync with HEAD.
 1.52.2.2 21-Jun-2002  nathanw Catch up to -current.
 1.52.2.1 08-Apr-2001  nathanw Merge trunk onto branch.
 1.55.2.1 26-Mar-2004  jmc Pullup rev 1.56 (requested by provos in ticket #1386)

Introduce bcrypt password scheme. Adds the arc4random API for creating
cryptographically strong random numbers.
 1.77.4.2 23-Mar-2008  matt sync with HEAD
 1.77.4.1 09-Jan-2008  matt sync with HEAD
 1.81.2.1 24-Mar-2008  keiichi sync with head.
 1.84.6.1 27-Jun-2008  simonb Sync with head.
 1.84.4.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.85.12.1 20-May-2011  bouyer Pull up following revision(s) (requested by joerg in ticket #1611):
include/inttypes.h: revision 1.7
include/stddef.h: revision 1.16
include/wchar.h: revision 1.28
include/stdlib.h: revision 1.90
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.85.6.2 08-Nov-2008  christos changes for 64 bit time_t
 1.85.6.1 21-Jun-2008  christos file stdlib.h was added on branch christos-time_t on 2008-11-08 21:13:13 +0000
 1.85.4.1 20-May-2011  bouyer Pull up following revision(s) (requested by joerg in ticket #1611):
include/inttypes.h: revision 1.7
include/stddef.h: revision 1.16
include/wchar.h: revision 1.28
include/stdlib.h: revision 1.90
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.90.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.90.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.90.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.94.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.97.6.2 23-Jun-2012  riz Pull up following revision(s) (requested by joerg in ticket #328):
lib/libc/gen/devname.c: revision 1.22
distrib/sparc64/instfs/dot.profile: revision 1.7
distrib/i386/cdroms/install.sh: revision 1.3
tests/lib/libcurses/director/director.c: revision 1.10
lib/libc/include/reentrant.h: revision 1.15
distrib/amd64/cdroms/install.sh: revision 1.3
tests/include/t_paths.c: revision 1.12
share/man/man7/hier.7: revision 1.101
etc/rc.d/sysdb: revision 1.24
include/stdlib.h: revision 1.99
tests/lib/libcurses/Makefile: revision 1.3
distrib/sparc64/cdroms/installcd/install.sh: revision 1.3
distrib/i386/cdroms/Makefile.cdrom: revision 1.27
lib/libc/gen/ttyname.c: revision 1.25
usr.bin/tic/Makefile: revision 1.2
tools/compat/Makefile: revision 1.57
lib/libterminfo/compile.c: revision 1.7
lib/libc/gen/ttyname.c: revision 1.26
lib/libterminfo/compile.c: revision 1.8
tools/compat/Makefile: revision 1.59
tools/compat/cdbw.h: revision 1.1
distrib/i386/installimage/install.sh: revision 1.2
lib/libc/include/namespace.h: revision 1.154
usr.bin/tic/tic.c: revision 1.13
usr.bin/tic/tic.c: revision 1.14
usr.bin/tic/tic.c: revision 1.15
distrib/sets/lists/base/mi: revision 1.996
usr.bin/tic/tic.c: revision 1.16
usr.sbin/dev_mkdb/dev_mkdb.8: revision 1.13
usr.bin/tic/tic.c: revision 1.17
usr.bin/tic/tic.c: revision 1.18
tools/compat/cdbr.h: revision 1.1
distrib/sparc64/instfs/list: revision 1.25
usr.bin/tic/tic.c: revision 1.19
lib/libc/cdb/cdbw.c: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.4
lib/libc/cdb/cdbw.3: revision 1.5
share/terminfo/Makefile: revision 1.3
usr.sbin/dev_mkdb/dev_mkdb.c: revision 1.29
usr.sbin/dev_mkdb/Makefile: revision 1.8
lib/libc/gen/ttyname.3: revision 1.23
lib/libc/gen/ttyname.3: revision 1.24
lib/libc/cdb/cdbr.c: revision 1.3
include/cdbw.h: revision 1.2
distrib/sparc64/cdroms/installcd/Makefile: revision 1.15
lib/libc/gen/devname.3: revision 1.12
tools/compat/compat_defs.h: revision 1.85
tools/compat/compat_defs.h: revision 1.86
lib/libterminfo/term_private.h: revision 1.10
lib/libterminfo/term.c: revision 1.14
usr.bin/tic/tic.1: revision 1.10
lib/libterminfo/term.c: revision 1.15
lib/libterminfo/Makefile.hash: revision 1.5
lib/libterminfo/term.c: revision 1.16
distrib/amd64/installimage/install.sh: revision 1.2
share/man/man5/rc.conf.5: revision 1.152
distrib/sets/lists/tests/mi: revision 1.472
distrib/amd64/cdroms/Makefile.cdrom: revision 1.7
include/paths.h: revision 1.41
bin/ps/ps.1: revision 1.101
lib/libterminfo/terminfo.5.in: revision 1.16
usr.bin/tic/tic.c: revision 1.20
lib/libterminfo/terminfo.5.in: revision 1.17
Prefer __printflike.
Use queue(3)
Replace linear lookup with hash table, reducing runtime by 60%.
Use e* from util.h.
One more strdup -> estrdup.
Maintain nalias and nterm on the fly.
Add void for ttyslot prototype.
Use memcmp in place of strncmp, since length is known to no longer than
either of the arguments.
Fix a number of memory leaks. Keep final loop of the cleanup in tic(1)
under #ifdef __VALGRIND__ though.
Add __predict_true / __predict_false definitions.
Add a special seeder for cdbw_output that gives stable results.
Hook up cdbw(3) for the tool build.
Prototype for cdbw_stable_seeder.
Provide a usable thr_once for !_REENTRANT
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
Switch terminfo(3) to cdb(5).
Fix typos.
Make Alan Barrett happy and add ().
Add cdbr(3) support to tools/compat.
Bump date for previous.
Relax consistency to make it possible to match valid entries.
Prefix devname's buffer with /dev/ as ttyname is supposed to return the
full path. Reported by Dave Huang.
 1.97.6.1 07-May-2012  riz Pull up following revision(s) (requested by christos in ticket #222):
include/stdlib.h: revision 1.98
lib/libc/compat/stdlib/Makefile.inc: revision 1.3
lib/libc/compat/include/stdlib.h: revision 1.5
lib/libc/compat/stdlib/compat_putenv.c: revision 1.1
lib/libc/compat/stdlib/compat_putenv.c: revision 1.2
PR/46360: YAMAMOTO Takashi: Restore NetBSD-5 compatibility with putenv()
copying the passed string (which is not ToG compliant), instead of using
it directly in the environment arrat as it should. Needs to be pulled up
to NetBSd-6.
use setenv so that we don't leak memory.
 1.97.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.97.4.2 30-Oct-2012  yamt sync with head
 1.97.4.1 23-May-2012  yamt sync with head.
 1.100.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.100.2.1 23-Jun-2013  tls resync from head
 1.107.2.1 10-Aug-2014  tls Rebase.
 1.119.4.1 10-Jun-2019  christos Sync with HEAD
 1.119.2.2 18-Jan-2019  pgoyette Synch with HEAD
 1.119.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.125.4.1 02-Aug-2025  perseant Sync with HEAD
 1.125.2.2 13-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #954):

include/stdlib.h: revision 1.127

stdlib.h: Expose reallocarray only for POSIX 2024 or NetBSD/OpenBSD.

reallocarray(3) is new in POSIX 2024, so it should not be exposed if
you ask for an older POSIX standard like _POSIX_C_SOURCE=200809L.

PR standards/58741
 1.125.2.1 11-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #951):

include/stdlib.h: revision 1.126

stdlib.h: Use same test for def. of lldiv_t as for decl. of lldiv(3).

The !_ANSI_SOURCE conditional was a leftover from before we had
_NETBSD_SOURCE in sys/featuretest.h already defined conditionally on
!_ANSI_SOURCE.

So just nix the !_ANSI_SOURCE part -- and while here, reorder and
reformat the conditional around lldiv_t so it matches the conditional
around lldiv(3) byte-for-byte, just to make it more obvious.

PR standards/56402: Definition of lldiv_t with ANSI_SOURCE and
POSIX_SOURCE
 1.2 08-Sep-2024  rillig include: C11 has been released
 1.1 02-Oct-2016  kamil branches: 1.1.2; 1.1.28;
Import <stdnoreturn.h>

This header conforms to the C11 standard
Reference: ISO/IEC 9899:201x 7.23 _Noreturn <stdnoreturn.h>

According to ISO/IEC 9899:201x (draft) <stdnoreturn.> defines the
noreturn macro which expands to _Noreturn.

The _Noreturn keyword appears in a function declaration and specifies
that the function does not return by reaching the end of the function
body.

Design choices:
- don't implicitly break C++ code including this header with #error
C++11 offers [[noreturn]] which conflicts with C11 _Noreturn

- don't check for __STDC_VERSION__, everybody is free to reuse it with
a nonstandard compiler not conforming to C11 but supporting _Noreturn

gcc(1) and clang(1) support _Noreturn in -std=c99 and older standards

this follows <stdbool.h> choice for not checking for C99

- follow <stdbool.h> and declare the __noreturn_is_defined guard

- use a standard header guard (_STDNORETURN_H_), similar to <stdbool.h>

Reviewed by <pgoyette> and <joerg>
 1.1.28.1 02-Aug-2025  perseant Sync with HEAD
 1.1.2.2 04-Nov-2016  pgoyette Sync with HEAD
 1.1.2.1 02-Oct-2016  pgoyette file stdnoreturn.h was added on branch pgoyette-localcount on 2016-11-04 14:48:51 +0000
 1.58 09-Dec-2024  nros memccpy, strdup and strndup are in C23

7.26.2.2 memccpy
7.26.2.6 strdup
7.26.2.7 strndup
 1.57 02-Nov-2024  riastradh memset_explicit(3): Add C23 alias for explicit_memset.

PR standards/58607: C23: <string.h> memset_explicit
 1.56 01-Nov-2024  riastradh string.h: Fix various symbol visibility issues.

1. Order declarations according to POSIX 2024 to make this easier to
review side-by-side with the spec.
2. Fix visibility of memccpy: XSI-only, not POSIX in general; require
_XOPEN_SOURCE, not just _POSIX_C_SOURCE.
3. Omit redundant _XOPEN_SOURCE test around stpcpy/stpncpy.
4. Hide strdup in POSIX 2001. Not POSIX (without XSI) until 2008.
5. Hide strerror_r until POSIX 2001. Can't find evidence of it in
any earlier POSIX or X/Open. (Not 100% sure on this one, maybe
someone can double-check my research.)
6. Add restrict to strlcat/strlcpy.
7. Omit redundant _XOPEN_SOURCE test around strndup and strnlen.
8. Hide strtok_r until POSIX 2001. Can't find evidence of it in
any earlier POSIX or X/Open. (Not 100% sure on this one, maybe
someone can double-check my research.)

Carry the restrict qualifiers on strlcat/strlcpy to libkern too.

Main reference:
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/string.h.html

PR standards/58804: string.h: wrong visibility for memccpy
 1.55 01-Nov-2024  nia libc: Expose some newly-standard C functions in POSIX.1-2024 mode
 1.54 01-Aug-2023  christos branches: 1.54.2;
Add companion mempcpy to wmempcpy, bump.
 1.53 09-Aug-2021  andvar fix various typos in compatibility, mainly in comments.
 1.52 20-Feb-2018  kamil Mark in string.h: memccpy(3) and strdup(3) as _POSIX_C_SOURCE >= 2001
 1.51 12-Oct-2016  christos branches: 1.51.6;
add strchrnull
 1.50 10-Mar-2016  leot branches: 1.50.2;
strndup() is part of XSI from The Open Group Base Specification Issue 7 and had
a similar history of stpcpy(), stpncpy() and strnlen().
Make it visible under XOPEN_SOURCE>=700 too (not just _NETBSD_SOURCE).

ok dholland@
 1.49 24-Sep-2014  christos add strnstr from FreeBSD
 1.48 28-Aug-2013  riastradh Publish explicit_memset and consttime_memequal in userland libc.

Remove the double-underscore from the userland versions, and do the
weak alias dance instead, now that these are public parts of libc.

As discussed on tech-userlevel:

https://mail-index.netbsd.org/tech-userlevel/2013/06/24/msg007843.html
(option 3)
 1.47 28-Aug-2013  riastradh Make explicit_memset match memset's return value.
 1.46 27-Aug-2013  joerg Remove outdated comment.
 1.45 19-Aug-2013  joerg Add strerror_l.
 1.44 24-Jun-2013  riastradh Replace consttime_bcmp/explicit_bzero by consttime_memequal/explicit_memset.

consttime_memequal is the same as the old consttime_bcmp.
explicit_memset is to memset as explicit_bzero was to bcmp.

Passes amd64 release and i386/ALL, but I'm sure I missed some spots,
so please let me know.
 1.43 21-Apr-2013  joerg __BEGIN_DECLS/__END_DECLS
 1.42 19-Apr-2013  joerg Add dummy strcoll_l and strxfrm_l.
 1.41 30-Aug-2012  drochner branches: 1.41.2;
Add "consttime_bcmp" and "explicit_bzero" functions for both kernel
abd userland, as proposed on tech-security, with explicit_bzero using
a volatile function pointer as suggested by Alan Barrett.
Both do what the name says. For userland, both are prefixed by "__"
to keep them out of the user namespace.
Change some memset/memcmp uses to the new functions where it makes
sense -- these are just some examples, more to come.
 1.40 20-Apr-2012  joerg Do not wrap other header files with extern "C".
 1.39 22-Jul-2009  kleink branches: 1.39.8;
Declare strsignal(3) in <string.h>, per POSIX-2008, and adjust
documentation accordingly.

Fixes PR standards/41325 from Perry E. Metzger.
 1.38 01-May-2009  perry note that we have strsignal but it is in the wrong include file.
 1.37 01-May-2009  perry Add prototypes for stpcpy, stpncpy, strnlen, added in the latest POSIX.

Implementations in libc to follow.

For POSIX compliance, we are still missing:

strcoll_l
strerror_l
strsignal
strxfrm_l
 1.36 10-Apr-2009  christos add memrchr
 1.35 19-Oct-2007  christos branches: 1.35.18;
kill _NETBSD_TOOLS.
 1.34 18-Oct-2007  christos Introduce _NETBSD_TOOLS for symbols the are needed in tools build
 1.33 02-Aug-2007  kristerw branches: 1.33.2; 1.33.4;
Do not include SSP files unless _FORTIFY_SOURCE > 0.
 1.32 30-May-2007  tls Match usage of FORTIFY_SOURCE on other platforms by not requiring special
include path: the normal header files now include the "SSP" ones (which one
should note are not really named right: SSP and FORTIFY_SOURCE are independent
features).

Disable USE_SSP on targets where the compiler doesn't support it at all
(mips, alpha) or it's known broken (sh3). But enable FORTIFY_SOURCE,
without SSP, on those platforms -- tested on mipsel.
 1.31 12-Aug-2006  christos branches: 1.31.2; 1.31.4;
Add stresep and strndup.
 1.30 28-Jul-2005  christos branches: 1.30.2;
Add strerror_r.
 1.29 13-Mar-2005  perry Add prototype for memmem(3). It is API compatible with the version in Linux.
 1.28 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.27 12-Jul-2004  kleink Move the strcasestr() prototype to the local extensions section.
Also __P() it; this should be consistent within a single header.
 1.26 03-Jul-2004  junyoung Add strcasestr(3), case insensitive version of strstr(3).
Bump libc minor.

From FreeBSD.
 1.25 07-Aug-2003  agc branches: 1.25.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.24 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.23 22-Mar-2001  kleink Sprinkle some restrict qualifiers.
 1.22 10-Jan-2000  kleink branches: 1.22.6;
Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
std C headers including it, and a kernel module written in C++ would benfit
as well.
 1.21 22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.20 09-Sep-1999  kleink strlcat() and strlcpy() aren't ISO/IEC 9899:1990.
 1.19 08-Sep-1999  lukem prototypes for strlcat() and strlcpy()
 1.18 27-Jul-1998  mycroft branches: 1.18.2;
Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.17 26-Jul-1998  mycroft KNF nit.
 1.16 26-Jul-1998  mycroft const poisoning.
 1.15 06-May-1998  kleink Make strtok_r() available to _XOPEN_SOURCE >= 500, and fix the protection of
memccpy() and strdup().
 1.14 27-Apr-1998  tv Move the #include <strings.h> line inside a !defined(_XOPEN_SOURCE) block
(not just !POSIX and !ANSI)
 1.13 03-Feb-1998  perry restore include of sys/featuretest.h
 1.12 02-Feb-1998  perry remove sys/featuretest.h -- why did kleink add it?
 1.11 02-Feb-1998  perry merge lite-2
 1.10 02-Feb-1998  kleink Per XPG4.2, move the prototypes of bcmp(), bcopy(), bzero(), ffs(), index(),
rindex(), strcasecmp() and strncasecmp() to <strings.h>. For now, include
<strings.h> to get these prototypes; this should go away eventually.
Also, protect the prototypes of strtok_r() and strsep().
 1.9 12-Jan-1998  kleink Per XPG4, move the prototype of swab() from <string.h> to <unistd.h>.
 1.8 16-Oct-1997  christos move setmode and strsignal to unistd.h
 1.7 13-Jul-1997  christos Add missing strtok_r prototype
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 02-Aug-1994  jtc branches: 1.5.2;
Added prototype for new function strsignal()
 1.4 21-May-1994  cgd add _BSD's to ansi types
 1.3 11-Oct-1993  jtc Changed preprocessor conditional so non-standard functions would not be
declared in a _POSIX_SOURCE environment.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.5.2.2 02-Aug-1994  jtc Added prototype for new function strsignal()
 1.5.2.1 02-Aug-1994  jtc file string.h was added on branch netbsd-1-0 on 1994-08-02 05:03:47 +0000
 1.18.2.1 05-Jul-2000  he Pull up revisions 1.19-1.20 (requested by he):
Add declarations for strlcat() and strlcpy().
 1.22.6.1 08-Apr-2001  nathanw Merge trunk onto branch.
 1.25.2.2 14-Jul-2004  tron Pull up revision 1.27 (requested by kleink in ticket #643):
Move the strcasestr() prototype to the local extensions section.
Also __P() it; this should be consistent within a single header.
 1.25.2.1 12-Jul-2004  he Pull up revision 1.26 (requested by junyoung in ticket #638):
Add strcasestr(3), case insensitive version of strstr(3).
 1.30.2.1 27-Aug-2006  riz Pull up following revision(s) (requested by tron in ticket #63):
regress/lib/libc/string/Makefile: revision 1.9
lib/libc/string/strsep.3: revision 1.17
lib/libc/string/strsep.3: revision 1.18
regress/lib/libc/string/stresep/Makefile: revision 1.1
distrib/sets/lists/base/shl.mi: revision 1.364
regress/lib/libc/string/stresep/stresep_test.c: revision 1.1
lib/libc/gen/fstab.c: revision 1.28
lib/libc/shlib_version: revision 1.181
lib/libc/string/strndup.c: revision 1.1
lib/libc/string/strdup.3: revision 1.13
lib/libc/string/strdup.3: revision 1.14
lib/libc/string/Makefile.inc: revision 1.61
include/string.h: revision 1.31
distrib/sets/lists/comp/mi: revision 1.909
lib/libc/string/stresep.c: revision 1.1
lib/libc/include/namespace.h: revision 1.118
- Add strndup and stresep
- Use stresep so in fstab so that we can mount paths with white space in th=
em.
Add stresep and strndup.
add regression test for stresep.
libc 146
man pages for stresep and strndup.
Mark up NULL.
stresep, not strnsep. Remove duplicate "the". Bump date for previous.
 1.31.4.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.31.2.2 24-Aug-2007  liamjfoy Pull up following revision(s) (requested by kristerw in ticket #833):
include/unistd.h: revision 1.112
lib/libc/ssp/snprintf_chk.c: revision 1.4
lib/libc/ssp/sprintf_chk.c: revision 1.4
lib/libc/ssp/vsprintf_chk.c: revision 1.4
lib/libc/ssp/gets_chk.c: revision 1.4
include/stdio.h: revision 1.70
lib/libc/ssp/vsnprintf_chk.c: revision 1.4
lib/libc/ssp/fgets_chk.c: revision 1.4
include/strings.h: revision 1.12
include/string.h: revision 1.33
Do not include SSP files unless _FORTIFY_SOURCE > 0.
Update includes so that this builds for USE_FORT=no too.
 1.31.2.1 22-Jul-2007  liamjfoy Pull up to netbsd-4 (requested by christos in ticket #773):

Move libssp to libc.
 1.33.4.2 02-Aug-2007  kristerw Do not include SSP files unless _FORTIFY_SOURCE > 0.
 1.33.4.1 02-Aug-2007  kristerw file string.h was added on branch matt-mips64 on 2007-08-02 21:49:11 +0000
 1.33.2.1 06-Nov-2007  matt sync with HEAD
 1.35.18.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.39.8.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.39.8.2 30-Oct-2012  yamt sync with head
 1.39.8.1 23-May-2012  yamt sync with head.
 1.41.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.41.2.1 23-Jun-2013  tls resync from head
 1.50.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.51.6.1 25-Feb-2018  snj Pull up following revision(s) (requested by kamil in ticket #561):
include/string.h: 1.52
Mark in string.h: memccpy(3) and strdup(3) as _POSIX_C_SOURCE >= 2001
 1.54.2.1 02-Aug-2025  perseant Sync with HEAD
 1.7 28-Apr-2008  martin branches: 1.7.10;
Remove clause 3 and 4 from TNF licenses
 1.6 27-Jul-2006  christos branches: 1.6.18;
add sl_delete
 1.5 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.4 04-Oct-2002  christos Assign to TNF.
 1.3 28-Nov-1999  lukem branches: 1.3.6;
change sl_add() from returning a void to returning an int
 1.2 17-Jan-1997  lukem branches: 1.2.8;
A stringlist implementation (previously ``private'' to libc netgroup code,
but christos ok-ed making public as it's useful)
 1.1 06-Nov-1996  lukem branches: 1.1.2;
file stringlist.h was initially added on branch nsswitch.
 1.1.2.1 06-Nov-1996  lukem initial nsswitch implementation
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.6.1 18-Oct-2002  nathanw Catch up to -current.
 1.6.18.1 18-May-2008  yamt sync with head.
 1.7.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7.10.1 28-Apr-2008  martin file stringlist.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.21 01-Nov-2024  riastradh strings.h: Fix visibility of bcmp/bcopy/bzero/index/rindex again.

These have always been X/Open / XSI options, and they were nixed in
POSIX 2008, not in POSIX 2024.

POSIX 2001 (marked legacy): https://pubs.opengroup.org/onlinepubs/009695399/basedefs/strings.h.html
POSIX 2008 (removed): https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/strings.h.html
POSIX 2024: https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/strcasecmp_l.html

Cleanup after fix for:

PR lib/58802: missing ffsl(), ffsll() functions from POSIX 2024
 1.20 01-Nov-2024  riastradh ffs(3): Fix visibility in strings.h and add MLINKS for ffsl/ffsll.

ffs(3) was added in POSIX 2001 with XSI option (_XOPEN_SOURCE>=600),
not in POSIX 2008 with XSI option (_XOPEN_SOURCE>=700).

Noticed while updating the STANDARDS section of the man page.

PR lib/58802: missing ffsl(), ffsll() functions from POSIX 2024
 1.19 01-Nov-2024  riastradh strings.h: Spruce up for POSIX 2024.

1. Add ffsl, ffsll.
2. Hide bcmp, bcopy, bzero, index, rindex for POSIX>=2024.
3. Expose ffs only for NetBSD or POSIX>=2008 with XSI option.
4. Hide popcount* NetBSD extensions for any POSIX.
5. Sprinkle __constfunc on ffs*.

Add tests for ffs/ffsl/ffsll in tests/include/sys/t_bitops next to
ffs32/ffs64 for convenience.

XXX Still missing strcasecmp_l, strncasecmp_l, and locale_t.

PR lib/58802: missing ffsl(), ffsll() functions from POSIX 2024
 1.18 22-Aug-2011  dholland branches: 1.18.54;
Don't pollute the namespace with stdint.h. (This file is included from
string.h so it can't blithely do whatever it feels like.) PR 45258.
 1.17 19-Aug-2009  yamt include <stdint.h> instead of <sys/types.h>.
the latter pulls FD_SET etc and it makes wine-1.1.27's winsock vs unixsocket
namespace dance unhappy. for more information, grep
Include_winsock_h_before_stdlib_h_or_use_the_MSVCRT_library
in their source.
 1.16 21-Jul-2009  joerg Some parts of gcc fail with the direct include of sys/inttypes.h, so
fall back to using sys/types.h like stdlib.h does.
 1.15 21-Jul-2009  joerg Move popcount et al to src/common and add popcount32/popcount64.
Requested by rmind@. MD should now override popcount32/popcount64 and
provide the aliases as fitting.
 1.14 21-Jul-2009  joerg Add popcount(3) and the long and long long version. Name is inspired by
gnulib, the implementation goes back to the AMD Software Optimizer
guide. A number of platforms will want to replace the C version with
assembler code using native instructions.
 1.13 28-Apr-2008  martin branches: 1.13.10;
Remove clause 3 and 4 from TNF licenses
 1.12 02-Aug-2007  kristerw branches: 1.12.8; 1.12.10;
Do not include SSP files unless _FORTIFY_SOURCE > 0.
 1.11 30-May-2007  tls Match usage of FORTIFY_SOURCE on other platforms by not requiring special
include path: the normal header files now include the "SSP" ones (which one
should note are not really named right: SSP and FORTIFY_SOURCE are independent
features).

Disable USE_SSP on targets where the compiler doesn't support it at all
(mips, alpha) or it's known broken (sh3). But enable FORTIFY_SOURCE,
without SSP, on those platforms -- tested on mipsel.
 1.10 03-Feb-2005  perry branches: 1.10.10; 1.10.12;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.9 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.8 10-Jan-2000  kleink Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
std C headers including it, and a kernel module written in C++ would benfit
as well.
 1.7 22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.6 06-May-1998  kleink Don't make NULL available to _XOPEN_SOURCE.
 1.5 27-Apr-1998  kleink If _XOPEN_SOURCE isn't defined, provide <string.h> definitions for
compatibility.
 1.4 02-Feb-1998  kleink Rework this header to be XPG4.2-compliant: provide the symbols and prototypes
defined in the spec, and don't include the whole <string.h> header.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.10.12.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.10.10.2 24-Aug-2007  liamjfoy Pull up following revision(s) (requested by kristerw in ticket #833):
include/unistd.h: revision 1.112
lib/libc/ssp/snprintf_chk.c: revision 1.4
lib/libc/ssp/sprintf_chk.c: revision 1.4
lib/libc/ssp/vsprintf_chk.c: revision 1.4
lib/libc/ssp/gets_chk.c: revision 1.4
include/stdio.h: revision 1.70
lib/libc/ssp/vsnprintf_chk.c: revision 1.4
lib/libc/ssp/fgets_chk.c: revision 1.4
include/strings.h: revision 1.12
include/string.h: revision 1.33
Do not include SSP files unless _FORTIFY_SOURCE > 0.
Update includes so that this builds for USE_FORT=no too.
 1.10.10.1 22-Jul-2007  liamjfoy Pull up to netbsd-4 (requested by christos in ticket #773):

Move libssp to libc.
 1.12.10.2 02-Aug-2007  kristerw Do not include SSP files unless _FORTIFY_SOURCE > 0.
 1.12.10.1 02-Aug-2007  kristerw file strings.h was added on branch matt-mips64 on 2007-08-02 21:49:11 +0000
 1.12.8.1 18-May-2008  yamt sync with head.
 1.13.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.13.10.1 28-Apr-2008  martin file strings.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.18.54.1 02-Aug-2025  perseant Sync with HEAD
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.4 02-Feb-1998  perry merge lite-2
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7 30-Sep-2005  rpaulo Add a comment asking to update sysexits(3) when adding more entries.
 1.6 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.5 02-Feb-1998  perry merge lite-2
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 19-Apr-1993  mycroft Add reinclusion protection.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.4 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.3 02-Feb-1998  perry Switch to using lite-2's tar.h instead of ours. The contents are
identical, but lite-2's has comments explaining them, which makes it
superior to jt's tar.h. no functional difference.
 1.2 30-Jul-1997  jtc Fix files using old TNF copyright notice
 1.1 05-Feb-1996  jtc branches: 1.1.1;
Add cpio.h, tar.h, and re_comp.h headers for POSIX & XPG4 conformance
 1.1.1.1 02-Feb-1998  perry import lite-2
 1.2 04-Apr-2017  sevan Add RCS tag.
 1.1 28-Sep-2008  matt branches: 1.1.6; 1.1.46; 1.1.50;
Add the C99 header <tgmath.h> (Type-generic math.h)
Until IEEE libm support *l (long double) we can't install it.
 1.1.50.1 21-Apr-2017  bouyer Sync with HEAD
 1.1.46.1 26-Apr-2017  pgoyette Sync with HEAD
 1.1.6.2 28-Sep-2008  matt Add the C99 header <tgmath.h> (Type-generic math.h)
Until IEEE libm support *l (long double) we can't install it.
 1.1.6.1 28-Sep-2008  matt file tgmath.h was added on branch christos-time_t on 2008-09-28 14:57:42 +0000
 1.6 14-Dec-2004  nathanw Nuke threadlib.h. Library defensive threading is now provided through the
normal pthread.h interface.
Move stubs for libc back into a libc-internal header.
 1.5 19-Jul-2003  nathanw Add setcancelstate stub.
 1.4 19-Jan-2003  thorpej Add some threadlib stubs that are used by X:
* thr_create() (stub in libc aborts)
* thr_exit() (stub in libc calls exit())
* thr_yield() (stub in libc does nothing)

Also make the libc thr_self() stub not abort.

XXX Should we add thrattr_*() stubs for setting the detach-state?
 1.3 19-Jan-2003  thorpej * Wrap decls in __BEGIN_DECLS/__END_DECLS.
* Add a thr_enabled() which returns the value of libc's __isthreaded
variable, indicating whether or not threads are actually enabled.
 1.2 19-Jan-2003  thorpej Add mutexattr_init(), mutexattr_destroy(), and mutexattr_settype() (recursive
mutexes are used by the X libraries).
 1.1 19-Jan-2003  thorpej Expose libc's thread stubs, which get magically turned into real pthread
calls when the pthread library is linked in. Simplifies making other
libraries (such as X's) thread-safe.
 1.56 21-Apr-2025  nia libc: C23: add timespec_getres(3) function

timespec_getres is to timespec_get as clock_getres is to clock_gettime.

PR standards/58608
PR lib/59140
 1.55 21-Apr-2025  nia libc: C23: Add TIME_MONOTONIC as a base for timespec_get

PR standards/58608
 1.54 21-Apr-2025  nia libc: Expose timegm to standard C23 applications.
 1.53 16-Sep-2024  kre The prototype for localtime_r needs to be inside the
#ifndef __LIBC12_SOURCE__ block, as it has a time_t
parameter, and the compat code needs to be able to
make that 32 bits instead of 64.
 1.52 16-Sep-2024  christos move gmtime_r in the right ifdefs block, it was not removed in 202405.
 1.51 16-Sep-2024  christos asctime_r and ctime_r are no more for POSIX202405
 1.50 08-Sep-2024  rillig include: C11 has been released
 1.49 19-Aug-2023  rillig branches: 1.49.2;
time.h: fix typo in comment
 1.48 23-Oct-2022  jschauma correct tm_sec range to be [0-60]

The previous range introduced in time.h rev1.14 was supposed to account
for a mystical "double leap second", which ultimately never could exist
and was a mistaken interpretation from an early ISO C standard whereby
the possibility of two leap seconds within a year was erroneously
interpreted to mean that two leap seconds could occur at once.
 1.47 04-Oct-2016  kamil Add timespec_get(3) in <time.h> and enable unconditionally struct timespec

These changes conforms to the C11 standard
References:
- 7.27.1/3 Components of time (struct timespec)
- 7.27.2.5 The timespec_get function

According to ISO/IEC 9899:201x (draft) <time.h> defines the timespec
structure and declares the timespec_get(3) function with TIME_UTC
definition.

According to a C++17 standard draft <ctime> offers the same interface in
the std:: namespace.

The timespec_get function modifies the timespec object pointed by ts
to hold the current calendar time in the given base. The standard notes
only the TIME_UTC base with implementation defined value, set it to 1
as zero is reserved for error handling. Once operation was successful this
function returns passed base, otherwise exits with zero.

The timespec struct was already part of the POSIX standard in <time.h>.

Enable this interface unconditionally in the header to allow to use it
in a code prior C11 and C++17 as an extension.

Review notes from <christos>
 1.46 23-Apr-2016  christos branches: 1.46.2;
add clock_cpugetclockid{2,}
 1.45 29-Oct-2015  christos add tzgetgmtoff
 1.44 07-Oct-2014  christos sync function signatures with tzcode
 1.43 21-Apr-2013  joerg strftime_l is part of POSIX2008.
 1.42 21-Apr-2013  joerg Store time-specific locale data directly in the locale.
Ad dstrftime_l, strftime_lz and strptime_l.
 1.41 02-Oct-2012  christos add clock_nanosleep
 1.40 16-Dec-2010  christos branches: 1.40.6; 1.40.12;
Provide a re-entrant and thread-safe set of timezone API's that
don't require locking and can operate on user-specified timezones
as opposed to having to alter the environment to change a timezone.
This work was presented to the tzcode folks and it was generally
accepted, but there seems to be a lot of inertia.
 1.39 14-May-2009  ginsbach Add the getdate(3) function and getdate_err value, conforming to IEEE
Std 1003.1 (``POSIX.1'') and the Open Group Base Specifications X/Open
System Interfaces extension (``XSI'').
 1.38 11-Jan-2009  christos merge christos-time_t
 1.37 21-Sep-2008  christos branches: 1.37.6;
add missing attributes to the remaining calls, even the ones that gcc has
builtin attributes for (for symmetry and consistency). In the future this
might change to use compiler-neutral macros. On the other hand I don't
know of any other compiler that provides other macros with similar
functionality, so why bother?
 1.36 01-Apr-2008  drochner everyone else assumes that defining "_XOPEN_SOURCE" means XPG4.2,
so remove comparisions against the numerical values "3" or "4"
 1.35 13-Sep-2005  christos compat code reorg
 1.34 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.33 21-Dec-2003  kleink Do a little const cleanup, for consistency with std interfaces.
 1.32 13-Sep-2003  kleink Sprinkle restrict into timer_{create,settime}(2).
 1.31 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.30 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.29 30-Jun-2002  bjh21 Version times() so that programs compiled before the recent change to make
sysconf(_SC_CLK_TCK) return hz will work.

In detail:
__times13() returns values scaled by hz.
times() returns values scaled by 100.
<sys/times.h> renames times() to __times13().

_SC_CLK_TCK has changed from 3 to 39.
sysconf(3) returns 100.
sysconf(39) returns hz.
CLK_TCK is defined as sysconf(39).
 1.28 23-Jun-2002  perry In the manner of Solaris and other OSes, we now define CLK_TCK to
expand to a call to __sysconf(_SC_CLK_TCK), rather than hard coding it
as a constant.
 1.27 31-Mar-2001  kleink Finally deprecate the old timezone() interface in favor of an XSH5
timezone/daytime pair; as proposed by J.T. in September, 1996.
Fixes PR standards/11807 by Nick Hudson.
 1.26 29-Mar-2001  kleink Sprinkle some restrict.
 1.25 06-Jul-2000  hubertf branches: 1.25.2;
Fix typo in comment: CUT -> UTC
 1.24 10-Jan-2000  kleink branches: 1.24.4;
Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
std C headers including it, and a kernel module written in C++ would benfit
as well.
 1.23 22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.22 15-Sep-1998  kleink Remove the public declaration of gtime(), which is shipped with tzcode but is
not compiled into our libc since it is intended for use with Mach only.
 1.21 10-Sep-1998  kleink Declare asctime_r(), ctime_r(), gmtime_r() and localtime_r(), and rearrange
name space protection a bit.
 1.20 27-Jul-1998  mycroft Slight rearrangement.
 1.19 27-Jul-1998  mycroft Need cdefs.h.
 1.18 27-Jul-1998  mycroft Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.17 26-Jul-1998  mycroft const poisoning.
 1.16 26-Jul-1998  mycroft const poisoning.
 1.15 02-Feb-1998  perry merge lite-2
 1.14 02-Nov-1997  kleink * Move prototypes of clock_getres(), clock_gettime() and clock_settime() from
<sys/time.h> to this file.
* Update range comment wrt. the tm_sec member of struct tm to [0-61] (double
leap seconds are supported).
 1.13 04-Oct-1997  kleink branches: 1.13.2;
Per 1003.1b-93, move nanosleep() prototype from <sys/time.h> to <time.h>
and add appropriate namespace protection. Also protect timer_*() prototypes.
 1.12 13-Jul-1997  christos Add typedefs for clockid_t and timer_t
 1.11 13-Jul-1997  christos - Added prototypes for non POSIX that are marked STD inspired:
offtime, timelocal, timegm, timeoff, gtime, time2posix, posix2time.
- Added prototypes for the currently stubbed out timer functions:
timer_{create,delete,getoverrun,gettime,settime}
 1.10 26-May-1997  kleink Add strptime(3) prototype.
 1.9 26-Oct-1994  cgd new RCS ID format.
 1.8 21-May-1994  cgd add _BSD's to ansi types
 1.7 16-May-1994  cgd update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those. Kill varargs.h, because it can simply
be a link to the machine-dependent version.
 1.6 20-Jan-1994  jtc Declare tzname[] extern, so compiler won't include it in object files.
 1.5 11-Oct-1993  jtc declare char *tzname[2];
 1.4 18-Aug-1993  jtc As per Chris Torek's suggestion, define CLOCKS_PER_SEC and CLK_TCK to 100.
When we get sysconf, we can define them in terms of the kernel's notion of
interrupts per second if we so choose. Until then, the constant value
seems to satisfy the requirements presented by ISO C and POSIX, even if it
may lie about the true number of clocks per second.
 1.3 17-Aug-1993  jtc Define CLOCKS_PER_SEC.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.13.2.1 28-Sep-1998  cgd pull up rev 1.22 (remove gtime declaration) from trunk (kleink).
 1.24.4.1 18-Jul-2000  hubertf Pull up rev. 1.25 into 1.5 branch, OK'd by thorpej:

Fix typo in comment: CUT -> UTC
 1.25.2.2 01-Aug-2002  nathanw Catch up to -current.
 1.25.2.1 08-Apr-2001  nathanw Merge trunk onto branch.
 1.37.6.4 10-Nov-2008  christos version tzset{,wall}
 1.37.6.3 08-Nov-2008  christos delete redundant declaration of time()
 1.37.6.2 08-Nov-2008  christos changes for 64 bit time_t
 1.37.6.1 21-Sep-2008  christos file time.h was added on branch christos-time_t on 2008-11-08 21:13:13 +0000
 1.40.12.2 23-Jun-2013  tls resync from head
 1.40.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.40.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.40.6.1 30-Oct-2012  yamt sync with head
 1.46.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.49.2.1 02-Aug-2025  perseant Sync with HEAD
 1.15 27-Apr-2013  joerg Systematically include sys/featuretest.h when _NETBSD_SOURCE is used.
Some are redundant, but make verification with grep much easier.
 1.14 17-Apr-2006  salo branches: 1.14.48; 1.14.54;
Add setttyentpath(), functionally equivalent to setttyent() but takes an
additional argument to read the ttys information from an alternate path
istead of _PATH_TTYS.

Required for upcoming init(8) changes.

Mostly from <apb>.

Bump libc minor.
 1.13 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.12 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.11 15-Jan-1999  tsarna Add a "class" entry to ttyent. Closes PR#4638.
 1.10 27-Jul-1998  mycroft Slight rearrangement.
 1.9 27-Jul-1998  mycroft Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.8 26-Jul-1998  mycroft const poisoning.
 1.7 02-Feb-1998  perry merge lite-2
 1.6 20-Oct-1997  scottr Add flags for DTR/CTS flow control with CDTRCTS, a driver-specific
flow control flag. Contributed by Bill Studenmund.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 18-Mar-1994  cgd update to match flags
 1.3 12-Mar-1994  cgd add some new flags for /etc/ttys' status field
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.14.54.1 23-Jun-2013  tls resync from head
 1.14.48.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14 31-Jan-2025  christos update rfc#
 1.13 17-Feb-2024  christos branches: 1.13.2;
Sync with tzcode2024a:
Release 2024a - 2024-02-01 09:28:56 -0800

Changes to code

The FROM and TO columns of Rule lines can no longer be "minimum"
or an abbreviation of "minimum", because TZif files do not support
DST rules that extend into the indefinite past - although these
rules were supported when TZif files had only 32-bit data, this
stopped working when 64-bit TZif files were introduced in 1995.
This should not be a problem for realistic data, since DST was
first used in the 20th century. As a transition aid, FROM columns
like "minimum" are now diagnosed and then treated as if they were
the year 1900; this should suffice for TZif files on old systems
with only 32-bit time_t, and it is more compatible with bugs in
2023c-and-earlier localtime.c. (Problem reported by Yoshito
Umaoka.)

localtime and related functions no longer mishandle some
timestamps that occur about 400 years after a switch to a time
zone with a DST schedule. In 2023d data this problem was visible
for some timestamps in November 2422, November 2822, etc. in
America/Ciudad_Juarez. (Problem reported by Gilmore Davidson.)

strftime %s now uses tm_gmtoff if available. (Problem and draft
patch reported by Dag-Erling Smørgrav.)

Changes to build procedure

The leap-seconds.list file is now copied from the IERS instead of
from its downstream counterpart at NIST, as the IERS version is
now in the public domain too and tends to be more up-to-date.
(Thanks to Martin Burnicki for liaisoning with the IERS.)

Changes to documentation

The strftime man page documents which struct tm members affect
which conversion specs, and that tzset is called. (Problems
reported by Robert Elz and Steve Summit.)
 1.12 16-Sep-2023  christos sync with tzcode 2023c
 1.11 16-Aug-2022  christos whitespace changes from tzcode2022a->tzcode2022b
 1.10 03-Jul-2019  christos Sync with 2019b (field name change)
 1.9 04-Apr-2019  christos merge tzcode 2019a
 1.8 11-Jul-2015  christos branches: 1.8.16;
updatre with latest from tzcode.
 1.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.6 30-Jul-1998  kleink Merge in recent changes from the private version of this header distributed
with tzcode.
 1.5 02-Feb-1998  perry merge lite-2
 1.4 25-Jul-1997  mikel add parens in isleap() for gcc -Wall
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.8.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.8.16.1 10-Jun-2019  christos Sync with HEAD
 1.13.2.1 02-Aug-2025  perseant Sync with HEAD
 1.6 13-Oct-2024  riastradh branches: 1.6.2; 1.6.6;
uchar.h: Simplify __cpp_char8_t and __cplusplus conditionals.

No functional change intended.

PR lib/52374: <uchar.h> missing
 1.5 13-Oct-2024  riastradh uchar.h: Need <sys/cdefs.h> for __restrict.

PR lib/52374: <uchar.h> missing
 1.4 13-Oct-2024  riastradh uchar.h: Include <sys/featuretest.h> before testing _*_SOURCE.

PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h

PR lib/52374: <uchar.h> missing
 1.3 17-Aug-2024  riastradh libc: Add _l variants of the cNrtomb and mbrtocN functions.

These accept an explicit locale parameter, rather than using the
current locale.

Visible under _NETBSD_SOURCE, not exposed otherwise.

NOTE: This adds libc symbols. Riding the libc minor bump for the
non-_l variants of these from two days ago -- hope that's not pushing
it too far.

PR lib/58613: c*rtomb, mbrtoc* should have locale-parametric _l
variants
 1.2 15-Aug-2024  riastradh libc: New functions c8rtomb(3) and mbrtoc8(3).

New in C23, for converting from UTF-8 to locale-dependent multibyte
sequences (c8rtomb) or vice versa (mbrtoc8), along with the new type
char8_t.

Conditional on either:
- _NETBSD_SOURCE
- _ISOC23_SOURCE
- __STDC_VERSION__ >= 202311L

(Riding the libc minor bump from this morning for the UTF-16/UTF-32
versions from C11.)

PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb
 1.1 15-Aug-2024  riastradh uchar.h: New header file for C11 (and C++11) compliance.

Implementation of the new functions mbrtoc16, c16rtomb, mbrtoc32, and
c32rtomb to come later. Updates for C23 to come later.

PR lib/52374: <uchar.h> missing
 1.6.6.2 02-Aug-2025  perseant Sync with HEAD
 1.6.6.1 13-Oct-2024  perseant file uchar.h was added on branch perseant-exfatfs on 2025-08-02 05:54:28 +0000
 1.6.2.2 14-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #976):

lib/libc/locale/c32rtomb.3: revision 1.10
lib/libc/locale/c32rtomb.3: revision 1.9
lib/libc/locale/c32rtomb.3: revision 1.11
tests/lib/libc/locale/t_mbrtoc32.c: revision 1.1
distrib/sets/lists/base/shl.mi: revision 1.988
lib/libc/include/namespace.h: revision 1.204
lib/libc/include/namespace.h: revision 1.205
lib/libc/locale/mbrtoc16.3: revision 1.1
lib/libc/locale/mbrtoc16.c: revision 1.1
lib/libc/locale/mbrtoc16.3: revision 1.2
lib/libc/locale/mbrtoc16.c: revision 1.2
lib/libc/locale/mbrtoc16.3: revision 1.3
lib/libc/locale/mbrtoc16.c: revision 1.3
lib/libc/locale/mbrtoc32.3: revision 1.1
lib/libc/locale/mbrtoc32.c: revision 1.1
tests/lib/libc/locale/t_c16rtomb.c: revision 1.1
lib/libc/locale/mbrtoc32.c: revision 1.2
lib/libc/locale/mbrtoc16.3: revision 1.4
lib/libc/locale/mbrtoc16.c: revision 1.4
lib/libc/locale/mbrtoc32.3: revision 1.2
tests/lib/libc/locale/t_c16rtomb.c: revision 1.2
lib/libc/locale/mbrtoc32.c: revision 1.3
lib/libc/locale/mbrtoc16.3: revision 1.5
lib/libc/locale/mbrtoc16.c: revision 1.5
lib/libc/locale/mbrtoc32.3: revision 1.3
tests/lib/libc/locale/t_c16rtomb.c: revision 1.3
lib/libc/locale/mbrtoc32.c: revision 1.4
lib/libc/locale/mbrtoc16.3: revision 1.6
lib/libc/locale/mbrtoc16.c: revision 1.6
lib/libc/locale/mbrtoc32.3: revision 1.4
tests/lib/libc/locale/t_c16rtomb.c: revision 1.4
lib/libc/locale/mbrtoc32.c: revision 1.5
lib/libc/locale/mbrtoc16.3: revision 1.7
lib/libc/locale/mbrtoc16.c: revision 1.7
lib/libc/locale/mbrtoc32.3: revision 1.5
tests/lib/libc/locale/t_c16rtomb.c: revision 1.5
lib/libc/locale/mbrtoc32.c: revision 1.6
lib/libc/locale/mbrtoc16.3: revision 1.8
lib/libc/locale/mbrtoc32.3: revision 1.6
tests/lib/libc/locale/t_c16rtomb.c: revision 1.6
lib/libc/locale/mbrtoc32.c: revision 1.7
lib/libc/locale/mbrtoc16.3: revision 1.9
lib/libc/locale/mbrtoc32.3: revision 1.7
lib/libc/locale/mbrtoc32.c: revision 1.8
lib/libc/locale/mbrtoc32.3: revision 1.8
lib/libc/locale/mbrtoc32.c: revision 1.9
distrib/sets/lists/comp/mi: revision 1.2468
lib/libc/locale/mbrtoc32.3: revision 1.9
distrib/sets/lists/comp/mi: revision 1.2469
lib/libc/locale/c32rtomb.h: revision 1.1
lib/libc/locale/c32rtomb.h: revision 1.2
include/Makefile: revision 1.147
share/man/man3/uchar.3: revision 1.1
share/man/man3/uchar.3: revision 1.2
tests/lib/libc/locale/t_c32rtomb.c: revision 1.1
distrib/sets/lists/comp/mi: revision 1.2470
lib/libc/locale/c16rtomb.3: revision 1.1
lib/libc/locale/c16rtomb.c: revision 1.1
lib/libc/locale/c16rtomb.3: revision 1.2
lib/libc/locale/c16rtomb.c: revision 1.2
lib/libc/locale/c16rtomb.3: revision 1.3
lib/libc/locale/c16rtomb.c: revision 1.3
lib/libc/locale/c16rtomb.3: revision 1.4
lib/libc/locale/c16rtomb.c: revision 1.4
lib/libc/locale/c16rtomb.3: revision 1.5
lib/libc/locale/c16rtomb.c: revision 1.5
lib/libc/locale/c16rtomb.3: revision 1.6
lib/libc/locale/c16rtomb.c: revision 1.6
lib/libc/locale/c16rtomb.3: revision 1.7
lib/libc/locale/c16rtomb.c: revision 1.7
lib/libc/locale/c16rtomb.3: revision 1.8
lib/libc/locale/c16rtomb.3: revision 1.9
distrib/sets/lists/tests/mi: revision 1.1330
distrib/sets/lists/tests/mi: revision 1.1331
distrib/sets/lists/tests/mi: revision 1.1332
tests/lib/libc/locale/t_uchar.c: revision 1.1
tests/lib/libc/locale/t_uchar.c: revision 1.2
tests/lib/libc/locale/t_uchar.c: revision 1.3
tests/lib/libc/locale/t_mbrtoc16.c: revision 1.1
tests/lib/libc/locale/t_mbrtoc16.c: revision 1.2
tests/lib/libc/locale/t_mbrtoc16.c: revision 1.3
include/uchar.h: revision 1.1
include/uchar.h: revision 1.2
include/uchar.h: revision 1.3
include/uchar.h: revision 1.4
include/uchar.h: revision 1.5
tests/lib/libc/locale/t_c8rtomb.c: revision 1.1
include/uchar.h: revision 1.6
tests/lib/libc/locale/t_c8rtomb.c: revision 1.2
tests/lib/libc/locale/t_c8rtomb.c: revision 1.3
tests/lib/libc/locale/t_c8rtomb.c: revision 1.4
share/man/man3/Makefile: revision 1.93
tests/lib/libc/locale/t_c8rtomb.c: revision 1.5
tests/lib/libc/locale/t_c8rtomb.c: revision 1.6
tests/lib/libc/locale/t_c8rtomb.c: revision 1.7
lib/libc/shlib_version: revision 1.297
lib/libc/locale/c16rtomb.3: revision 1.10
lib/libc/locale/c16rtomb.3: revision 1.11
tests/lib/libc/locale/t_mbrtoc8.c: revision 1.1
tests/lib/libc/locale/t_mbrtoc8.c: revision 1.2
tests/lib/libc/locale/t_mbrtoc8.c: revision 1.3
lib/libc/locale/mbrtoc16.3: revision 1.10
tests/lib/libc/locale/Makefile: revision 1.15
tests/lib/libc/locale/Makefile: revision 1.16
tests/lib/libc/locale/Makefile: revision 1.17
tests/lib/libc/locale/Makefile: revision 1.18
distrib/sets/lists/debug/mi: revision 1.442
distrib/sets/lists/debug/mi: revision 1.443
distrib/sets/lists/debug/mi: revision 1.444
lib/libc/locale/c8rtomb.3: revision 1.1
lib/libc/locale/c8rtomb.c: revision 1.1
lib/libc/locale/c8rtomb.3: revision 1.2
lib/libc/locale/c8rtomb.c: revision 1.2
lib/libc/locale/c8rtomb.3: revision 1.3
lib/libc/locale/c8rtomb.c: revision 1.3
lib/libc/locale/c8rtomb.3: revision 1.4
lib/libc/locale/c8rtomb.c: revision 1.4
lib/libc/locale/c8rtomb.3: revision 1.5
lib/libc/locale/c8rtomb.c: revision 1.5
lib/libc/locale/c8rtomb.3: revision 1.6
lib/libc/locale/c8rtomb.c: revision 1.6
lib/libc/locale/c8rtomb.3: revision 1.7
lib/libc/locale/c8rtomb.3: revision 1.8
lib/libc/locale/c8rtomb.3: revision 1.9
lib/libc/locale/mbrtoc32.h: revision 1.1
lib/libc/locale/mbrtoc32.h: revision 1.2
lib/libc/locale/mbrtoc8.c: revision 1.1
lib/libc/locale/mbrtoc8.3: revision 1.1
lib/libc/locale/mbrtoc8.c: revision 1.2
lib/libc/locale/mbrtoc8.3: revision 1.2
lib/libc/locale/mbrtoc8.c: revision 1.3
lib/libc/locale/mbrtoc8.3: revision 1.3
lib/libc/locale/mbrtoc8.c: revision 1.4
lib/libc/locale/mbrtoc8.3: revision 1.4
lib/libc/locale/Makefile.inc: revision 1.66
lib/libc/locale/mbrtoc8.c: revision 1.5
lib/libc/locale/mbrtoc8.3: revision 1.5
lib/libc/locale/Makefile.inc: revision 1.67
lib/libc/locale/mbrtoc8.c: revision 1.6
lib/libc/locale/mbrtoc8.3: revision 1.6
lib/libc/locale/mbrtoc8.c: revision 1.7
lib/libc/locale/mbrtoc8.3: revision 1.7
lib/libc/locale/mbrtoc8.c: revision 1.8
lib/libc/locale/c32rtomb.3: revision 1.1
lib/libc/locale/c32rtomb.c: revision 1.1
lib/libc/locale/c32rtomb.3: revision 1.2
lib/libc/locale/c32rtomb.c: revision 1.2
lib/libc/locale/c32rtomb.3: revision 1.3
lib/libc/locale/c32rtomb.c: revision 1.3
lib/libc/locale/c32rtomb.3: revision 1.4
lib/libc/locale/c32rtomb.c: revision 1.4
lib/libc/locale/c32rtomb.3: revision 1.5
lib/libc/locale/c32rtomb.c: revision 1.5
lib/libc/locale/c32rtomb.3: revision 1.6
lib/libc/locale/c32rtomb.c: revision 1.6
lib/libc/locale/c32rtomb.3: revision 1.7
lib/libc/locale/c32rtomb.3: revision 1.8

(all via patch)


tests/lib/libc/locale/Makefile: Sort.
No functional change intended.
Preparation for PR lib/52374.

uchar.h: New header file for C11 (and C++11) compliance.

Implementation of the new functions mbrtoc16, c16rtomb, mbrtoc32, and
c32rtomb to come later. Updates for C23 to come later.
PR lib/52374: <uchar.h> missing

libc: New C11 functions mbrtoc16, mbrtoc32, c16rtomb, c32rtomb.

The mbrtoc16/32 functions read mulitbyte strings according to the
current locale into UTF-16/32 code unit sequences; the c16/32rtomb
functions write UTF-16/32 code unit sequences into multibyte strings
according to the current locale. The `r' means restartable: they
work incrementally and pick up where they left off.

NOTE: This bumps the libc minor version, since it adds new symbols.

PR lib/52374: <uchar.h> missing
mbrtoc16(3), mbrtoc32(3): Fix \n in man page examples.
Need to write \en to pacify roff.
PR lib/52374: <uchar.h> missing

c16rtomb(3), c32rtomb(3): Fix more \n in man pages.
Also, tighten an assertion: we left room for a NUL byte at the end.
PR lib/52374: <uchar.h> missing

libc: Use the more idiomatic alignof from stdalign.h.
No functional change intended.
PR lib/52374: <uchar.h> missing

mbrtoc16(3): Simplify surrogate state test.

Turn the finer-grained test into an assertion.
No semantic change intended: we are supposed to control this state,
and we always arrange it this way. (But in principle this could
change the behaviour of buggy programs that violate the mbstate_t
abstraction.)
PR lib/52374: <uchar.h> missing

libc: New functions c8rtomb(3) and mbrtoc8(3).

New in C23, for converting from UTF-8 to locale-dependent multibyte
sequences (c8rtomb) or vice versa (mbrtoc8), along with the new type
char8_t.

Conditional on either:
- _NETBSD_SOURCE
- _ISOC23_SOURCE
- __STDC_VERSION__ >= 202311L
(Riding the libc minor bump from this morning for the UTF-16/UTF-32
versions from C11.)

PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb
libc: c32rtomb and mbrtoc32 are used internally, so weak-alias them.
PR lib/52374: <uchar.h> missing
c8rtomb(3), mbrtoc8(3): Use namespace.h to get private aliases.

This way applications defining the symbols c32rtomb or mbrtoc32 won't
clobber our private definitions, which are slightly more constrained
about their use of mbstate_t than is obvious from the interface
contract.

PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb
mbrtoc16(3), mbrtoc32(3): brush up markup

Split long .Fn lines into Fo/Fa/Fc. Dont indent the list of return
values. Don't use artisanal -width.

Untabify code examples - indented literal displays don't have correct
tab stops consistent with tab stops in the fixed font code, so the
lines end up misaligned in the PostScript output.

c16rtomb(3), c32rtomb(3): brush up markup

mbrtoc16(3), mbrtoc32(3): Simplify return value language.
Also expand BMP only once.
PR lib/52374: <uchar.h> missing

mbrtoc16(3), mbrtoc32(3): No state overlap with mbrtoc8 or c8rtomb.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc32(3): Clarify control flow.
No need for another goto here; let's keep it clearly structured with
a single `out' label.
No functional change intended.
PR lib/52374: <uchar.h> missing

c8rtomb(3), mbrtoc8(3): brush up markup

mbrtoc8(3): Simplify return value language.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

c16rtomb(3), c32rtomb(3): Specify what happens if ps is null.
PR lib/52374: <uchar.h> missing

c8rtomb(3): Specify what happens when ps is null.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

c16rtomb(3), c32rtomb(3): No state overlap with mbrtoc8 or c8rtomb.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc16(3), mbrtoc32(3): Work on deturgidifying prose.
Still maybe not great but at least there's less jargon in most of the
text, without really losing any content.
PR lib/52374: <uchar.h> missing

mbrtoc8(3): Work on deturgidifying prose.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc16(3), mbrtoc32(3): Restore word accidentally removed.
PR lib/52374: <uchar.h> missing

mbrtoc8(3): Restore word accidentally removed.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

c8rtomb(3): Fix possible error descriptions.
The argument c8 can't be a surrogate code point itself (they're in
the range [0xd800,0xdfff], beyond 8-bit values), but the bits of a
surrogate code point could be forced into the UTF-8 format, which is
also invalid.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

c16rtomb(3), c32rtomb(3): Attempt a deturgidification pass.
Limit the jargon around surrogates.
PR lib/52374: <uchar.h> missing

c8rtomb(3): Clarify prose and fix example in caveat.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb
c16rtomb(3), c32rtomb(3), mbrtoc16(3), mbrtoc32(3): xref c8 versions.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc16(3): Clarify how many bytes are consumed in special cases.
Fix overlap in RETURN VALUES section.
PR lib/52374: <uchar.h> missing

mbrtoc8(3): Clarify how many bytes are consumed in special cases.
Fix overlap in RETURN VALUES section.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

pass lint, XXX see lint bug.

libc: Add _l variants of the cNrtomb and mbrtocN functions.
These accept an explicit locale parameter, rather than using the
current locale.
Visible under _NETBSD_SOURCE, not exposed otherwise.
NOTE: This adds libc symbols. Riding the libc minor bump for the
non-_l variants of these from two days ago -- hope that's not pushing
it too far.
PR lib/58613: c*rtomb, mbrtoc* should have locale-parametric _l
variants

c8rtomb(3), c16rtomb(3): Add tests for incomplete NUL termination.
PR lib/58615: incomplete c8rtomb, c16rtomb handles NUL termination
wrong

c8rtomb(3), c16rtomb(3): Fix NUL handling.
PR lib/58615: incomplete c8rtomb, c16rtomb handles NUL termination
wrong

c8rtomb(3), c16rtomb(3), c32rtomb(3): Test stateful shift sequences.
PR lib/58612: c8rtomb/c16rtomb/c32rtomb yield suboptimal shift
sequences

c8rtomb(3): Fix digit error in shift sequence test.
PR lib/58612: c8rtomb/c16rtomb/c32rtomb yield suboptimal shift
sequences

c8rtomb(3): Nix __CTASSERT after case label.
I put this in to make it (machine-verifiably) clear that zeroing the
state is the same as returning to the initial conversion state, as
the standard requires, but this is causing build trouble (and will
likely cause more trouble if pulled up) because some definitions of
__CTASSERT make a declaration which is forbidden after a label, so
let's remove it.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc8(3): Fix pasto in comment at top.
No functional change intended.
PR standards/58601: uchar.h C23 compliance: char8_t, mbrtoc8, c8rtomb

mbrtoc8: remove lint-specific workarounds
No binary change.

mbrtoc8: fix comments

mbrtoc16, mbrtoc32: fix comments, remove lint-specific workarounds
No binary change.
t_c8rtomb, t_c16rtomb: Simplify comment.
ESC $ B is technically rather the JIS X 0208-1983 shift sequence, but
since I don't see any way to provoke the JIS X 0208-1978 shift
sequence to come flying out of this conversion (ESC $ @), and I'm not
sure there's any difference in the interpretation, let's just say JIS
X 0208.
PR lib/58612: c8rtomb/c16rtomb/c32rtomb yield suboptimal shift
sequences

c32rtomb(3): Use conversion state to handle shift sequences.
For conversion of Unicode scalar values to coding systems requiring
shift sequences, such as ISO-2022-JP, _citrus_iconv_convert will
always produce:
1. a shift sequence from the initial state to some nondefault state,
like from US-ASCII to JIS X 0208
2. the encoding of the desired characater
3. a shift sequence restoring the initial state
This is unnecessary if the output is already in the state needed to
encoded the desired character. For example, this method produces
seven bytes to encode each YEN SIGN in ISO-2022-JP -- and fourteen,
to encode two consecutive ones -- even though the shift sequence is
only three bytes long and once shifted YEN SIGN takes only one byte.
Instead, convert the Unicode scalar value to a locale-dependent wide
character and encode that, by composing
- _citrus_iconv_convert
=> gives us a multibyte encoding of the character from the initial
state (and restoring the initial state afterward)
- mbrtowc with initial conversion state
=> gives us the single wide character representation
XXX If combining characters are possible here, this may fail.
- wcrtomb with caller's conversion tsate
=> gives us a state-dependent multibyte encoding of the character
XXX Is there a cheaper way to convert from Unicode scalar value to
locale-dependent wide character? It is not obvious to me from the
largely undocumented Citrus machinery, but it would obviously be
better than this somewhat circuitous Rube Goldberg contraption of
chained multibyte APIs.
PR lib/58612: c8rtomb/c16rtomb/c32rtomb yield suboptimal shift
sequences

mbrtoc8(3), mbrtoc16(3): Test consuming shift sequences with state.
This has the side effect of testing mbrtoc32(3) because they are both
defined in terms of it.
PR lib/58618: mbrtocN(3) fails to keep shift state

c8rtomb(3), c16rtomb(3), c32rtomb(3): Suggest MB_LEN_MAX in example.
This way it avoids variable-length arrays, by always allocating the
maximum space that could be occupied by MB_CUR_MAX.

mbrtoc32(3): Use conversion state to handle shift sequences.
PR lib/58618: mbrtocN(3) fails to keep shift state

mbrtoc32(3): Fix name and type of mbrtowc_l return value.
This was from `int mbtowc_l(...)' in an earlier draft and I didn't
update it to size_t when I changed the draft to mbrtowc_l. Caught by
lint.
`mb_len' avoids (harmless) clash with standard C function mblen(3).
PR lib/58618: mbrtocN(3) fails to keep shift state

c32rtomb(3): Fix type of wcrtomb_l return value.
This was from `int wctomb_l(...)' in an earlier draft and I didn't
update it to size_t when I changed the draft to wcrtomb_l. Caught by
lint.
`wc_len' mirrors `mb_len' in the complementary code in mbrtoc32(3) to
avoid clash with standard C function mblen(3).
PR lib/58612: c8rtomb/c16rtomb/c32rtomb yield suboptimal shift
sequences

c8rtomb(3), c16rtomb(3), c32rtomb(3): Attempt to simplify language.

c8rtomb(3), c16rtomb(3), c32rtomb(3): Fix null string output case.
This ignores c8/c16/c32, produces no output anywhere, and just resets
ps to the initial conversion state.
Also just use 0 in the example, not '\0' or L'\0'. This works for
C11, which prefers '\0' and L'\0', for and C23, which introduced the
new u8'\0', u'\0' (UTF-16), and U'\0' (UTF-32).
c16rtomb, c32rtomb, mbrtoc8: fix page numbers in comments
mbrtoc8(3), mbrtoc16(3), mbrtoc32(3): Say 0 for zero code unit.
Rather than deal with differences between C11 and C23 in notation,
'\0' vs L'\0' vs u8'\0' vs u'\0' vs U'\0'.
uchar.h: Include <sys/featuretest.h> before testing _*_SOURCE.
PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
PR lib/52374: <uchar.h> missing

uchar.h: Need <sys/cdefs.h> for __restrict.
PR lib/52374: <uchar.h> missing

uchar.h: Simplify __cpp_char8_t and __cplusplus conditionals.
No functional change intended.
PR lib/52374: <uchar.h> missing

tests/lib/libc/locale/t_uchar: Test for char8_t, mbrtoc8, c8rtomb.
PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
PR lib/52374: <uchar.h> missing

tests/t_uchar: fix copy-and-paste typo
 1.6.2.1 13-Oct-2024  martin file uchar.h was added on branch netbsd-10 on 2024-10-14 17:20:21 +0000
 1.12 13-Mar-2025  rillig ucontext.h: suppress lint warning about missing prototype
 1.11 04-Feb-2018  mrg branches: 1.11.16;
fixes for GCC 6:

- -Wstrict-prototypes is not available for C++, so don't try to
ignore it for C++.
- remove many _DIAGASSERT() checks against not NULL for functions
with arguments with nonnull attributes. in two cases, leave
code behind that should set defaults to "(null)".
- use -Wno-error=frame-address for i386 mcount, as it seems valid
to assume the caller will have a frame.fair
 1.10 15-Jan-2017  christos elide strict-prototypes for unrepresentable function
 1.9 19-Nov-2015  reinoud branches: 1.9.2; 1.9.4;
Revert
 1.8 19-Nov-2015  reinoud Fix ANSI-C prototype error
 1.7 05-Nov-2011  joerg Add __returns_twice for the attribute of the same name. This makes the
attribute explicit based on the functions GCC gives it too.
 1.6 19-Mar-2009  uebayasi branches: 1.6.8;
Revert previous since it was just wrong.
 1.5 19-Mar-2009  uebayasi void f(void (*g)()); -> void f(void (*g)(void));
 1.4 28-Apr-2008  martin branches: 1.4.10; 1.4.12;
Remove clause 3 and 4 from TNF licenses
 1.3 21-Jan-2003  kleink branches: 1.3.30;
Sprinkle some restrict.
 1.2 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.1 05-Mar-2001  nathanw branches: 1.1.2;
file ucontext.h was initially added on branch nathanw_sa.
 1.1.2.2 20-Jul-2001  nathanw The _*context_u functions are now in the pthread library.
 1.1.2.1 05-Mar-2001  nathanw User-level support for LWPs and scheduler activations.
SVR4-style ucontext code by Klaus Klein.
 1.3.30.1 18-May-2008  yamt sync with head.
 1.4.12.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.4.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4.10.1 28-Apr-2008  martin file ucontext.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.6.8.1 10-Nov-2011  yamt sync with head
 1.9.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.9.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.11.16.1 02-Aug-2025  perseant Sync with HEAD
 1.3 28-Apr-2008  martin branches: 1.3.10;
Remove clause 3 and 4 from TNF licenses
 1.2 03-Feb-2005  perry branches: 1.2.24;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.1 13-Sep-1999  kleink Add an XSH5 ulimit()/<ulimit.h> implementation.
 1.2.24.1 18-May-2008  yamt sync with head.
 1.3.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.10.1 28-Apr-2008  martin file ulimit.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.169 01-Nov-2024  nia libc: Expose pipe2 and dup3 to POSIX.2024 applications
 1.168 20-Sep-2024  kre The gethostname() function is (from when it was added to POSIX)
a base function, not an XSI optional extension, so it should be
made visible whenever _POSIX_C_SOURCE is >= 200112 (Posix Issue 6),
and not only for _XOPEN_SOURCE >= 600 (which would be for an XSI
function added then).

Move the prototype for gethostname() to the right section of the file.

Note this makes the visibility of gethostname() wider, it will remain
visible everywhere it was visible before - the only conceivable issue
would be if someone was abusing the name in a context where they
shouldn't be. (Some non NetBSD application, as all of NetBSD is
compiled with _NetBSD_SOURCE defined, everything tends to be visible,
so no change at all for the NetBSD source tree).

Issue pointed out by Thomas Klausner (wiz@)
 1.167 15-Aug-2024  riastradh getentropy(3): Make this visible to POSIX.1-2024 applications.

Likewise GETENTROPY_MAX.

It is now part of POSIX:

https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/getentropy.html

Cite standard in man page too. While here, use `.Nm' rather than
`.Fn getentropy' for self-reference in the man page, for consistency
with other usage.

PR standards/58603: getentropy(3): update visibility and documentation
for POSIX.1-2024
 1.166 20-May-2024  christos branches: 1.166.2;
Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.165 19-May-2024  christos version dup3
 1.164 19-Jan-2024  christos Add missing decls
 1.163 31-May-2022  riastradh branches: 1.163.2;
libc: Reintroduce getentropy.

This was introduced two years ago when the getrandom/getentropy API
question was still open, and removed because the discussion was
ongoing. Now getentropy is more widely adopted and soon to be in
POSIX. So reintroduce the symbol into libc since we'll be keeping it
anyway. Discussion of details of the semantics, as interpreted by
NetBSD, is ongoing, but the symbol needs to get in before the
netbsd-10 branch. The draft POSIX text is
(https://www.opengroup.org/austin/docs/austin_1110.pdf):

SYNOPSIS
#include <unistd.h>

int getentropy(void *buffer, size_t length);

DESCRIPTION
The getentropy() function shall write length bytes of data
starting at the location pointed to by buffer. The output
shall be unpredictable high quality random data, generated by
a cryptographically secure pseudo-random number
generator. The maximum permitted value for the length
argument is given by the {GETENTROPY_MAX} symbolic constant
defined in <limits.h>.

RETURN VALUES
Upon successful completion, getentropy() shall return 0;
otherwise, -1 shall be retunred and errno set to indicate the
error.

ERRORS
The getentropy() function shall fail if:

[EINVAL] The value of length is greater than
{GETENTROPY_MAX}.

The getentropy() function may fail if:

[ENOSYS] The system does not provide the necessary
source of entropy.

RATIONALE
The getentropy() function is not a cancellation point.

Minor changes from the previous introduction of getentropy into libc:

- Return EINVAL, not EIO, on buflen > 256.
- Define GETENTROPY_MAX in limits.h.

The declaration of getentropy in unistd.h and definition of
GETENTROPY_MAX in limits.h are currently conditional on
_NETBSD_SOURCE. When the next revision of POSIX is finalized, we can
expose them also under _POSIX_C_SOURCE > 20yymmL as usual -- and this
can be done as a pullup without breaking existing compiled programs.
 1.162 15-Oct-2021  andvar fix typos in comments.
 1.161 04-Dec-2020  kre Correct typo in previous.
 1.160 04-Dec-2020  christos Add __null_sentinel
 1.159 22-Sep-2020  nia remove getentropy bits
 1.158 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.157 06-May-2020  nia Add getentropy() to libc - a simple wrapper to access the kernel CSPRNG.

Posted to tech-userlevel@ a week ago and reviewed by riastradh@.

GETENTROPY(3) Library Functions Manual GETENTROPY(3)

NAME
getentropy - fill a buffer with high quality random data

LIBRARY
Standard C Library (libc, -lc)

SYNOPSIS
#include <unistd.h>

int
getentropy(void *buf, size_t buflen);

DESCRIPTION
The getentropy() function fills a buffer with high quality random data,
suitable for seeding cryptographically secure psuedorandom number
generators.

getentropy() is only intended for seeding random number generators and is
not intended for use by regular code which simply needs secure random
data. For this purpose, please use arc4random(3).

The maximum value for buflen is 256 bytes.

IMPLEMENTATION NOTES
getentropy() reads from the sysctl(7) variable kern.arandom.

RETURN VALUES
The getentropy() function returns 0 on success, and -1 if an error
occurred.

ERRORS
getentropy() will succeed unless:

[EFAULT] The buf argument points to an invalid memory address.

[EIO] Too many bytes were requested.

SEE ALSO
arc4random(3), rnd(4)

STANDARDS
The getentropy() function is non-standard.

HISTORY
The getentropy() function first appeared in OpenBSD 5.6, then in
FreeBSD 12.0, and NetBSD 10.
 1.156 31-Mar-2020  kamil Add getsid(2) to the XOPEN namespace (again)
 1.155 31-Mar-2020  kamil Expose getsid(2) to POSIX >= 2008
 1.154 15-Sep-2019  christos one fexecve declaration should be enough.
 1.153 15-Sep-2019  christos Remove the _INCOMPLETE_XOPEN_C063 stuff.
 1.152 15-Sep-2019  christos Declare fexecve
 1.151 18-Nov-2018  christos more type protection macro lossage.
 1.150 15-Aug-2018  martin PR standards/53525: move getsubopt() to stdlib.h
 1.149 06-Feb-2018  christos branches: 1.149.2; 1.149.4;
fix typo
 1.148 06-Feb-2018  christos detect duplicate declaration of pthread_atfork() in pthread.h
 1.147 30-Jun-2016  dholland PR 51287 Ralf Nolden: posix_fallocate belongs in <fcntl.h>
 1.146 18-Jun-2016  kamil Use generic types in the profil(2) function prototype (<unistd.h>)
 1.145 24-Mar-2015  wiz Put fseeko, ftello, pread, and pwrite in the POSIX 2001 namespace.
Ok christos, apb, martin
 1.144 22-Feb-2015  christos PR/49684: Pierre Pronchery: readlinkat(2) return type is wrong.
 1.143 26-Sep-2014  christos add execvpe, execlpe (reviewed by phone)
 1.142 25-Jul-2014  dholland branches: 1.142.2;
Add userlevel manifestations of posix_fallocate and fdiscard, in
unistd.h and libc, and add a man page.

Allow wiggle room in the man page for implementations of fallocate
that either (a) don't fully unwind on failure, leaving new blocks
allocated without changing the file size, or (b) create only in-memory
transient reservations that disappear when crashing or rebooting.

Also, add crossreference to fdiscard from ftruncate(2), and remove the
old BUGS entry from there that called for a generalized version that
allows discarding ranges of a file: that's what fdiscard is.
 1.141 18-Jun-2014  christos add mkostemp{s,} mkstemps from FreeBSD
 1.140 02-Jan-2014  christos branches: 1.140.2;
PR/4891: Wiz: readlink moved from xopen to base at issue 5.
 1.139 09-Oct-2013  njoly Follow OpenGroup online specification[1], move
fchmodat/mkdirat/mkfifoat/mknodat prototypes to <sys.stat.h>.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
 1.138 12-Jan-2013  dholland Remove #if defined(_KERNEL) around a userlevel function.
 1.137 01-Dec-2012  skrll Check for _NETBSD_SOURCE being defined wherever we check for
_INCOMPLETE_XOPEN_C063 so that we expose the new POSIX extended API set
recently added.
 1.136 18-Nov-2012  manu Add most system calls for POSIX extended API set, part 2, with test cases:
faccessat(2), fchmodat(2), fchownat(2), fstatat(2), mkdirat(2), mkfifoat(2),
mknodat(2), linkat(2), readlinkat(2), symlinkat(2), renameat(2), unlinkat(2),
utimensat(2), openat(2).

Also implement O_SEARCH for openat(2)

Still missing:
- some flags for openat(2)
- fexecve(2) implementation
 1.135 14-Jul-2012  darrenr branches: 1.135.2;
bin/46703: BSD r-commands use wrong source address for stderr
http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=46703
Bump libc minor for the addition of rresvport_af_addr()
 1.134 14-Apr-2012  christos new flag.
 1.133 13-Apr-2012  christos add more options.
 1.132 13-Apr-2012  christos add timeout to getpassfd.
 1.131 12-Apr-2012  christos add GETPASS_ECHO_STAR
 1.130 12-Apr-2012  christos add getpassfd
 1.129 12-Apr-2012  christos add getpass_r
 1.128 05-Nov-2011  joerg branches: 1.128.2;
Add __returns_twice for the attribute of the same name. This makes the
attribute explicit based on the functions GCC gives it too.
 1.127 08-Aug-2011  manu branches: 1.127.2;
First stage of support for Extended API set 2. Most of the think is
unimplemented, except enough of linkat(2) to hardlink to a symlink.

Everything new in headers is guarded #ifdef _INCOMPLETE_XOPEN_C063 since
some software (e.g.: xcvs in our own tree) will assume they can use openat(2)
when AT_FDCWD is defined. _INCOMPLETE_XOPEN_C063 will go away once support
will be completed.
 1.126 26-Jun-2011  christos * Arrange for interfaces that create new file descriptors to be able to
set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).

- Add F_DUPFD_CLOEXEC to fcntl(2).
- Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing.
- Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK.
- Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK.
- Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter
for socket(2) and socketpair(2).
- Add new paccept(2) syscall that takes an additional sigset_t to alter
the sigmask temporarily and a flags argument to set SOCK_CLOEXEC,
SOCK_NONBLOCK.
- Add new mode character 'e' to fopen(3) and popen(3) to open pipes
and file descriptors for close on exec.
- Add new kqueue1(2) syscall with a new flags argument to open the
kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.

* Fix the system calls that take socklen_t arguments to actually do so.

* Don't include userland header files (signal.h) from system header files
(rump_syscallargs.h).

* Bump libc version for the new syscalls.
 1.125 19-Jan-2011  christos Re-do ssp hijacking by defining inline functions and using the weak libc
symbols to do the indirection for unistd.h instead of #define tricks.
Fixes compilation for things that define struct { ssize_t read(int fd, ...); }.
 1.124 27-Aug-2010  christos The signal number argument in psignal is int not unsigned int.
Add psiginfo.
 1.123 17-Apr-2010  christos change size_t to ssize_t for POSIX compliance.
 1.122 17-Apr-2010  christos PR/43172: Jukka Ruohonen: swab(3) lacks restrict-keyword
 1.121 22-Jul-2009  kleink branches: 1.121.2;
Declare strsignal(3) in <string.h>, per POSIX-2008, and adjust
documentation accordingly.

Fixes PR standards/41325 from Perry E. Metzger.
 1.120 11-Jan-2009  christos merge christos-time_t
 1.119 06-Jan-2009  lukem Change the second argument of getlogin_r() from int to size_t, per POSIX.
 1.118 25-Jun-2008  ad branches: 1.118.4; 1.118.6;
SUS says that pthread_atfork() must also be in unistd.h
 1.117 25-Jun-2008  ad Add getlogin_r. Manual page changes mostly lifted from FreeBSD.
 1.116 28-Apr-2008  martin branches: 1.116.2; 1.116.4;
Remove clause 3 and 4 from TNF licenses
 1.115 01-Apr-2008  drochner branches: 1.115.2;
everyone else assumes that defining "_XOPEN_SOURCE" means XPG4.2,
so remove comparisions against the numerical values "3" or "4"
 1.114 24-Dec-2007  perry change some __attribute__s to __keywords
 1.113 09-Aug-2007  he branches: 1.113.2;
Add a new socket option for unix domain sockets: LOCAL_PEEREID, to make
it possible to get the pid, euid and egid of the process at the remote
end at the time it did bind() or connect().

Add a new libc function, getpeereid() to easily get at the euid and egid.
As a consequence, bump libc's minor number.

Document the LOCAL_PEEREID socket option in unix(4).

Based on contribution by Arne H. Juul, minor modifications by myself.
 1.112 02-Aug-2007  kristerw branches: 1.112.2;
Do not include SSP files unless _FORTIFY_SOURCE > 0.
 1.111 30-May-2007  tls Match usage of FORTIFY_SOURCE on other platforms by not requiring special
include path: the normal header files now include the "SSP" ones (which one
should note are not really named right: SSP and FORTIFY_SOURCE are independent
features).

Disable USE_SSP on targets where the compiler doesn't support it at all
(mips, alpha) or it's known broken (sh3). But enable FORTIFY_SOURCE,
without SSP, on those platforms -- tested on mipsel.
 1.110 26-Dec-2005  perry branches: 1.110.4; 1.110.6;
u_intN_t -> uintN_t
 1.109 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.108 26-Sep-2005  kleink Move ttyname_r() to the 1003.1c-1995 section.
 1.107 25-Sep-2005  christos ttyname_r returns int.
 1.106 25-Sep-2005  christos Add getenv_r and ttyname_r
 1.105 13-Sep-2005  christos compat code reorg
 1.104 11-Jun-2005  christos PR/30503: Nicolas Joly: swapctl(2) prototype does not match corresponding
syscall
 1.103 22-May-2005  kleink Remove the compatibility select() prototype. Going back to Lite2 select(2)
has also mandated <sys/time.h> to be included, which is now sufficient
for the prototype and all related declarations; thus the local duplicate
of the prototype can be removed. Approved by Christos.
 1.102 05-Mar-2005  kleink Provide select() and pselect() prototypes in <sys/select.h>, per
1003.1-2001, and leave the select() prototype in <unistd.h> for
compatibility. To allow for transition, reorganization of this is
deferred until netbsd-3 gets branched.
 1.101 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.100 06-Jan-2005  lukem Implement getgroupmembership(3). This is similar to getgrouplist(3), except
that the "int maxgroups" and "int *ngroups" parameters are separated into
two separate parameters which makes it possible to call multiple nsswitch
back-ends and have the results correctly merged.
getgrouplist(3) is now implemented using getgroupmembership(3).

Proposed on tech-userlevel on December 1, 2004.
 1.99 01-Jun-2004  kleink Move declaration of closefrom(3) to local extensions.
 1.98 31-May-2004  itojun implement closefrom(3).
 1.97 10-May-2004  kleink While I'm at it: add restrict qualifiers to readlink(2).
 1.96 10-May-2004  kleink POSIX-2001: Change readlink(2)'s return type from int to ssize_t.
 1.95 18-Nov-2003  thorpej Userland portion of fsync_range(2), written by Bill Studenmund, and
contributed by Wasabi Systems, Inc.
 1.94 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.93 08-Jul-2003  kristerw Do not give names to the parameters in function prototypes (those names
reduces the usefulness of the gcc -Wshadow flag).
 1.92 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.91 14-Apr-2003  kleink Well, _The_ Open Group.
 1.90 14-Apr-2003  kleink Use the real TOG specification name for references.
 1.89 14-Apr-2003  jdolecek seteuid() and setegid() were adopted in IEEE Std 1003.1-2001 + X/Open
portability guide issue 6, adjust headers to expose the function
prototypes with appropriate _POSIX_C_SOURCE/_XOPEN_SOURCE defines
fixes standards/21136 by MAEKAWA Masahide
 1.88 29-Jul-2001  wiz Remove variable name from prototype.
Reported by John Heasley on current-users on 29 July 2001.
 1.87 18-Jul-2001  kleink Avoid trad. cpp recursion in intptr_t definition.
 1.86 18-Dec-2000  christos branches: 1.86.2;
protect against multiple declarations.
 1.85 27-Jun-2000  kleink Define intptr_t and uintptr_t via <machine/int_types.h>.
 1.84 21-Apr-2000  minoura New syscall issetugid.
 1.83 02-Apr-2000  christos backout previous. the definition of struct option caused too many namespace
collisions. Instead, define getopt_long in getopt.h and getopt in unistd.h
where it belongs.
 1.82 01-Apr-2000  christos Add getopt.h and collect all the getopt related stuff here.
Make unistd.h include <getopt.h> to get the getopt stuff.
This adds support for getopt_long from Dieter Baron and Thomas Klausner.
 1.81 27-Jan-2000  itojun add IPv6 support to rcmd() and friends.
rcmd() and iruserok(): unchanged
ruserok(): became address family independent
rcmd_af(), iruesrok_sa(): address family independent
 1.80 10-Jan-2000  kleink Move <null.h> to <sys/null.h> for the purpose of avoiding conflicts due to
std C headers including it, and a kernel module written in C++ would benfit
as well.
 1.79 22-Dec-1999  kleink For the benefit of G++'s null pointer constant implementation, #define NULL
as __null with egcs 1.0 (GCC 2.90) and above. As several headers are affected
by this change, move the definition into a new header file, <null.h>, to ease
maintenance.
 1.78 02-Dec-1999  kleink Change the declaration of the argv argument to getopt(3) from "char * const *"
(as originally declared in System V) to "char * const []", as was done in
1003.2 and subsequently propagated into XPG4.
From Andrew Cagney in PR lib/8930.
 1.77 12-Jul-1999  kleink branches: 1.77.4;
XSH5: change function signature to `void *sbrk(intptr_t)'.
 1.76 03-Jul-1999  kleink Move IPv6-related declarations into the implementation-defined domain.
 1.75 01-Jul-1999  itojun define IPv6 library functions and structures, as defined in
RFC2292 and RFC2553.
define internal state structure for IPv6-transport resolver.

Commits for source code will follow.
 1.74 20-Apr-1999  kleink #ifdef __STDC__ -> #if __STDC__
 1.73 26-Mar-1999  sommerfe branches: 1.73.2;
move __getcwd prototypes to libc-private header file.

XXX duplicate the prototype in getcwd regression test (which needs to
call the syscall directly for reasonably complete testing).
 1.72 22-Mar-1999  sommerfe Add fchroot, getcwd
 1.71 09-Mar-1999  kleink brk(2) actually returns an int indicating success (0) or failure (-1). Also,
change its argument to void *. (Both XSH5).
 1.70 09-Mar-1999  kleink G/C orphaned unwhiteout() prototype.
 1.69 30-Nov-1998  thorpej Change the type of sys_siglist and sys_signame from const char *const [] to
const char *const *, and rename them to __sys_siglist14 and __sys_signame14.
This will prevent the size of the exported symbol from changing when more
signals are added to the list.
 1.68 09-Nov-1998  kleink getpgid() is XPG4.2, actually.
 1.67 06-Nov-1998  mrg add a prototype for getpgid (missing for years!)
 1.66 30-Jul-1998  mycroft __Namespace__ __protection__.
 1.65 28-Jul-1998  mycroft Sprinkle in some __attribute__((noreturn))s.
 1.64 27-Jul-1998  mycroft Slight rearrangement.
 1.63 27-Jul-1998  mycroft If __AUDIT__ is defined, remove some traditional interfaces: gets, sprintf,
vsprintf, tempnam, mktemp, getwd.
 1.62 27-Jul-1998  mycroft Mark more functions returning internal buffers for const auditing.
 1.61 27-Jul-1998  mycroft Make many of the new consts dependent on a new `__AUDIT__' flag, to avoid
breaking third party software. *sigh*
 1.60 26-Jul-1998  mycroft KNF nit.
 1.59 26-Jul-1998  mycroft const poisoning.
 1.58 02-Jul-1998  kleink Addendum to previous change: since pread()'s and pwrite()'s first official
appearance was in X/Open CAE Spec Issue 5 Version 2, add a section for that
and move the prototypes there.
 1.57 30-Jun-1998  thorpej Prototype pread(2) and pwrite(2) if !defined(_POSIX_C_SOURCE).
 1.56 05-Jun-1998  kleink Add a prototype for fdatasync(2).
 1.55 01-Jun-1998  kleink * Reorganize name space protection.
* Remove mknod() prototype; it's located in <sys/stat.h> (XPG4.2).
* Remove re_comp() and re_exec() prototypes; their location is <re_comp.h>
(XPG4.2).
* Move setkey() prototype to <stdlib.h> (XPG4).
* Move mkstemp(), mktemp(), ttyslot() and valloc() prototypes to <stdlib.h>
(XPG4.2).
Assign copyright to TNF.
 1.54 24-May-1998  kleink Make the rename() prototype available to XPG Issue <=3 applications only; the
canonical header for the prototype has been <stdio.h> for quite a while.
 1.53 06-May-1998  kleink Change the type of the `namelen' argument of gethostname(), getdomainname(),
sethostname(), setdomainname() from int to size_t. The former change was
made due to an X/Open XNS5 requirement, the latter three were made for
consistency.
 1.52 27-Mar-1998  kleink Per X/Open CAE Spec Issue 5 Version 2, change the buffer size argument of
readlink() from type `int' to type `size_t'. This isn't an ABI change, since
the calling convention of our only LP64 platform (the Alpha) already promotes
this argument to a `long'.

This may not be the final action on this matter; readlink() still returns
an `int', which may change in a future revision of the standard.
 1.51 18-Feb-1998  thorpej Prototype getsid().
 1.50 14-Feb-1998  kleink If standards-compliance is requested by defining the preprocessor symbols
_POSIX_SOURCE or _XOPEN_SOURCE at compile time, use __RENAME() to call
__posix_chown(), __posix_fchown(), __posix_lchown() and __posix_rename()
instead of their NetBSD counterparts in order to remove the requirement of
linking against libposix.
 1.49 02-Feb-1998  perry merge lite-2
 1.48 12-Jan-1998  kleink Per XPG4, move the prototype of swab() from <string.h> to <unistd.h>.
 1.47 05-Jan-1998  thorpej Update for __vfork14().
 1.46 20-Dec-1997  kleink Add lockf(), an alternate interface to perform advisory record locking;
per XPG4.2.
 1.45 25-Nov-1997  kleink Per XPG4.2, use useconds_t for as argument and return type of ualarm().
 1.44 24-Nov-1997  kleink Per XPG4.2, change usleep() to take an useconds_t as its argument, and return
an int.
 1.43 02-Nov-1997  kleink Per XPG4.2, move mknod() prototype from <unistd.h> to <sys/stat.h>.
 1.42 16-Oct-1997  christos branches: 1.42.2;
move setmode and strsignal to unistd.h
 1.41 08-Oct-1997  mikel proto lchown() only if !_POSIX_SOURCE
 1.40 06-Oct-1997  enami Declare prototype of lchown(2).
 1.39 20-Jul-1997  christos Backout addition of user_from_uid and group_from_gid; they exist in pwd.h
and grp.h [pointed by cgd]
 1.38 20-Jul-1997  christos Add user_from_uid and group_from_gid
 1.37 13-Jul-1997  christos Add missing swapon prototype and mark it obsolete.
 1.36 04-Jul-1997  kleink Common sense dictates that the `basegid' paramater of initgroups(3) should
be of type gid_t, and not int.
 1.35 23-Jun-1997  mrg oops, forgot to commit this. prototype swapctl() in place of swapon().
 1.34 09-May-1997  christos Add missing prototype for getgrouplist as mentioned in the man page.
 1.33 21-Dec-1996  cgd branches: 1.33.2;
__syscall() should return quad_t, not int; what was i thinking?
 1.32 20-Dec-1996  cgd sethostid returns int not void, also add prototype for __syscall that
matches manual page.
 1.31 07-Sep-1996  mycroft Don't prototype poll(2) here. SysV requires poll.h to be included.
 1.30 07-Sep-1996  mycroft Prototype poll(2).
 1.29 09-Aug-1996  mrg update for new reboot(2).
 1.28 23-Jun-1996  mycroft Declare setre[ug]id() to take [ug]id_t args. No functional difference.
 1.27 28-May-1996  mrg Change iuserok() to take u_int32_t. Some netgroup fixes (partially
from OpenBSD and Theo).
 1.26 22-Nov-1995  cgd branches: 1.26.4;
change definition of profil() to make it 64-bit friendly. This has
no practical consequence on 32-bit systems. old prototype was
int profil(char *, int, int, int), and new one is int profile(char *,
size_t, u_long, u_int). the size_t is the size of the buffer,
and the u_long is the 'starting offset'. (I changed the last int
to u_int, because it's treated as a u_int everywhere, and isn't
logically a signed value.)
 1.25 19-Mar-1995  mycroft Make definitions of psignal() and sys_siglist match signal.h.
 1.24 28-Dec-1994  mycroft Add prototypes for undelete(2).
 1.23 23-Dec-1994  cgd proto for iruserok.
 1.22 26-Oct-1994  cgd new RCS ID format.
 1.21 19-Oct-1994  cgd better attributes.
 1.20 08-Jun-1994  mycroft NFS changes.
 1.19 23-May-1994  cgd kill *chflags protos
 1.18 07-May-1994  jtc add new getopt(3) extern variable optreset
 1.17 29-Mar-1994  jtc Last weekend's uid_t & gid_t changes allow us to change the uid & gid
arguments to fchown from ints to a uid_t and a gid_t.
 1.16 29-Mar-1994  jtc Last weekend's gid_t changes allow us to change the gidset argument of
getgroups() and setgroups() from a int ptr to a gid_t ptr.
 1.15 25-Jan-1994  cgd match 4.4's definitions for sys_siglist and sys_signame
 1.14 30-Dec-1993  cgd vfork() return type pid_t. reported by Peter Galbavy.
Also, whoever did the re-indenting in this file needs to be shot;
things shouldn't be indented by "tab-space"...
 1.13 02-Dec-1993  mycroft Add `const's to sys_siglist and sys_signame decls.
 1.12 14-Oct-1993  jtc Change prototypes of alarm and sleep to use "unsigned" instead of "u_int".
"u_int" is not defined by <sys/types.h> in a strict POSIX environment.
 1.11 13-Oct-1993  jtc Declare getopt(), getsubopt() and their external variables.
Still work to be done to handle all the combinations of _POSIX_SOURCE, and
_POSIX2_SOURCE, etc. to allow the user to select a strictly conforming
compilation environment, but this change allows us to transition
getopt() out of <stdlib.h>.
 1.10 25-Sep-1993  jtc POSIX.1 says that ssize_t is defined in <sys/types.h>.
 1.9 21-Sep-1993  jtc Provide prototype for POSIX.2 function confstr().
 1.8 10-Sep-1993  jtc Add prototypes for getdomainname() and setdomainname(); the man page
instructs the user to include unistd.h, but it didn't provide a
declaration.
 1.7 06-Aug-1993  jtc Add __dead qualifier to _exit(), as it never returns.
 1.6 06-Aug-1993  mycroft Add declaration of sys_signame[].
 1.5 01-Aug-1993  mycroft Add RCS identifiers.
 1.4 16-Jun-1993  jtc Update fnmatch to be more posix complient (from keith bostic)
 1.3 16-May-1993  cgd getpgrp actually takes void. ask the IEEE...
 1.2 15-May-1993  cgd fix bad prototype for getpgrp()
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.26.4.2 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.26.4.1 28-May-1996  mrg merge in some size fixes, fixes couple of alpha bugs.
 1.33.2.1 04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.42.2.1 22-Nov-1998  cgd Add missing declaration of getpgid(). corresponds to revisions 1.67 and
1.68 on the trunk, but the file's structure has changed since the 1.3
branch was cut. (kleink)
 1.73.2.1 06-Oct-2000  he Pull up revision 1.84 (requested by sommerfeld):
Introduce the issetugid() system call.
 1.77.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.86.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.110.6.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.110.4.2 24-Aug-2007  liamjfoy Pull up following revision(s) (requested by kristerw in ticket #833):
include/unistd.h: revision 1.112
lib/libc/ssp/snprintf_chk.c: revision 1.4
lib/libc/ssp/sprintf_chk.c: revision 1.4
lib/libc/ssp/vsprintf_chk.c: revision 1.4
lib/libc/ssp/gets_chk.c: revision 1.4
include/stdio.h: revision 1.70
lib/libc/ssp/vsnprintf_chk.c: revision 1.4
lib/libc/ssp/fgets_chk.c: revision 1.4
include/strings.h: revision 1.12
include/string.h: revision 1.33
Do not include SSP files unless _FORTIFY_SOURCE > 0.
Update includes so that this builds for USE_FORT=no too.
 1.110.4.1 22-Jul-2007  liamjfoy Pull up to netbsd-4 (requested by christos in ticket #773):

Move libssp to libc.
 1.112.2.2 02-Aug-2007  kristerw Do not include SSP files unless _FORTIFY_SOURCE > 0.
 1.112.2.1 02-Aug-2007  kristerw file unistd.h was added on branch matt-mips64 on 2007-08-02 21:49:11 +0000
 1.113.2.1 09-Jan-2008  matt sync with HEAD
 1.115.2.1 18-May-2008  yamt sync with head.
 1.116.4.1 27-Jun-2008  simonb Sync with head.
 1.116.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.118.6.2 10-Jan-2009  christos sync with head
 1.118.6.1 25-Jun-2008  christos file unistd.h was added on branch christos-time_t on 2009-01-10 23:20:56 +0000
 1.118.4.2 17-Sep-2011  bouyer Pull up following revision(s) (requested by manu in ticket #1658):
sys/rump/include/rump/rump_syscalls.h: revision 1.52 via patch
sys/kern/init_sysent.c: revision 1.257 via patch
sys/rump/include/rump/rumpvnode_if.h: revision 1.12 via patch
lib/libc/sys/Makefile.inc: revision 1.208 via patch
sys/sys/syscallargs.h: revision 1.227 via patch
sys/kern/kern_exec.c: revision 1.317 via patch
sys/rump/librump/rumpkern/rump_syscalls.c: revision 1.74 via patch
include/limits.h: revision 1.30 via patch
sys/kern/syscalls.master: revision 1.251 via patch
sys/sys/vnode_if.h: revision 1.83 via patch
sys/sys/fcntl.h: revision 1.40 via patch
sys/sys/fcntl.h: revision 1.41 via patch
sys/kern/vfs_syscalls.c: revision 1.433 via patch
sys/rump/librump/rumpvfs/rumpvnode_if.c: revision 1.11 via patch
sys/kern/syscalls.c: revision 1.248 via patch
sys/sys/syscall.h: revision 1.244 via patch
lib/libc/sys/link.2: revision 1.25 via patch
include/unistd.h: revision 1.127 via patch
distrib/sets/lists/comp/mi: revision 1.1659 via patch
sys/sys/stat.h: revision 1.61 via patch
First stage of support for Extended API set 2. Most of the think is
unimplemented, except enough of linkat(2) to hardlink to a symlink.
Everything new in headers is guarded #ifdef _INCOMPLETE_XOPEN_C063 since
some software (e.g.: xcvs in our own tree) will assume they can use openat(2)
when AT_FDCWD is defined. _INCOMPLETE_XOPEN_C063 will go away once support
will be completed.
regen
improve comment about AT_* defines: they are not only used by linkat(2)
Add macros to hide OpenGroup extened API set 2 from GNU configure. This
is a temporary workaround until the implementation is completed.
 1.118.4.1 16-Jan-2009  snj Pull up following revision(s) (requested by lukem in ticket #247):
include/unistd.h: revision 1.119
lib/libc/gen/getlogin.c: revision 1.14
lib/libc/sys/getlogin.2: revision 1.21
Change the second argument of getlogin_r() from int to size_t, per POSIX.
 1.121.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.121.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.127.2.6 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.127.2.5 23-Jan-2013  yamt sync with head
 1.127.2.4 16-Jan-2013  yamt sync with (a bit old) head
 1.127.2.3 30-Oct-2012  yamt sync with head
 1.127.2.2 17-Apr-2012  yamt sync with head
 1.127.2.1 10-Nov-2011  yamt sync with head
 1.128.2.1 14-Apr-2015  msaitoh Pull up following revision(s) (requested by khorben in ticket #1264):

include/unistd.h 1.144
sys/kern/init_sysent.c regen
sys/kern/syscalls.c regen
sys/kern/syscalls.master 1.272
sys/rump/include/rump/rump_syscalls.h regen
sys/rump/librump/rumpkern/rump_syscalls.c regen
sys/sys/syscall.h regen
sys/sys/syscallargs.h regen
sys/compat/netbds32/netbsd32_syscall.h regen
sys/compat/netbds32/netbsd32_syscallargs.h regen
sys/compat/netbds32/netbsd32_syscalls.c regen
sys/compat/netbds32/netbsd32_sysent.c regen
sys/compat/netbsd32/syscalls.master 1.102

Fix return type of the readlinkat(2) syscall. PR#49684.
 1.135.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.135.2.2 25-Feb-2013  tls resync with head
 1.135.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.140.2.1 10-Aug-2014  tls Rebase.
 1.142.2.2 25-Mar-2015  snj Pull up following revision(s) (requested by wiz in ticket #642):
include/stdio.h: revision 1.96
include/unistd.h: revision 1.145
Put fseeko, ftello, pread, and pwrite in the POSIX 2001 namespace.
Ok christos, apb, martin
 1.142.2.1 24-Feb-2015  martin Pull up following revision(s) (requested by khorben in ticket #547):
include/unistd.h: revision 1.144
sys/kern/syscalls.master: revision 1.272

PR/49684: Pierre Pronchery: readlinkat(2) return type is wrong.
 1.149.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.149.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.149.4.1 10-Jun-2019  christos Sync with HEAD
 1.149.2.2 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.149.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.163.2.1 09-Oct-2024  martin Pull up following revision(s) (requested by riastradh in ticket #938):

lib/libc/gen/getentropy.3: revision 1.7
include/limits.h: revision 1.44
include/unistd.h: revision 1.167

getentropy(3): Make this visible to POSIX.1-2024 applications.

Likewise GETENTROPY_MAX.

It is now part of POSIX:
https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/getentropy.html

Cite standard in man page too. While here, use `.Nm' rather than
`.Fn getentropy' for self-reference in the man page, for consistency
with other usage.

PR standards/58603: getentropy(3): update visibility and documentation
for POSIX.1-2024
 1.166.2.1 02-Aug-2025  perseant Sync with HEAD
 1.70 02-Nov-2024  riastradh <util.h>: Need <sys/featuretest.h> for _POSIX_C_SOURCE.

PR lib/58752: various header files test _*_SOURCE macros but don't
include sys/featuretest.h
 1.69 10-Apr-2016  roy branches: 1.69.28;
Implement pidfile_lock, pidfile_read and pidfile_clean.

Discussed on tech-net@, ok core@.
 1.68 24-Sep-2015  christos add kinfo_getvmmap() decl
 1.67 26-Jul-2015  kamil Add ereallocarr(3) to libutil

ereallocarr(3) wraps reallocarr(3) and embeds return status validation.

Older version reviewed by <riastradh> and <christos>
 1.66 18-Jan-2015  christos add estrto{i,u} (Kamil Rytarowski)
 1.65 02-May-2013  matt Add getbyteorder(void) prototype.
 1.64 04-Nov-2012  christos Over the years this header gained a lot of disparate functionality
and willy nilly people kept adding headers appropriate to the new
functionality So we reached where we are today, this header causes
lots of namespace conflicts (for example you cannot use util.h from
a lex file, because ECHO is macro used in lex, and ECHO is defined
to 8 in termios). Roll back time, and remove all the unnecessary
includes, leaving it to the program to include the ancillary headers
they need.
 1.63 07-Apr-2012  christos branches: 1.63.2;
add getdisk{raw,cooked}name
 1.62 07-Apr-2012  christos add getfsspecname
 1.61 07-Jan-2012  christos strspct
 1.60 13-Nov-2011  christos getfstypename addition
 1.59 30-Aug-2011  bouyer branches: 1.59.2;
Add getlabelusesmbr(), as proposed in
http://mail-index.netbsd.org/tech-userlevel/2011/08/25/msg005404.html
This is used by disk tools such as disklabel(8) to dynamically decide is
the undelyling platform uses a disklabel-in-mbr-partition or not
(instead of using a compile-time list of ports).
getlabelusesmbr() reads the sysctl kern.labelusesmbr, takes its value from the
machdep #define LABELUSESMBR.
For evbmips, make LABELUSESMBR 1 if the platform uses pmon
as bootloader, and 0 (the previous value) otherwise.
 1.58 28-Aug-2011  christos prototype for strpct
 1.57 26-Aug-2011  joerg pw_error is documented to be dead
 1.56 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.55 25-Feb-2010  joerg Consistently use __printflike and __scanflike.
 1.54 27-Jan-2010  drochner branches: 1.54.2;
retire pw_policy(3) -- it is not found useful, there are other
(more common) ways to enforce a password strength policy
approved by elad
 1.53 13-Oct-2009  pooka In a furious blaze of *facepalm* / "what was i thinking?", fix the
open routine function pointer prototype of opendisk1() to match
the prototype of open().
 1.52 08-Sep-2009  pooka Add opendisk1(), which functions like opendisk(), but takes a function
pointer to the routine to be used for open().
 1.51 13-May-2009  pgoyette Implement snprintb_m(3) to provide multi-line bit/bit-field decode.
Discussed on tech-kern.
 1.50 11-Jan-2009  christos branches: 1.50.2;
merge christos-time_t
 1.49 14-Dec-2007  christos branches: 1.49.12; 1.49.14; 1.49.18;
humanize_number was the only function in <util.h> that is not in libutil.
Move it to stdlib.h and add dehumanize_number.
 1.48 30-Oct-2007  christos don't use u_long because it is present only with _NETBSD_SOURCE
 1.47 25-Sep-2007  lukem Add raise_default_signal(3) -- raise the default signal handler.
Can be used by applications that have their own SIGINT (et al)
handlers and want to exit in a manner that correctly
signals to the parent that the process was terminated by a signal.
See http://www.cons.org/cracauer/sigint.html for more info.
Discussed on tech-userlevel@.
 1.46 01-Jul-2007  pooka branches: 1.46.4;
add estrndup()
 1.45 14-Dec-2006  christos moved string_to_flags and flags_to_string from ls to libutil.
 1.44 20-Nov-2006  christos getdate -> parsedate
 1.43 17-Nov-2006  christos constify getdate
 1.42 17-Nov-2006  christos add getdate.
 1.41 26-Aug-2006  christos Add efun(3)
 1.40 18-Feb-2006  elad Don't expose struct pw_policy and use pw_policy_t, use malloc, man-page
fixups.

As discussed on source-changes@.

Okay yamt@, thorpej@.
 1.39 18-Feb-2006  elad Add the struct pw_policy forgotten in previous commit.
 1.38 14-Sep-2005  elad Forgot these when imported pw_policy(3).
Thanks to Hisashi T Fujinaka for noticing.
 1.37 27-Aug-2005  uwe Get rid of the #if !HAVE_NBTOOL_CONFIG_H kludge. None of host tools
uses this header now.
 1.36 12-Jun-2005  dyoung Make disklabel(8) and fdisk(8) into "host tools " last step: build
and install ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-disklabel,
${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-fdisk by "reaching over" to
the sources in ${NETBSDSRCDIR}/sbin/{disklabel fdisk}/.

To avoid clashes with a build-host's header files, especially on
*BSD, the host-tools versions of fdisk and disklabel search for
#includes such as disklabel.h, disklabel_acorn.h, disklabel_gpt.h,
and bootinfo.h in a new #includes namespace, nbinclude/. That is,
they #include <nbinclude/sys/disklabel.h>, <nbinclude/machine/disklabel.h>,
<nbinclude/sparc64/disklabel.h>, instead of <sys/disklabel.h> and
such. I have also updated the system headers to #include from
nbinclude/-space when HAVE_NBTOOL_CONFIG_H is #defined.
 1.35 15-May-2005  thorpej u_short -> uint16_t
 1.34 12-Jan-2005  christos branches: 1.34.2;
add pw_getpwconf()
 1.33 19-Nov-2004  christos Add sockaddr_snprintf()
 1.32 03-Aug-2004  thorpej - Rename pw_copy() to pw_copyx(), make it return a success/failure code,
and add "errbuf" and "errbufsz" parameters so that errors can be handled
gracefully, rather than simply exiting the process.
- Add a pw_copy() wrapper around pw_copyx() to preserve old behavior for
apps that use it.
- Bump shlib version to 7.4.
 1.31 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.30 24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.29 12-Dec-2002  scw Add getlabelsector() and getlabeloffset() as wrappers around the
KERN_LABELSECTOR and KERN_LABELOFFSET sysctls.
 1.28 30-Nov-2002  lukem - Migrate fparseln(3) from libutil to libc, where it should have been in
the first place...
- Bump libutil major (to 7.0) and libc minor (to 12.91).
 1.27 12-Oct-2002  elric add prototypes for disklabel_dkcksum() and disklabel_scan().
 1.26 20-Sep-2002  christos Add snprintb(3)
 1.25 15-Aug-2002  enami Cosmetic changes.
 1.24 08-Aug-2002  abs Add humanize_number.3 from Tomas Svensson in PR lib/15508.
Bump version of libutil
 1.23 27-Jul-2002  christos add utmpx/wtmpx processing routines
 1.22 22-May-2002  itojun change return type of pidfile(3) to int (-1 on error), to inform caller
of errors. behavior now in sync with openbsd implementation.
(see tech-userlevel and bsd-api-discuss)
 1.21 18-Aug-2001  ad branches: 1.21.2;
Add two arguments to pw_mkdb(), a la OpenBSD. This is to allow us to pass
the -u and -s options to pwd_mkdb.
 1.20 06-Apr-2001  wiz add getbootfile(3)
 1.19 06-Dec-2000  tron branches: 1.19.2;
Add two new passwd file update functions:
- The pw_setprefix() function defines the root directory used for passwd
file updates. If the prefix is set to /newroot pw_lock() will operate on
/newroot/etc/ptmp afterwards. The default prefix is an empty string.
- The pw_getprefix() function returns the root directory which is currently
used for passwd file updates.
 1.18 18-Sep-2000  ad - Sort function decls.
- Remove duplicate decl.
- First arg to secure_path() is now constant.
 1.17 07-Jul-2000  ad Remove decl for parseuserspec(), a local modification which acidentally got
comitted.
 1.16 06-Jul-2000  ad - Declare pw_getconf().
- ANSIfy.
 1.15 12-Jan-2000  mjl branches: 1.15.4;
Add necessary support routines for login.conf.
 1.14 12-Jun-1999  christos - provide forward struct declarations for all functions.
- const poison login().
- XXX: we should not include all these files here. We only need stdio.h and
sys/types.h! But I am not rm'ing them now because too many things will break.
 1.13 06-Jun-1999  thorpej Add pidfile(3), which write a pid file in /var/run, and arranges for it
to be removed on normal exit.
 1.12 26-Jul-1998  mycroft const poisoning.
 1.11 08-Jun-1998  lukem move pw_scan from util.h to pwd.h, add _PASSWORD_{OLDFMT,NOWARN} flags
 1.10 01-Dec-1997  lukem add flags arg to fparseln(), and define FPARSELN_UNESC{ESC,CONT,COMM,REST,ALL}
 1.9 16-Nov-1997  lukem fix retval of fparseln
 1.8 16-Nov-1997  christos Add fparseln(3)
 1.7 11-Oct-1997  cjs Add prototypes and defines for pidlock/ttylock/ttyunlock.
 1.6 25-Sep-1997  lukem implement opendisk(3), as discussed with Jason Thorpe
 1.5 24-Jul-1997  phil Update pw_copy prototype for changes for PR3806, 3807.
 1.4 30-Jun-1997  christos forgot to commit this.
 1.3 14-Nov-1996  gwr Add declaration for ttyaction().
 1.2 16-May-1996  thorpej Prototypes for getmaxpartitions(3) and getrawpartition(3).
 1.1 15-May-1996  jtc Added new header files for functions in libutil.
Added macro for master passwd lock file.
From Greg Hudson <ghudson@MIT.EDU>.
 1.15.4.1 26-Feb-2002  he Pull up revisions 1.16-1.18 (via patch, requested by jonathan):
Add support for local MD5-encrypted passwords.
 1.19.2.11 19-Dec-2002  thorpej Sync with HEAD.
 1.19.2.10 18-Dec-2002  martin Catch up to -current.
 1.19.2.9 10-Dec-2002  thorpej Sync with HEAD.
 1.19.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.19.2.7 20-Sep-2002  thorpej Sync with HEAD.
 1.19.2.6 27-Aug-2002  nathanw Catch up to -current.
 1.19.2.5 13-Aug-2002  nathanw Catch up to -current.
 1.19.2.4 01-Aug-2002  nathanw Catch up to -current.
 1.19.2.3 21-Jun-2002  nathanw Catch up to -current.
 1.19.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.19.2.1 08-Apr-2001  nathanw Merge trunk onto branch.
 1.21.2.1 25-Oct-2003  cyber Pull up revision 1.27 (requested by jmc in ticket #1461):
add prototypes for disklabel_dkcksum() and disklabel_scan().
 1.34.2.1 19-May-2005  tron Pull up revision 1.35 (requested by thorpej in ticket #309):
u_short -> uint16_t
 1.46.4.2 09-Jan-2008  matt sync with HEAD
 1.46.4.1 06-Nov-2007  matt sync with HEAD
 1.49.18.1 21-Apr-2010  matt sync to netbsd-5
 1.49.14.1 28-Dec-2008  christos more compat changes
- new functions
- adjust utmp size.
 1.49.12.2 14-Oct-2009  sborrill Pull up the following revisions(s) (requested by pooka in ticket #1089):
include/util.h: revision 1.53
lib/libutil/opendisk.c: revision 1.12

Fix the open routine function pointer prototype of opendisk1() to match
the prototype of open().
 1.49.12.1 05-Oct-2009  sborrill Pull up the following revisions(s) (requested by pooka in ticket #1047):
include/util.h: revision 1.52
lib/libutil/opendisk.c: revision 1.11
Add opendisk1(), which functions like opendisk(), but takes a function
pointer to the routine to be used for open().
 1.50.2.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.54.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.59.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.59.2.2 16-Jan-2013  yamt sync with (a bit old) head
 1.59.2.1 17-Apr-2012  yamt sync with head
 1.63.2.2 23-Jun-2013  tls resync from head
 1.63.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.69.28.1 02-Aug-2025  perseant Sync with HEAD
 1.9 11-Jan-2009  christos merge christos-time_t
 1.8 03-Feb-2005  perry branches: 1.8.36;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.6 06-May-1998  kleink Per POSIX and X/Open, don't include <sys/types.h> but make only time_t
available.
 1.5 02-Feb-1998  perry merge lite-2
 1.4 11-Jun-1996  jtc POSIX.1 requires programs to include <sys/types.h> before including
<grp.h> or <utime.h> while XPG4.2 makes <sys/types.h> optional. So
I've included <sys/types.h> to provide the XPG4.2 behavior.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.8.36.1 08-Nov-2008  christos changes for 64 bit time_t
 1.13 22-Jan-2016  dholland Needs sys/cdefs.h for __BEGIN_DECLS. Also add time.h to get time_t,
rather than doing the machine/ansi.h #ifdef dance, as it doesn't matter
much what symbols utmp.h exposes. This could be tightened later when we
manage to do enough include cleanup to make such dances less expensive
to maintain.
 1.12 11-Jan-2009  christos merge christos-time_t
 1.11 03-Feb-2005  perry branches: 1.11.36;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.10 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.9 28-Jul-2002  christos Add __P(()); noticed by wiz.
 1.8 28-Jul-2002  christos add utmpname()
 1.7 27-Jul-2002  christos add some utmp processing functions.
 1.6 26-Oct-1994  cgd branches: 1.6.20;
new RCS ID format.
 1.5 19-Oct-1994  cgd be more careful with types
 1.4 16-May-1994  cgd update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those. Kill varargs.h, because it can simply
be a link to the machine-dependent version.
 1.3 16-Dec-1993  jtc #include <sys/types.h> to define time_t type.
We're free to do this since the contents of utmp.h haven't been standardized
intelligently (Death to X/Open's 1170 spec).
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6.20.1 01-Aug-2002  nathanw Catch up to -current.
 1.11.36.1 28-Dec-2008  christos more compat changes
- new functions
- adjust utmp size.
 1.18 15-Aug-2021  gutteridge utmpx.h: fix comment missed in r. 1.10 _NETBSD_SOURCE changes
 1.17 11-Jan-2009  christos don't do size computations because g++ does not like it.
 1.16 11-Jan-2009  christos merge christos-time_t
 1.15 28-Apr-2008  martin branches: 1.15.10;
Remove clause 3 and 4 from TNF licenses
 1.14 22-Sep-2006  christos branches: 1.14.16;
Add run level messages.
 1.13 13-Sep-2005  christos compat code reorg
 1.12 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.11 26-Aug-2003  wiz Make getlastlogx have the pathname to the lastlogx database as first
argument, to be consistent with updlastlogx.

Approved by christos, reviewed by kleink.

[The lastlogxname function should not be used any longer.]
 1.10 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.9 28-Jul-2002  christos Add __P(()); noticed by wiz.
 1.8 27-Jul-2002  christos updates to lastlogx implementation.
 1.7 02-Jun-2002  christos forward declaration for struct utmp.
 1.6 04-Apr-2002  christos - reverse the #define ut_user<->ut_name so that we don't affect utmp.
- add a couple of gnuisms.
 1.5 05-Mar-2002  christos branches: 1.5.2;
add a couple of XOPEN compatibility defines, and a non-xopen function that
we are expected to have (updwtmpx). Requested by tron.
 1.4 05-Mar-2002  tron Include "sys/time.h" here to get the definition of "struct timeval".
 1.3 25-Feb-2002  christos s/ut_name/ut_user/ from Simon Burge.
 1.2 25-Feb-2002  christos - include <sys/socket.h> because we use sockaddr_storage
- it is PATH_LASTLOGX not PATH_LASTLOG
 1.1 22-Feb-2002  christos A utmpx implementation.
 1.5.2.5 01-Aug-2002  nathanw Catch up to -current.
 1.5.2.4 21-Jun-2002  nathanw Catch up to -current.
 1.5.2.3 25-Apr-2002  nathanw Catch up to -current.
 1.5.2.2 11-Mar-2002  nathanw Catch up to -current.
 1.5.2.1 05-Mar-2002  nathanw file utmpx.h was added on branch nathanw_sa on 2002-03-11 21:07:51 +0000
 1.14.16.1 18-May-2008  yamt sync with head.
 1.15.10.4 28-Dec-2008  christos more compat changes
- new functions
- adjust utmp size.
 1.15.10.3 09-Nov-2008  christos no need to version {set,end}utmpx
 1.15.10.2 08-Nov-2008  christos changes for 64 bit time_t
 1.15.10.1 28-Apr-2008  christos file utmpx.h was added on branch christos-time_t on 2008-11-08 21:13:13 +0000
 1.2 23-Apr-2008  plunky branches: 1.2.10;
constify uuid(3)
 1.1 13-Sep-2004  thorpej branches: 1.1.24;
DCE 1.1 RPC compatible UUID routines for libc, adapted from FreeBSD.
Encode/decode to big/little endian binary blob routines adapted from
kernel.

PR 23470.
 1.1.24.1 18-May-2008  yamt sync with head.
 1.2.10.2 23-Apr-2008  plunky constify uuid(3)
 1.2.10.1 23-Apr-2008  plunky file uuid.h was added on branch christos-time_t on 2008-04-23 07:52:33 +0000
 1.4 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.3 28-Apr-2008  martin branches: 1.3.10;
Remove clause 3 and 4 from TNF licenses
 1.2 06-Jun-2004  mrg branches: 1.2.24;
add $NetBSD$
 1.1 14-Oct-2003  tron Replace symbolic link "/usr/include/varargs.h" (pointing to
"/usr/include/machine/varargs.h") by a stub include file which will
emit an error if GCC 3.3 or newer is used and include "machine/varargs.h"
otherwise.

Based on a suggestion by Richard Earnshaw. This fixes PR toolchain/22888
by myself.
 1.2.24.1 18-May-2008  yamt sync with head.
 1.3.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.10.1 28-Apr-2008  martin file varargs.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.26 20-May-2022  andvar s/appropiate/appropriate/ in comments and readme file.
 1.25 23-Apr-2017  christos Add vis DQ.
 1.24 14-Jan-2016  christos branches: 1.24.2;
add stravis
 1.23 23-May-2015  christos add VIS_NOLOCALE flag
 1.22 26-Sep-2014  christos add VIS_META/VIS_SHELL support to encode all shell metacharacters.
XXX: /etc/rc.d/wizd fix $
 1.21 20-Feb-2013  christos More fixes from J.R. Oldroyd. We introduce a new function that can
retrieve and return if there has been a conversion error, so that
it can keep performing char-by-char processing if a multi-byte
conversion occurred. Also some more code cleanups in the "extra"
processing.
 1.20 14-Dec-2012  christos Add VIS_GLOB (Brooks Davis)
 1.19 12-Mar-2011  christos branches: 1.19.4; 1.19.10;
Fix various vis/unvis issues:
- no need for all the weak symbols
- define a new _VIS_END flag for UNVIS_END so that there are no collisions
between and vis and unvis flags.
- add bound versions of the vis and unvis functions that take the length of
the destination buffer. Unlike the OpenBSD ones they return -1 or NULL if
the buffer is not large enough, instead of silently truncating.
 1.18 27-Nov-2010  christos add VIS_NOESCAPE and VIS_HTTP1866
 1.17 10-Feb-2009  christos Add RFC 2045 MIME Quoted-Printable support.
 1.16 13-Sep-2005  christos branches: 1.16.32;
compat code reorg
 1.15 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.14 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.13 12-Dec-2002  lukem this needs <sys/types.h>
 1.12 23-Mar-2002  christos branches: 1.12.2;
Add VIS_HTTPSTYLE and strunvisx (From FreeBSD)
 1.11 25-Nov-1999  wennmach branches: 1.11.6;
Added prototypes for svis, strsvis, strsvisx
 1.10 13-Nov-1998  christos branches: 1.10.6;
change the second arg of unvis from char -> int, to avoid K&R vs. ansi
portability problems.
 1.9 02-Feb-1998  perry merge lite-2
 1.8 04-Nov-1997  thorpej Fix __RENAME quoting lossage (don't pass it a quoted string). From
Chris Demetriou <cgd@pa.dec.com>.
 1.7 22-Oct-1997  fvdl New hacks to make libc work painlessly without bumping the major number:
use type func(arg1s) asm("emitted_name") gcc mechanism.
Suggested by Bill Sommerfeld.
 1.6 20-Oct-1997  thorpej branches: 1.6.2;
Fix the shared library versioning snafu caused by the recent changes
to the stat(2) family and msync(2). This uses a primitive function
versioning scheme.

This reverts the libc shared library major version from 13 to 12, and
adds a few new interfaces to bring us to libc version 12.20.

From Frank van der Linden <fvdl@NetBSD.ORG>.
 1.5 16-Oct-1997  christos second argument is now int instead of char
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 03-Aug-1993  mycroft New versions to go with new fts() et al.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6.2.2 04-Nov-1997  thorpej Pull up from trunk: Fix __RENAME() usage.
 1.6.2.1 22-Oct-1997  thorpej Pull up from trunk: Update for less nasty function renaming.
 1.10.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.6.2 19-Dec-2002  thorpej Sync with HEAD.
 1.11.6.1 25-Apr-2002  nathanw Catch up to -current.
 1.12.2.1 16-Jun-2003  grant Pull up revision 1.13 (requested by klienk in ticket #1210):

this needs <sys/types.h>
 1.16.32.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.19.10.1 25-Feb-2013  tls resync with head
 1.19.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.19.4.1 23-Jan-2013  yamt sync with head
 1.24.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.46 01-Nov-2024  nia libc: Expose some newly-standard C functions in POSIX.1-2024 mode
 1.45 31-Jul-2023  christos branches: 1.45.2;
new gdb needs wmempcpy, give it to it.
 1.44 20-Mar-2020  joerg Fix visibility of various C99 features, esp. for C++11.
 1.43 28-Dec-2018  maya Limit wcslcat, wcslcpy visibility to _NETBSD_SOURCE
wcswidth, wcwidth to POSIX.1-2001 or _NETBSD_SOURCE

Updated patch from kretschm in PR standards/39422
 1.42 15-Oct-2016  kamil branches: 1.42.8; 1.42.12; 1.42.14;
Import wcsnlen(3) to libc

The wcsnlen(3) function conforms to POSIX.1-2008 and is an addition to the
ISO C standard.

size_t wcsnlen(const wchar_t *s, size_t maxlen);

The wcsnlen(3) function computes the number of wide-characters in a wide-
-string to which s points, not including NULL terminating wide-character
code and checking no more than maxlen wide-characters. This function never
examines wide-characters beyond a wide-string of maxlen size.


This function is a safer version of wcslen(3):

size_t wcslen(const wchar_t *s);


Update STANDARDS section of wmemchr(3) describing wide-character functions.
 1.41 13-Oct-2014  christos branches: 1.41.2;
add open_{,w}memstream
 1.40 21-Nov-2013  degroote Expose properly vfwscanf and friends for POSIX_SOURCE >= 200112L
 1.39 19-Aug-2013  joerg Add nl_langinfo_l, catopen_l and wcsftime_l.
 1.38 28-May-2013  joerg Add mbsnrtowcs and wcsnrtombs. Approved by core.
 1.37 19-Apr-2013  joerg More __BEGIN_DECLS / __END_DECLS wrappers.
 1.36 19-Apr-2013  joerg Add scanf_l and wscanf_l families.
 1.35 19-Apr-2013  joerg Add explicit locale versions for the printf family. Replace asprintf,
snprintf and sprintf with simple wrappers around the corresponding
va_list functions to reduce code duplication.
 1.34 18-Apr-2013  joerg Add wcscoll_l, wcsxfrm_l, wcsncasecmp_l, wcscasecmp_l, btowc_l,
mbrlen_l, mbsinit_l, mbsrtowcs_l, wcrtomb_l, wcsrtombs_l and wctob_l.
 1.33 18-Apr-2013  joerg Add wcstof_l, wcstod_l and wcstold_l.
 1.32 16-Apr-2013  joerg Add support for wcstoimax_l and friends.
 1.31 16-Apr-2013  joerg Also add prototypes for wcwidth_l and wcswidth_l.
 1.30 17-Jul-2011  joerg branches: 1.30.2; 1.30.4; 1.30.8;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.29 27-Mar-2010  tnozaki 1. {wctype,wctrans,mbstate}_t: switch MD to MI like other
libc implementation (such as *BSD and glibc2).

2. don't typedef void * wc{type,trans}_t, suggested by soda@-san.
it may pass through compiler type check, it's harmful.
so i introduce dummy struct __tag_wc{type,trans}_t(iconv_t already does).

no ABI change was made.
 1.28 15-Nov-2009  christos branches: 1.28.2;
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.27 28-Apr-2008  martin branches: 1.27.8; 1.27.10; 1.27.18;
Remove clause 3 and 4 from TNF licenses
 1.26 22-Aug-2006  christos branches: 1.26.16;
PR/34238: Aleksey Cheusov: add wcsdup, wcscasecmp and wcsncasecmp functions
 1.25 15-Apr-2006  tnozaki branches: 1.25.2;
add c99 wcstof(3) and wcstold(3).
requested by skrll AT netbsd DOT org, thanks.

bump libc minor 138 -> 139.
 1.24 15-May-2005  christos add t_putws
 1.23 14-May-2005  christos Wide stdio functions.
 1.22 30-Mar-2005  christos PR/29826: J. T. Conklin: Add wcsftime(3) (from FreeBSD)
 1.21 03-Feb-2005  perry branches: 1.21.2;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.20 08-May-2004  kleink C99: Provide WCHAR_{MAX,MIN} via <machine/wchar_limits.h> (we'll also
provide WINT_{MAX,MIN} along with it).
Fixes PR standards/24040 from Masao Uebayashi.
 1.19 08-Jul-2003  itojun prototype must not have variable name
 1.18 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.17 11-Mar-2003  tshiozak add wcstoll, wcstoimax, wcstoull and wcstoumax. (lib/20656)
- these are defined in C99 (wcsto[ui]max) and SUSv3.
- these implementations are written by sigsegv@s25.xrea.com,
derived from NetBSD's wcstol/wcstoul.
- I just added some comments.
 1.16 07-Mar-2003  tshiozak add fgetws() and fputws() (lib/20576).

Note: fgetws.c, fgetws.3, fputws.c and fputws.3 are obtained from FreeBSD,
and fitted by sigsegv@infoseek.jp and me.
 1.15 05-Mar-2003  tshiozak changes related to lib/20576 and lib/20577.
- add wcstok() and wcswcs(),
- add wcstok(3),
- move btowc() and wctob() into each ctype modules,
- bump ctype interface ABI version,
- bump i18n modules' minor and
- update sets.
and fix a stupid bug in _RUNE_ISCACHED macro.
 1.14 03-Mar-2003  tshiozak - add wctob() function. (I forgot it at the last commit.)
- fix btowc(); I quite misunderstood about it.
 1.13 02-Mar-2003  tshiozak add some ISO C 1995 I18N functions and types:
btowc, wctrans, towctrans, wcscoll, wcsxfrm, wctype_t and wctrans_t.
 1.12 14-Mar-2002  yamt fix prototype of fputwc, putwc and putwchar.
 1.11 07-Dec-2001  yamt - make FILE structure extensible without breaking binary-compatibility.
- add fputwc, fgetwc, fwide and related functions.
- add hooks needed to maintain the orientation of file stream.
 1.10 27-Sep-2001  yamt add wcstod/wcstol/wcstoul.
 1.9 29-Dec-2000  kleink branches: 1.9.2;
Sprinkle some __restrict into <wchar.h>.
 1.8 22-Dec-2000  itojun wcwidth is outside of standard
 1.7 22-Dec-2000  itojun add wcsl{cat,cpy}
 1.6 21-Dec-2000  itojun first import of citrus LC_CTYPE locale. singlebyte only at this moment.
shot-term TODO:
- enable multibyte locales. this includes loadable locale modules
(#ifdef DLRUNE).
- populate LC_CTYPE definition files.
- other functions such as iconv()
- make libc functions more friendly with multibyte.
- multilingualize other LC_xx
- torture tests

XXX don't forget to "make depend" when you rebuild libc, multibyte.c is
moved from lib/libc/stdlib to lib/libc/locale.
 1.5 21-Dec-2000  itojun add dummy wcwidth() and wcswidth(). wcwidth() will be updated later.
 1.4 21-Dec-2000  itojun add wcs* functions. consier it as part of libc minor crank 68 -> 69.
add decl of WEOF into wchar.h. ISO/IEC 9899:1999(E)..
 1.3 20-Dec-2000  itojun ISO 9899-1990: #include <wchar.h> should pull definition for "NULL" in.
checked with Norihiro Kumagai <kuma@oasis.sharplabs.com>
 1.2 20-Dec-2000  itojun add wmem* functions, from citrus. bump libc shlib minor.
 1.1 20-Apr-2000  kleink branches: 1.1.2;
* Move <wchar.h> from libcurses to include (for the missing functionality
is to be provided by libc).
* Define wint_t and size_t in <wchar.h> as well.
 1.1.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.9.2.4 22-Mar-2002  nathanw Catch up to -current.
 1.9.2.3 28-Jan-2002  nathanw Catch up to -current.
 1.9.2.2 14-Jan-2002  nathanw Catch up to -current.
 1.9.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.21.2.1 06-Apr-2005  tron Pull up revision 1.22 (requested by christos in ticket #102):
PR/29826: J. T. Conklin: Add wcsftime(3) (from FreeBSD)
 1.25.2.1 27-Aug-2006  riz Pull up following revision(s) (requested by tron in ticket #64):
lib/libc/include/namespace.h: revision 1.119
lib/libc/string/wcsdup.c: revision 1.1
lib/libc/string/wcscasecmp.c: revision 1.1
lib/libc/include/namespace.h: revision 1.120
distrib/sets/lists/base/shl.mi: revision 1.366
lib/libc/shlib_version: revision 1.182
include/wchar.h: revision 1.26
lib/libc/string/Makefile.inc: revision 1.62
lib/libc/string/Makefile.inc: revision 1.63
lib/libc/string/wcsncasecmp.c: revision 1.1
PR/34238: Aleksey Cheusov: add wcsdup, wcscasecmp and wcsncasecmp functions
libc 147 for wcsdup and wcs{n,}casecmp
include one more new file.
add wcsdup, wcscasecmp and wcsncasecmp. fixes build problems..
I think we want both wcs{c,n}casecmp weak.
 1.26.16.1 18-May-2008  yamt sync with head.
 1.27.18.1 20-May-2011  bouyer Pull up following revision(s) (requested by joerg in ticket #1611):
include/inttypes.h: revision 1.7
include/stddef.h: revision 1.16
include/wchar.h: revision 1.28
include/stdlib.h: revision 1.90
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.27.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.27.10.1 28-Apr-2008  martin file wchar.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.27.8.2 26-Feb-2015  snj Apply patch (requested by christos in ticket #1943):
Properly expose wcsto{f,ld,ll,ull} and v{fw,sw,ws}scanf when
_POSIX_C_SOURCE >= 200112L and _XOPEN_SOURCE >= 600.
 1.27.8.1 20-May-2011  bouyer Pull up following revision(s) (requested by joerg in ticket #1611):
include/inttypes.h: revision 1.7
include/stddef.h: revision 1.16
include/wchar.h: revision 1.28
include/stdlib.h: revision 1.90
Don't define wchar_t for c++; it is native in the language. From Alexander
Nasonov
 1.28.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.30.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.8.1 23-Jun-2013  tls resync from head
 1.30.4.1 16-Jan-2015  martin Pull up following revision(s) (requested by christos in ticket #1231):
include/wchar.h: revision 1.40
Expose properly vfwscanf and friends for POSIX_SOURCE >= 200112L
 1.30.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.41.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.42.14.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.42.14.1 10-Jun-2019  christos Sync with HEAD
 1.42.12.1 18-Jan-2019  pgoyette Synch with HEAD
 1.42.8.2 20-Jan-2018  perseant Use multilevel tables (tries) to convert kuten <-> unicode.
Get rid of dchains, replace with chain/rchain conversions through keys
allocated from the PUA.
 1.42.8.1 14-Jul-2017  perseant Initial commit of a mostly-working implementation of __STDC_ISO_10646__,
with collation support using the Unicode Collation Algorithm.

The conversion from men/ku/ten form to Unicode is a gross hack at present.
Fixing this, and fleshing out the LC_COLLATE locale component, are next
on the agenda.
 1.45.2.1 02-Aug-2025  perseant Sync with HEAD
 1.9 27-Apr-2013  joerg Systematically include sys/featuretest.h when _NETBSD_SOURCE is used.
Some are redundant, but make verification with grep much easier.
 1.8 16-Apr-2013  joerg Add wcwidth_l, wcswidth_l and the wctype.h family of *_l functions.
 1.7 27-Mar-2010  tnozaki branches: 1.7.6; 1.7.12;
1. {wctype,wctrans,mbstate}_t: switch MD to MI like other
libc implementation (such as *BSD and glibc2).

2. don't typedef void * wc{type,trans}_t, suggested by soda@-san.
it may pass through compiler type check, it's harmful.
so i introduce dummy struct __tag_wc{type,trans}_t(iconv_t already does).

no ABI change was made.
 1.6 03-Feb-2005  perry branches: 1.6.44;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.5 02-Mar-2003  tshiozak add some ISO C 1995 I18N functions and types:
btowc, wctrans, towctrans, wcscoll, wcsxfrm, wctype_t and wctrans_t.
 1.4 20-Jan-2001  itojun avoid exposure of libc internal symbols into public header (wctype.h).
 1.3 22-Dec-2000  itojun prototype decl for internal functions.
 1.2 21-Dec-2000  itojun have dummy wctype.h and isw*/tow*. part of libc minor 68 -> 69 crank.
equivalent to is*/to* at this moment. we'll put wchar_t code in the
near future.
 1.1 28-May-2000  minoura branches: 1.1.2;
file wctype.h was initially added on branch minoura-xpg4dl.
 1.1.2.1 28-May-2000  minoura Citrus Project XPG4DL, an implementation of I18N (locale) framework,
is imported.
 1.6.44.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.7.12.1 23-Jun-2013  tls resync from head
 1.7.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2 01-Apr-2008  drochner branches: 1.2.12;
everyone else assumes that defining "_XOPEN_SOURCE" means XPG4.2,
so remove comparisions against the numerical values "3" or "4"
 1.1 13-Jul-2004  seb Add wordexp(3). The wordexp function performs shell-style word expansions.
This implementation is wrapper around the undocumented wordexp sh(1)
built-in command.

From FreeBSD.
Provided in PR lib/26123.
Approved by kleink@.
 1.2.12.2 01-Apr-2008  drochner everyone else assumes that defining "_XOPEN_SOURCE" means XPG4.2,
so remove comparisions against the numerical values "3" or "4"
 1.2.12.1 01-Apr-2008  drochner file wordexp.h was added on branch christos-time_t on 2008-04-01 19:23:29 +0000
 1.7 12-Jan-2017  christos Welcome to the constant age!
 1.6 07-Aug-2003  agc branches: 1.6.84;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.5 10-Feb-1998  perry add/cleanup multiple inclusion protection.
 1.4 02-Feb-1998  perry merge lite-2
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6.84.1 20-Mar-2017  pgoyette Sync with HEAD
 1.24 21-Jun-2008  christos branches: 1.24.6;
sync with bind-9-5-0
 1.23 30-Mar-2007  ghen branches: 1.23.12; 1.23.14;
Resolve conflicts.
 1.22 27-Jan-2007  christos Merge back all our changes.
 1.21 03-Feb-2005  perry branches: 1.21.10; 1.21.12;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.20 07-Nov-2004  christos Resolve conflicts.
 1.19 21-May-2004  christos add 2 new functions from bind9
 1.18 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.17 30-Jun-2003  kleink Remove whitespace accident in previous; spotted by Thomas Klausner.
 1.16 30-Jun-2003  kleink Sprinkle some restrict.
 1.15 05-May-2003  bjh21 Fix the signatures of inet_addr(), inet_lnaof(), inet_makeaddr(), inet_netof(),
and inet_network() to match XNS and (where applicable) POSIX. This is largely
just the replacement of unsigned long with in_addr_t.

This constitutes a small ABI change on sh5, but scw (sh5 portmaster) thinks
that both the users of that port will be able to cope. kleink claims the
change is ABI-neutral on other LP64 ports, and it's a no-op on ILP32 ports.
Hence, I'm doing it this way and avoiding the whole __RENAME dance.
 1.14 29-Apr-2003  bjh21 Header file cleanup:
* Don't include <sys/param.h>
* Assume that NetBSD is a BSD system and hence has <sys/types.h>
* inet_pton() and inet_ntop() were in XNS 5.2 (not 5.0) and POSIX 2001.
Update #ifdefs accordingly.

XXX Types of inet_addr() and inet_makeaddr() are still wrong.
XXX Might want __restrict on inet_ntop() and inet_pton().
 1.13 28-Apr-2003  bjh21 Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.

This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.

I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.

Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
 1.12 14-May-2002  kleink branches: 1.12.2;
XNS5.2/POSIX-2001: change the size argument to inet_ntop from size_t to
socklen_t.
 1.11 26-Apr-2002  bjh21 Change RCS/SCCS IDs to our usual style.
 1.10 26-Apr-2002  bjh21 This header needs struct in_addr from <netinet/in.h>, so include that.
POSIX-2001 says exposing the contents of <netinet/in.h> here is OK.
 1.9 03-Jul-1999  kleink branches: 1.9.10;
Restrict function delcarations using XNS5.2 D2.0 as a reference.
 1.8 10-Feb-1998  perry add/cleanup multiple inclusion protection.
 1.7 13-Oct-1997  lukem rcsid fascism
 1.6 13-Apr-1997  mrg merge bind 4.9.5-P1.
 1.5 02-Feb-1996  mrg update these for bind 4.9.3-p1.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 07-Apr-1994  deraadt new resolver. changes from 4.9.2 by <paul@vix.com>, as well as a number
of features and optimizations by myself.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.7 12-Apr-2009  christos import libbind include files.
 1.1.1.6 30-Mar-2007  ghen Import bind 9.4.0.
 1.1.1.5 27-Jan-2007  christos import files from bind-9-4-0-rc2
 1.1.1.4 07-Nov-2004  christos Import again.
 1.1.1.3 02-Feb-1998  perry import lite-2
 1.1.1.2 13-Apr-1997  mrg BIND 4.9.5-P1 include bits
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.9.10.1 21-Jun-2002  nathanw Catch up to -current.
 1.12.2.1 27-Oct-2003  jmc Bring BIND up to 8.3.6 (requested by itojun in ticket #1536)
 1.21.12.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.21.10.1 17-May-2007  jdc Add missing BIND 9.4.x include file and library changes (requested by
tron in ticket #662).
 1.23.14.1 27-Jun-2008  simonb Sync with head.
 1.23.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.24.6.2 21-Jun-2008  christos sync with bind-9-5-0
 1.24.6.1 21-Jun-2008  christos file inet.h was added on branch christos-time_t on 2008-06-21 20:12:50 +0000
 1.29 15-Jul-2025  andvar Fix various typos in comments.
 1.28 23-May-2023  andvar branches: 1.28.2;
s/configuratin/configuration/ in comment, from Brad Harder (bch) by email.
 1.27 08-Dec-2021  andvar fix various typos in comments and log messages.
 1.26 10-Oct-2020  christos - remove bitypes.h fossil
- define u_{char,short,int,long} if we don't have _NETBSD_SOURCE defined
so that this compiles (and resolv.h since it includes this). This is
the simplest solution. Others:
- always define them (bad, pollutes namespace)
- create <sys/utypes.h> (bad, overkill)
- change them to unsigned {char, short, int long} (bad, too disruptive)
 1.25 12-Apr-2009  christos merge libbind
 1.24 11-Jan-2009  christos branches: 1.24.2;
merge christos-time_t
 1.23 21-Jun-2008  christos branches: 1.23.4; 1.23.6; 1.23.8; 1.23.12;
sync with bind-9-5-0
 1.22 30-Mar-2007  ghen branches: 1.22.12; 1.22.14;
Resolve conflicts.
 1.21 27-Jan-2007  christos Fix merge botch
 1.20 27-Jan-2007  christos Merge back all our changes.
 1.19 26-Dec-2005  perry branches: 1.19.4; 1.19.6;
u_intN_t -> uintN_t
 1.18 06-Feb-2005  perry remove obsolete register declarations.
 1.17 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.16 21-May-2004  christos resolve conflicts.
 1.15 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.14 09-Aug-2000  itojun implement EDNS0 support, as EDNS0 support will be made mandatory for
IPv6 transport-ready resolvers/DNS servers. need careful configuration
when enable it. (default config is not affected).
see manpage for details.

XXX visible symbol __res_opt() is added, however, it is not supposed to be
called from outside, libc minor is not bumped.
 1.13 13-Nov-1998  christos const poisoning
 1.12 19-Oct-1998  matt Add a defined(__vax__); plain vax is not good enough anymore.
 1.11 10-Feb-1998  perry add/cleanup multiple inclusion protection.
 1.10 13-Oct-1997  lukem rcsid fascism
 1.9 13-Apr-1997  mrg merge bind 4.9.5-P1.
 1.8 02-Feb-1996  mrg update these for bind 4.9.3-p1.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 15-Oct-1994  deraadt u_int_{16,32}_t stuff
 1.5 07-Apr-1994  deraadt new resolver. changes from 4.9.2 by <paul@vix.com>, as well as a number
of features and optimizations by myself.
 1.4 27-Oct-1993  mycroft Remove old endian cruft and #include machine/endian.h instead.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 18-Apr-1993  mycroft Define default byte order for i386.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.7 12-Apr-2009  christos import libbind include files.
 1.1.1.6 30-Mar-2007  ghen Import bind 9.4.0.
 1.1.1.5 27-Jan-2007  christos import files from bind-9-4-0-rc2
 1.1.1.4 21-May-2004  christos import new and changed files from bind9
 1.1.1.3 02-Feb-1998  perry import lite-2
 1.1.1.2 13-Apr-1997  mrg BIND 4.9.5-P1 include bits
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.19.6.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.19.4.2 23-Jan-2011  bouyer Apply patch, requested by spz in ticket 1413:
dist/bind/ patch
include/resolv.h patch
include/arpa/nameser.h: patch
lib/libc/include/isc/assertions.h: patch
lib/libc/include/isc/eventlib.h patch
lib/libc/isc/assertions.c: patch
lib/libc/nameser/ns_parse.c patch
lib/libc/resolv/herror.c: patch
lib/libc/resolv/res_init.c patch
lib/libc/resolv/res_mkquery.c: patch
lib/libc/resolv/res_query.c patch
lib/libc/resolv/res_send.c: patch
usr.sbin/bind/Makefile.inc patch
usr.sbin/bind/include/config.h: patch
usr.sbin/bind/include/dns/code.h: patch
usr.sbin/bind/include/dns/enumclass.h: patch
usr.sbin/bind/include/dns/enumtype.h: patch
usr.sbin/bind/include/dns/rdatastruct.h: patch
usr.sbin/bind/include/isc/platform.h: patch
usr.sbin/bind/include/lwres/netdb.h: patch
usr.sbin/bind/include/lwres/platform.h: patch
usr.sbin/bind/libisc/Makefile: patch
lib/libc/inet/inet_addr.c new file

Update bind to 9.4-ESV-R4, latest version of the 9.4 line.
 1.19.4.1 17-May-2007  jdc branches: 1.19.4.1.2;
Add missing BIND 9.4.x include file and library changes (requested by
tron in ticket #662).
 1.19.4.1.2.1 23-Jan-2011  bouyer Apply patch, requested by spz in ticket 1413:
dist/bind/ patch
include/resolv.h patch
include/arpa/nameser.h: patch
lib/libc/include/isc/assertions.h: patch
lib/libc/include/isc/eventlib.h patch
lib/libc/isc/assertions.c: patch
lib/libc/nameser/ns_parse.c patch
lib/libc/resolv/herror.c: patch
lib/libc/resolv/res_init.c patch
lib/libc/resolv/res_mkquery.c: patch
lib/libc/resolv/res_query.c patch
lib/libc/resolv/res_send.c: patch
usr.sbin/bind/Makefile.inc patch
usr.sbin/bind/include/config.h: patch
usr.sbin/bind/include/dns/code.h: patch
usr.sbin/bind/include/dns/enumclass.h: patch
usr.sbin/bind/include/dns/enumtype.h: patch
usr.sbin/bind/include/dns/rdatastruct.h: patch
usr.sbin/bind/include/isc/platform.h: patch
usr.sbin/bind/include/lwres/netdb.h: patch
usr.sbin/bind/include/lwres/platform.h: patch
usr.sbin/bind/libisc/Makefile: patch
lib/libc/inet/inet_addr.c new file

Update bind to 9.4-ESV-R4, latest version of the 9.4 line.
 1.22.14.1 27-Jun-2008  simonb Sync with head.
 1.22.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.23.12.1 09-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.23.8.1 10-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.23.6.2 08-Nov-2008  christos changes for 64 bit time_t
 1.23.6.1 21-Jun-2008  christos file nameser.h was added on branch christos-time_t on 2008-11-08 21:13:13 +0000
 1.23.4.1 06-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.24.2.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.28.2.1 02-Aug-2025  perseant Sync with HEAD
 1.10 05-Feb-2024  andvar fix various typos in comments.
 1.9 21-Apr-2022  gutteridge nameser_compat.h: simplify logic to determine byte order

There's really no need for all the complex #ifdefs present and, on top
of that, it didn't even work correctly for all NetBSD architectures.
Simply use endian.h and drop the rest. (Since there is no upstream for
this code anymore, there's no concern about complicating future merges,
either. This change is also consistent with what FreeBSD and OpenBSD
did years ago.)

Addresses PR toolchain/53880 (reported by maya@, originally encountered
by me on macppc when building a package that pulls in nameser_compat.h
before nameser.h by necessity -- necessity, that is, on another OS).
 1.8 18-Nov-2020  is Don't complain about additional DNAME records received when resolving A or
AAAA (like already done for SIG/KEY and CNAME).
 1.7 28-Jun-2020  gutteridge nameser_compat.h: correct preprocessor error syntax
 1.6 24-Feb-2015  christos branches: 1.6.8; 1.6.18;
belated removal of the advertising clause.
 1.5 12-Apr-2009  christos merge libbind
 1.4 21-Jun-2008  christos branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10; 1.4.14;
sync with bind-9-5-0
 1.3 30-Mar-2007  ghen branches: 1.3.12; 1.3.14;
Resolve conflicts.
 1.2 27-Jan-2007  christos Merge back all our changes.
 1.1 21-May-2004  christos branches: 1.1.1;
Initial revision
 1.1.1.5 12-Apr-2009  christos import libbind include files.
 1.1.1.4 30-Mar-2007  ghen Import bind 9.4.0.
 1.1.1.3 27-Jan-2007  christos import files from bind-9-4-0-rc2
 1.1.1.2 07-Nov-2004  christos branches: 1.1.1.2.10; 1.1.1.2.12;
Re-import these. I imported the old ones accidentally.
 1.1.1.1 21-May-2004  christos import new and changed files from bind9
 1.1.1.2.12.1 03-Jun-2007  wrstuden Catch up with now-somewhat-dated netbsd-4. These changes took longer
than expected for me to actually get around to merging.
 1.1.1.2.10.1 17-May-2007  jdc Add missing BIND 9.4.x include file and library changes (requested by
tron in ticket #662).
 1.3.14.1 27-Jun-2008  simonb Sync with head.
 1.3.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.4.14.1 09-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.4.10.1 10-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.4.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.4.6.2 21-Jun-2008  christos sync with bind-9-5-0
 1.4.6.1 21-Jun-2008  christos file nameser_compat.h was added on branch christos-time_t on 2008-06-21 20:12:50 +0000
 1.4.4.1 06-Jan-2011  riz Apply patches (requested by spz in ticket #1517):

Update bind to 9.7.2-P3.
 1.6.18.1 29-Nov-2020  martin Pull up following revision(s) (requested by is in ticket #1135):

lib/libc/net/getaddrinfo.c: revision 1.120
lib/libc/net/gethnamaddr.c: revision 1.93
include/arpa/nameser_compat.h: revision 1.8

Don't complain about additional DNAME records received when resolving A or
AAAA (like already done for SIG/KEY and CNAME).
 1.6.8.1 29-Nov-2020  martin Pull up following revision(s) (requested by is in ticket #1625):

lib/libc/net/getaddrinfo.c: revision 1.120
lib/libc/net/gethnamaddr.c: revision 1.93
include/arpa/nameser_compat.h: revision 1.8

Don't complain about additional DNAME records received when resolving A or
AAAA (like already done for SIG/KEY and CNAME).
 1.13 12-Jan-2017  christos Welcome to the constant age!
 1.12 24-Jan-2006  christos branches: 1.12.72;
PR/32615: Yves-Emmanuel JUTARD: Add missing telopts extern variable.
 1.11 19-Feb-2005  christos Add newer constants from FreeBSD and constify.
 1.10 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.9 11-Jun-2001  wiz Fix various misspellings of compatible/compatibility.
 1.8 24-Sep-1999  explorer branches: 1.8.8;
Merge a few constants from a different telnet.h file.
 1.7 10-Feb-1998  perry branches: 1.7.4;
add/cleanup multiple inclusion protection.
 1.6 02-Feb-1998  perry merge lite-2
 1.5 25-Mar-1997  perry added some missing SLC command codes (19 - 30) defined in RFC-1184
updated the NSLC #define to be 30
updated SLC_NAMELIST #define to include the new codes

mostly from Robin Carey <robin@mailgate.dtc.rankxerox.co.uk>
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 25-Feb-1994  cgd new telnet header
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7.4.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.8.1 08-Oct-2001  nathanw Catch up to -current.
 1.12.72.1 20-Mar-2017  pgoyette Sync with HEAD
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.7 11-Jun-2003  briggs Define the maximum segment size allowed under RFC 2348 (TFTP Blocksize Option)
Define the opcode for an option ACK and error code for a failed option
negotiation from RFC 2347 (TFTP Option Extension).
 1.6 18-Oct-2000  dogcow defs had 'short block' for blocksize; changed defs to be unsigned.
added note to tftpd.8 that this bug hits multiple tftp clients.
 1.5 10-Feb-1998  perry branches: 1.5.10;
add/cleanup multiple inclusion protection.
 1.4 02-Feb-1998  perry merge lite-2
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.5.10.2 09-Apr-2004  jmc Pullup version 1.7 for tftp/tftpd to work
 1.5.10.1 26-Feb-2001  he Pull up revision 1.6 (requested by he):
Use unsigned variables for block number, thus allowing transfer
of up to 32M files instead of 16M.
 1.20 19-Jun-2021  christos Add external attribute dumping and restoring support from FreeBSD.
Does not fully work yet, attributes are being saved and restored correctly,
but don't appear in the restored files somehow.
 1.19 05-Apr-2020  joerg Fix depenency on common symbols in sbin.
 1.18 22-Jan-2016  dholland branches: 1.18.16;
These all need stdint.h.

Also, dumprestore.h needs ufs/ufs/dinode.h; in talkd.h use unsigned
char instead of u_char; and in timed.h include limits.h and use
_POSIX_HOST_NAME_MAX instead of MAXHOSTNAMELEN as the latter would
require sys/param.h.
 1.17 16-Nov-2015  christos PR/50434: Louis Guillaume: Bump the in and out formats to 511 (NAME_MAX)
 1.16 11-Jan-2009  christos branches: 1.16.28;
merge christos-time_t
 1.15 26-Dec-2008  hannken Make restore work for Linux dump volumes by ignoring extended attribute
records on these volumes. Tested with Centos 5.2.

Reviewed by: Manuel Bouyer <bouyer@netbsd.org>
 1.14 26-Dec-2005  perry branches: 1.14.28; 1.14.30;
u_intN_t -> uintN_t
 1.13 06-Sep-2005  christos Change ino_t to u_int32_t for compatibility with the current dump/restore
format. Unfortunately this means that all dumps taken from the time of
the 64 bit inode changes (August 16th) will become unreadable with this
commit. To make them readable again, you can back-out this commit temporarily.
Please note, that I am not adding 64 bit inode support to the format on
purpose right now, because supporting 64 bit inodes on-disk will require
additional changes, and it is more appropriate to add such support then.
 1.12 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.11 02-Apr-2003  fvdl Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
 1.10 24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.9 23-Dec-2001  lukem Use "int32_t" instead of "time_t" for ``on tape'' times. (From FreeBSD.)
 1.8 10-Feb-1998  perry branches: 1.8.12;
add/cleanup multiple inclusion protection.
 1.7 30-Nov-1996  cgd patches from Tom I Helbekkmo <tih@nhh.no> to deal with type-size issues,
so this works (better, at least) on 64-bit machines (e.g. alpha).
 1.6 26-Oct-1994  cgd branches: 1.6.6;
new RCS ID format.
 1.5 15-Jun-1994  cgd kill some now-unnecessary defines
 1.4 16-May-1994  cgd update all but ctype.h, dumprestore.h, time.h to 4.4-Lite versions.
USL copyright additions on those. Kill varargs.h, because it can simply
be a link to the machine-dependent version.
 1.3 22-Dec-1993  cgd new version from CSRG, via BSDI, with fixes
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6.6.1 06-Dec-1996  rat Pullup request from Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>

>Make dump and restore usable on the alpha.
 1.8.12.2 28-Jan-2002  nathanw Catch up to -current.
 1.8.12.1 14-Jan-2002  nathanw Catch up to -current.
 1.14.30.1 28-Dec-2008  christos sync with head.
 1.14.28.1 02-Jan-2009  snj Pull up following revision(s) (requested by hannken in ticket #210):
include/protocols/dumprestore.h: revision 1.15
sbin/restore/tape.c: revision 1.61
Make restore work for Linux dump volumes by ignoring extended attribute
records on these volumes. Tested with Centos 5.2.
Reviewed by: Manuel Bouyer <bouyer@netbsd.org>
 1.16.28.1 26-Jan-2016  riz Pull up following revision(s) (requested by christos in ticket #1068):
include/protocols/dumprestore.h: revision 1.17
PR/50434: Louis Guillaume: Bump the in and out formats to 511 (NAME_MAX)
 1.18.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15 22-Jan-2016  dholland These all need stdint.h.

Also, dumprestore.h needs ufs/ufs/dinode.h; in talkd.h use unsigned
char instead of u_char; and in timed.h include limits.h and use
_POSIX_HOST_NAME_MAX instead of MAXHOSTNAMELEN as the latter would
require sys/param.h.
 1.14 26-Dec-2005  perry u_intN_t -> uintN_t
 1.13 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.12 30-Nov-2002  christos New auth length defines. We don't play with sockaddr for now. Also make
the list of commands const.
 1.11 10-Feb-1998  perry branches: 1.11.12;
add/cleanup multiple inclusion protection.
 1.10 03-Feb-1997  christos Apply the necessary fixes from: routed-970113
 1.9 04-Nov-1996  christos Fix RIP-V1 netinfo structure to be sizeof(sockaddr) + sizeof(u_int32_t) by
adding the missing RIP-V2 fields. This structure *must* always be the correct
size, otherwise programs that parse rip packets will break! (e.g.
tcpdump -s 1024 -vv broadcast would not parse rip packets correctly and
would fail after the first entry).
 1.8 20-Oct-1996  thorpej Add missing a_family member to struct netauth.
From David Carrel <carrel@ipsec.com>, PR #2872.
 1.7 24-Sep-1996  christos put back the explicit ripv1 field enumeration; lots of userland has changed
to use this.
 1.6 24-Sep-1996  christos - Revert to the traditional struct sockaddr description of the rip v1 packets.
- Fix a bad bug where:
u_int16_t n_dst;
should be:
u_int32_t n_dst;

If this bug is in the 1.2 release it should be part of the first patch.
 1.5 10-Aug-1996  thorpej Update from the new routed(8) source.
 1.4 20-Jun-1995  christos Update for rip version 2.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.11.12.1 10-Dec-2002  thorpej Sync with HEAD.
 1.8 22-Jan-2016  dholland These all need stdint.h.

Also, dumprestore.h needs ufs/ufs/dinode.h; in talkd.h use unsigned
char instead of u_char; and in timed.h include limits.h and use
_POSIX_HOST_NAME_MAX instead of MAXHOSTNAMELEN as the latter would
require sys/param.h.
 1.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.6 10-Feb-1998  perry add/cleanup multiple inclusion protection.
 1.5 02-Feb-1998  perry merge lite-2
 1.4 23-Sep-1996  mycroft {long,int} -> int32_t
 1.3 26-Oct-1994  cgd branches: 1.3.6;
new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.3.6.1 10-Dec-1996  mycroft From trunk:
Fix type size problems (for alpha).
 1.12 11-Jul-2025  andvar Fix various typos, mainly in comments and log/error messages.
 1.11 22-Jan-2016  dholland branches: 1.11.28;
These all need stdint.h.

Also, dumprestore.h needs ufs/ufs/dinode.h; in talkd.h use unsigned
char instead of u_char; and in timed.h include limits.h and use
_POSIX_HOST_NAME_MAX instead of MAXHOSTNAMELEN as the latter would
require sys/param.h.
 1.10 26-Dec-2005  perry u_intN_t -> uintN_t
 1.9 24-Sep-2005  christos rename osockaddr to talkd_sockaddr and use that instead.
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.7 10-Feb-1998  perry add/cleanup multiple inclusion protection.
 1.6 02-Feb-1998  perry merge lite-2
 1.5 04-Mar-1995  cgd oops; 'pid' is supposed to be signed (?)
 1.4 04-Mar-1995  cgd ship fixed-size quantities over the wire
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.11.28.1 02-Aug-2025  perseant Sync with HEAD
 1.13 22-Jan-2016  dholland Erm, fix previous.
(also, as this protocol is externally defined it probably should use its
own constant and not either of these system-defined hostname lengths...)
 1.12 22-Jan-2016  dholland These all need stdint.h.

Also, dumprestore.h needs ufs/ufs/dinode.h; in talkd.h use unsigned
char instead of u_char; and in timed.h include limits.h and use
_POSIX_HOST_NAME_MAX instead of MAXHOSTNAMELEN as the latter would
require sys/param.h.
 1.11 16-Feb-2008  matt Change/fix tsptype to const char * const [];
 1.10 26-Dec-2005  perry branches: 1.10.10;
u_intN_t -> uintN_t
 1.9 05-Jul-2005  he Add const to the tsptype array, compiled under TSPTYPES.
Found while building for vax.
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22270, verified by myself.
 1.7 10-Feb-1998  perry add/cleanup multiple inclusion protection.
 1.6 02-Feb-1998  perry merge lite-2
 1.5 09-Apr-1996  cgd time seconds/usec sent over the net are signed.
 1.4 06-Apr-1996  cgd use fixed-size types where appropriate, to make timed work on 64-bit
machines (Alpha). fixed sized types, not 'timeval's should go over
the net, and the stuff that goes over the net can't necessarily be
passed directly to functions that expect timevals.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2 02-Feb-1998  perry import lite-2
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.10.10.1 23-Mar-2008  matt sync with HEAD
 1.13 04-Jun-2019  hannken Move the basic part of XDR to common/include/rpc and common/lib/libc/rpc.

No functional change intended.
 1.12 11-Jan-2003  tron branches: 1.12.102;
Include "bsd.rpc.mk" before "bsd.prog.mk" to fix the "cleandir" target.
 1.11 05-Jan-2003  sommerfeld Use <bsd.rpc.mk>
 1.10 08-Nov-2002  fvdl Install rpc_com.h
 1.9 29-Jan-2002  tv branches: 1.9.2;
Cope with RPCGEN now conta8ining multiple words.
 1.8 01-Nov-2001  tv Be smarter about finding rpcgen's absolute path; only do it if ${RPCGEN}
(when evaluated) does not start with a /. Also don't go through a make(1)
recursion step; just use !=.
 1.7 31-Oct-2001  tv No need to do the tricky XRPCGEN dance.
 1.6 21-Mar-2001  mycroft Use `rpcgen -C'.
 1.5 16-Jan-2001  cgd branches: 1.5.2;
use expr to do subtraction. shell math isn't as portable.
 1.4 07-Jan-2001  enami Sync with lib/librpcsvc/Makefile; Pass -B ${MAKEFLAGS} to submake.
 1.3 10-Sep-2000  erh Make targets which are generated with rpcgen depend on the rpcgen binary.
 1.2 25-Jul-2000  cgd ${RPCGEN}, not hard-coded rpcgen
 1.1 03-Jun-2000  fvdl branches: 1.1.4;
Use a seperate Makefile in the rpc/ subdir. Needed because it generates
a file (rpcb_prot.h).
 1.1.4.2 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 03-Jun-2000  minoura file Makefile was added on branch minoura-xpg4dl on 2000-06-23 15:46:04 +0000
 1.5.2.8 17-Jan-2003  thorpej Sync with HEAD.
 1.5.2.7 06-Jan-2003  thorpej Sync with HEAD.
 1.5.2.6 11-Nov-2002  nathanw Catch up to -current
 1.5.2.5 22-Mar-2002  nathanw Catch up to -current.
 1.5.2.4 11-Mar-2002  nathanw Catch up to -current.
 1.5.2.3 23-Feb-2002  gmcgarry Merge-up from -current
 1.5.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.1 08-Apr-2001  nathanw Merge trunk onto branch.
 1.9.2.1 06-Jan-2003  jmc Pull up revisions 1.9-1.10 (requested by fvdl in ticket #1037)
Install rpc_com.h
 1.12.102.1 10-Jun-2019  christos Sync with HEAD
 1.20 03-Oct-2020  christos add set_rpc_maxgrouplist(3)
 1.19 23-Jan-2016  dholland unsigned -> unsigned int in previous change to accomodate C++ boneheadedness.
 1.18 23-Jan-2016  dholland u_int -> unsigned, u_long -> unsigned long, etc.
 1.17 26-Dec-2005  perry u_intN_t -> uintN_t
 1.16 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.15 02-Jun-2000  fvdl New headers for the new RPC code (based on TI-RPC from Sun).
 1.14 16-Nov-1998  christos branches: 1.14.8;
delint
 1.13 26-Jul-1998  mycroft const poisoning.
 1.12 11-Feb-1998  lukem revert to 1.9; we can't break the existing ABI and API
 1.11 11-Feb-1998  lukem use u_int32_t instead of size_t for oa_length
 1.10 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.9 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.8 13-Jul-1997  christos Add missing authentication prototypes _svcauth_{null,short,unix} and
xdr_opaque_auth
 1.7 29-Apr-1995  cgd change some of the rpc "on-the-wire" structures' fields to be explicitly-sized
types. add xdr_{,u_}int{16,32}_t() functions to convert them.
This is necessary, because things like BPF use the RPC headers to look
at the on-the-wire data, so the headers must accurately represent
what's on the wire, too.
 1.6 04-Dec-1994  cgd be much more careful with types, and add prototype everything.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 07-Dec-1993  deraadt delete bogus #if
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.14.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10 23-Jan-2016  dholland unsigned -> unsigned int in previous change to accomodate C++ boneheadedness.
 1.9 23-Jan-2016  dholland u_int -> unsigned, u_long -> unsigned long, etc.
 1.8 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.7 11-Feb-1998  lukem revert to 1.5; we can't break the existing ABI and API
 1.6 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.5 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.24 23-Jan-2016  dholland unsigned -> unsigned int in previous change to accomodate C++ boneheadedness.
 1.23 23-Jan-2016  dholland u_int -> unsigned, u_long -> unsigned long, etc.
 1.22 06-Jun-2014  christos Always use the reentrant rpc_createerr. Otherwise every threaded program
that uses rpc needs to define _REENTRANT to work properly. We'll keep
compatibility but setting the old variable in the library, but we are not
advertising it anymore.
 1.21 30-Aug-2011  plunky branches: 1.21.8; 1.21.18;
Apply casts to cases where xdrproc_t is expected but is not
strictly passed, for example because the second argument is
a different kind of pointer.
 1.20 03-Dec-2005  yamt - constify and remove __UNCONST from caller of clnt_call().
- use __UNCONST where approproate.
 1.19 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.18 28-Jan-2003  wiz unknown, not unkown. Noted by mjl.
 1.17 08-Nov-2002  fvdl Include rpc_com.h.
 1.16 19-Jun-2001  wiz branches: 1.16.2;
`accessible' only has one `a'.
 1.15 13-Feb-2001  cgd branches: 1.15.2;
change 'char *' args of clnt_pcreateerror, clnt_spcreateerror,
clnt_perror, and clnt_sperror to 'const char *' to follow manual
pages (!!).
 1.14 02-Jun-2000  fvdl New headers for the new RPC code (based on TI-RPC from Sun).
 1.13 16-Nov-1998  christos branches: 1.13.8;
delint
 1.12 26-Jul-1998  mycroft const poisoning.
 1.11 13-Feb-1998  lukem minor typo and grammar fixes
 1.10 11-Feb-1998  lukem revert to 1.7; we can't break the existing ABI and API
 1.9 11-Feb-1998  lukem fix up type insanity for clntudp_create (thanks to thorpej who found this)
 1.8 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.7 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.6 29-Apr-1995  cgd change some of the rpc "on-the-wire" structures' fields to be explicitly-sized
types. add xdr_{,u_}int{16,32}_t() functions to convert them.
This is necessary, because things like BPF use the RPC headers to look
at the on-the-wire data, so the headers must accurately represent
what's on the wire, too.
 1.5 04-Dec-1994  cgd be much more careful with types, and add prototype everything.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.13.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15.2.2 11-Nov-2002  nathanw Catch up to -current
 1.15.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.16.2.1 06-Jan-2003  jmc Pull up revisions 1.16-1.17 (requested by fvdl in ticket #1037)
Include rpc_com.h.
 1.21.18.1 10-Aug-2014  tls Rebase.
 1.21.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5 23-Jan-2016  dholland unsigned -> unsigned int in previous change to accomodate C++ boneheadedness.
 1.4 23-Jan-2016  dholland u_int -> unsigned, u_long -> unsigned long, etc.
 1.3 06-Feb-2005  perry Remove "register" from a comment. Kind of silly for it to have been
listed as a parameter for a function anyway...
 1.2 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.1 02-Jun-2000  fvdl branches: 1.1.4;
New headers for the new RPC code (based on TI-RPC from Sun).
 1.1.4.2 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 02-Jun-2000  minoura file clnt_soc.h was added on branch minoura-xpg4dl on 2000-06-23 15:46:05 +0000
 1.3 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.2 06-Jul-2000  christos const poisoning.
 1.1 02-Jun-2000  fvdl branches: 1.1.4;
New headers for the new RPC code (based on TI-RPC from Sun).
 1.1.4.2 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 02-Jun-2000  minoura file nettype.h was added on branch minoura-xpg4dl on 2000-06-23 15:46:05 +0000
 1.13 23-Jan-2016  dholland unsigned -> unsigned int in previous change to accomodate C++ boneheadedness.
 1.12 23-Jan-2016  dholland u_int -> unsigned, u_long -> unsigned long, etc.
 1.11 11-Jan-2009  christos merge christos-time_t
 1.10 03-Feb-2005  perry branches: 1.10.36;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.9 02-Jun-2000  fvdl New headers for the new RPC code (based on TI-RPC from Sun).
 1.8 11-Feb-1998  lukem branches: 1.8.8;
revert to 1.6; we can't break the existing ABI and API
 1.7 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.6 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.5 04-Dec-1994  cgd be much more careful with types, and add prototype everything.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.8.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10.36.1 08-Nov-2008  christos changes for 64 bit time_t
 1.9 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.8 02-Jun-2000  fvdl New headers for the new RPC code (based on TI-RPC from Sun).
 1.7 11-Feb-1998  lukem branches: 1.7.8;
revert; we can't break the existing ABI and API
 1.6 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.5 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.7.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9 03-Dec-2005  yamt - constify and remove __UNCONST from caller of clnt_call().
- use __UNCONST where approproate.
 1.8 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.7 11-Feb-1998  lukem revert; we can't break the existing ABI and API
 1.6 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.5 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.1 02-Jun-2000  fvdl branches: 1.1.4;
New headers for the new RPC code (based on TI-RPC from Sun).
 1.1.4.2 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 02-Jun-2000  minoura file raw.h was added on branch minoura-xpg4dl on 2000-06-23 15:46:05 +0000
 1.16 23-Jan-2016  dholland u_int -> unsigned, u_long -> unsigned long, etc.
 1.15 22-Jun-2006  christos Centralize the TCP_NODELAY handling as discussed in tech-net.
 1.14 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.13 02-Jun-2000  fvdl New headers for the new RPC code (based on TI-RPC from Sun).
 1.12 26-Jan-2000  itojun branches: 1.12.2;
implement bindresvport_sa(), which is necessary for IPv6 support in certain
programs (like rshd or rlogind).

bindresvport() and bindresvport_sa() exhibits exactly the same functionality,
with different function prototype (sockaddr_in * and sockaddr *).

The behavior and prototype was discussed and agreed among shin@kame.net
(who is doing freebsd-current kame merge), deraadt@openbsd.org, and
Jean-Luc.Richier@imag.fr (INRIA IPv6/IPv6 RPC support). so it will be
portable across *bsd.
 1.11 11-Feb-1998  lukem revert; we can't break the existing ABI and API
 1.10 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.9 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.8 25-Aug-1997  lukem don't include <rpc/pmap_rmt.h> - it's a "private" header file for
portmap. fixes [bin/4036] by Thorsten Frueauf <frueauf@ira.uka.de>
 1.7 24-Aug-1997  lukem Include <rpc/pmap_clnt.h>, <rpc/pmap_prot.h> and <rpc/pmap_rmt.h>.
The rpc man pages don't mention that these are required (only
<rpc/rpc.h> is mentioned there), but some of the prototypes come from
these files...
 1.6 13-Jul-1997  christos Add missing prototypes for: get_myaddress, bindresvport, registerrpc,
callrpc, getrpcport
 1.5 04-Dec-1994  cgd from Christos: kill nested comments, add a declaration.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.12.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.2 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.1 08-Nov-2002  fvdl branches: 1.1.2; 1.1.4;
Moved here from libc/rpc. Install this in /usr/include/rpc, just
like on Solaris. This wasn't done before, since it only contained
internal libc interfaces. These have been moved to rpc_internal.h,
and this file now contains some actual exported definitions.
 1.1.4.2 08-Nov-2002  fvdl Moved here from libc/rpc. Install this in /usr/include/rpc, just
like on Solaris. This wasn't done before, since it only contained
internal libc interfaces. These have been moved to rpc_internal.h,
and this file now contains some actual exported definitions.
 1.1.4.1 08-Nov-2002  fvdl file rpc_com.h was added on branch netbsd-1-6 on 2002-11-08 00:08:21 +0000
 1.1.2.2 11-Nov-2002  nathanw Catch up to -current
 1.1.2.1 08-Nov-2002  nathanw file rpc_com.h was added on branch nathanw_sa on 2002-11-11 22:24:29 +0000
 1.15 25-Feb-2006  wiz Fix typos, reported by Alexey Dobriyan ("Gathered from Linux"),
forwarded by jmc@openbsd.
 1.14 26-Dec-2005  perry u_intN_t -> uintN_t
 1.13 03-Dec-2005  yamt - constify and remove __UNCONST from caller of clnt_call().
- use __UNCONST where approproate.
 1.12 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.11 02-Jun-2000  fvdl New headers for the new RPC code (based on TI-RPC from Sun).
 1.10 13-Feb-1998  lukem branches: 1.10.8;
minor typo and grammar fixes
 1.9 11-Feb-1998  lukem revert; we can't break the existing ABI and API
 1.8 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.7 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.6 13-Jul-1997  christos Add missing prototypes for xdr_{accepted,rejected}_reply
 1.5 29-Apr-1995  cgd change some of the rpc "on-the-wire" structures' fields to be explicitly-sized
types. add xdr_{,u_}int{16,32}_t() functions to convert them.
This is necessary, because things like BPF use the RPC headers to look
at the on-the-wire data, so the headers must accurately represent
what's on the wire, too.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.10.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4 11-Jan-2009  christos merge christos-time_t
 1.3 03-Dec-2005  yamt branches: 1.3.30;
- constify and remove __UNCONST from caller of clnt_call().
- use __UNCONST where approproate.
 1.2 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.1 02-Jun-2000  fvdl branches: 1.1.4;
New headers for the new RPC code (based on TI-RPC from Sun).
 1.1.4.2 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 02-Jun-2000  minoura file rpcb_clnt.h was added on branch minoura-xpg4dl on 2000-06-23 15:46:05 +0000
 1.3.30.1 08-Nov-2008  christos changes for 64 bit time_t
 1.6 23-Jan-2016  dholland unsigned -> unsigned int in previous change to accomodate C++ boneheadedness.
 1.5 23-Jan-2016  dholland u_int -> unsigned, u_long -> unsigned long, etc.
 1.4 03-Dec-2005  yamt - constify and remove __UNCONST from caller of clnt_call().
- use __UNCONST where approproate.
 1.3 25-Feb-2002  simonb Put token after #endif in comments (from Broadcom).
Fix some small tyops in two comments.
 1.2 04-Aug-2001  mrg #ifdef __STDC__ -> #if __STDC__.
 1.1 03-Jun-2000  fvdl branches: 1.1.2; 1.1.4; 1.1.6;
Move rpcb_prot.x to here from libc/rpc.
 1.1.6.2 11-Mar-2002  nathanw Catch up to -current.
 1.1.6.1 08-Oct-2001  nathanw Catch up to -current.
 1.1.4.2 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 03-Jun-2000  minoura file rpcb_prot.x was added on branch minoura-xpg4dl on 2000-06-23 15:46:05 +0000
 1.1.2.1 11-Apr-2002  he Pull up revisions 1.2-1.3 (requested by wiz):
Change one #ifdef to #if, put token after #endif in comment, and
two minor typo fixes.
 1.3 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.2 16-Aug-2004  ginsbach * add const qualifier making getrpcbyname() and getrpcbyname_r()
prototypes match those used in latest Sun RPC code (TI-RPC 2.3)
* modify function getrpcbyname() definition as appropriate
 1.1 02-Jun-2000  fvdl branches: 1.1.4;
New headers for the new RPC code (based on TI-RPC from Sun).
 1.1.4.2 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 02-Jun-2000  minoura file rpcent.h was added on branch minoura-xpg4dl on 2000-06-23 15:46:05 +0000
 1.33 28-May-2022  andvar fix various typos in comments, mainly origional->original,
extened->extended, incomming->incoming.
 1.32 23-Jan-2016  dholland Needs sys/select.h for fd_set; fails only when _POSIX_SOURCE is defined,
because then something else doesn't include it. (I guess.)
 1.31 23-Jan-2016  dholland unsigned -> unsigned int in previous change to accomodate C++ boneheadedness.
 1.30 23-Jan-2016  dholland u_int -> unsigned, u_long -> unsigned long, etc.
 1.29 07-Nov-2015  christos provide a poll(2) based interface.
 1.28 07-Nov-2015  christos Put back NULL tests for allocation failures.
 1.27 06-Nov-2015  christos Switch to the size-unlimited fd_set. Some code will need to change to be
able to use this if the code allocates its own fd_set's.
 1.26 06-Nov-2015  christos - provide accessor functions for the fdset's used internally.
- add getreqset2 method that takes a setsize.
 1.25 04-Mar-2013  christos PR/47617: Thorsten Brehm: Memory and socket leak in librpc
 1.24 30-Aug-2011  plunky branches: 1.24.2; 1.24.8;
Apply casts to cases where xdrproc_t is expected but is not
strictly passed, for example because the second argument is
a different kind of pointer.
 1.23 26-Dec-2005  perry u_intN_t -> uintN_t
 1.22 03-Dec-2005  yamt - constify and remove __UNCONST from caller of clnt_call().
- use __UNCONST where approproate.
 1.21 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.20 08-Nov-2002  fvdl include rpc_com.h, and define SVC{GET,SET}_CONNMAXREC
 1.19 25-Feb-2002  simonb branches: 1.19.2;
Make it obvious in comments that dispatch takes some arguments (from
Broadcom).
Fix some white space nits.
 1.18 19-Jun-2001  wiz `existent', not `existant'
 1.17 02-Jun-2000  fvdl branches: 1.17.4;
New headers for the new RPC code (based on TI-RPC from Sun).
 1.16 31-Jan-1999  christos branches: 1.16.8;
Fully prototype the test service and put it between begin and end decls.
 1.15 16-Nov-1998  christos delint
 1.14 26-Jul-1998  mycroft const poisoning.
 1.13 11-Feb-1998  lukem revert; we can't break the existing ABI and API
 1.12 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.11 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.10 13-Jul-1997  christos Add missing prototype for svcudp_enablecache
 1.9 29-Apr-1995  cgd change some of the rpc "on-the-wire" structures' fields to be explicitly-sized
types. add xdr_{,u_}int{16,32}_t() functions to convert them.
This is necessary, because things like BPF use the RPC headers to look
at the on-the-wire data, so the headers must accurately represent
what's on the wire, too.
 1.8 06-Jan-1995  pk Unhide `svc_maxfd'. Why do we bother with `#if FD_SETSIZE' anyway?
 1.7 04-Jan-1995  mycroft Add svc_maxfd.
 1.6 04-Dec-1994  cgd from Christos: kill nested comments, add a declaration.
 1.5 04-Dec-1994  cgd be much more careful with types, and add prototype everything.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.16.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.17.4.4 11-Nov-2002  nathanw Catch up to -current
 1.17.4.3 22-Mar-2002  nathanw Catch up to -current.
 1.17.4.2 11-Mar-2002  nathanw Catch up to -current.
 1.17.4.1 08-Oct-2001  nathanw Catch up to -current.
 1.19.2.1 06-Jan-2003  jmc Pull up revisions 1.19-1.20 (requested by fvdl in ticket #1037)
include rpc_com.h, and define SVC{GET,SET}_CONNMAXREC
 1.24.8.1 23-Jun-2013  tls resync from head
 1.24.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.8 02-Jun-2000  fvdl New headers for the new RPC code (based on TI-RPC from Sun).
 1.7 11-Feb-1998  lukem branches: 1.7.8;
revert; we can't break the existing ABI and API
 1.6 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.5 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.7.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4 23-Jan-2016  dholland unsigned -> unsigned int in previous change to accomodate C++ boneheadedness.
 1.3 23-Jan-2016  dholland u_int -> unsigned, u_long -> unsigned long, etc.
 1.2 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.1 02-Jun-2000  fvdl branches: 1.1.4;
New headers for the new RPC code (based on TI-RPC from Sun).
 1.1.4.2 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.4.1 02-Jun-2000  minoura file svc_soc.h was added on branch minoura-xpg4dl on 2000-06-23 15:46:05 +0000
 1.16 04-Jun-2019  hannken Move the basic part of XDR to common/include/rpc and common/lib/libc/rpc.

No functional change intended.
 1.15 26-Dec-2005  perry branches: 1.15.90;
u_intN_t -> uintN_t
 1.14 30-Dec-2004  christos cast 1 to size_t
 1.13 13-Jun-2000  thorpej Make the RPC mem_alloc() macro use calloc() to prevent RPC from
using only partially-initialized data structures.
 1.12 02-Jun-2000  fvdl New headers for the new RPC code (based on TI-RPC from Sun).
 1.11 11-Feb-1998  lukem branches: 1.11.8;
revert; we can't break the existing ABI and API
 1.10 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.9 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.8 29-Apr-1995  cgd change some of the rpc "on-the-wire" structures' fields to be explicitly-sized
types. add xdr_{,u_}int{16,32}_t() functions to convert them.
This is necessary, because things like BPF use the RPC headers to look
at the on-the-wire data, so the headers must accurately represent
what's on the wire, too.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 06-Dec-1993  cgd remove INADDR_LOOPBACK; it's defined in netinet/in.h now
 1.5 01-Aug-1993  mycroft Add RCS identifiers.
 1.4 15-Jun-1993  deraadt ugh. INADDR_LOOPBACK needs to be here.
cgd suggests there might be dragons here...
 1.3 14-Jun-1993  deraadt removed stuff which should not be here.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.11.8.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.15.90.1 10-Jun-2019  christos Sync with HEAD
 1.32 04-Jun-2019  hannken Move the basic part of XDR to common/include/rpc and common/lib/libc/rpc.

No functional change intended.
 1.31 04-Jun-2019  hannken Implement xdrmem_control(), used as xdr_control(xdr, XDR_GET_BYTES_AVAIL ...
and bump libc minor number.

Final goal is to remove the unmaintained XDR implementation
at external/cddl/osnet/dist/uts/common/rpc.
 1.30 16-Aug-2017  christos branches: 1.30.4;
s/not sure why// and make these work :-)
 1.29 23-Jan-2016  dholland unsigned -> unsigned int in previous change to accomodate C++ boneheadedness.
 1.28 23-Jan-2016  dholland u_int -> unsigned, u_long -> unsigned long, etc.
 1.27 30-Aug-2011  plunky provide a complete prototype for xdrproc_t

(I found no instances where three arguments were actually
used, as per the claim in the comment. If there are any
in third party code then they will need to use a cast)
 1.26 04-Jul-2011  manu Import xdr_sizeof() from FreeBSD
 1.25 28-Dec-2005  yamt put back inline to __inline, as it's a user-visible header.
 1.24 26-Dec-2005  perry u_intN_t -> uintN_t
 1.23 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.22 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.21 19-Apr-2003  christos don't use TRUE or FALSE
 1.20 19-Mar-2003  christos x_handy is currently used only by xdr_mem and contains the number of bytes
left. make it unsigned.
 1.19 17-Jul-2000  matt branches: 1.19.4;
Add some missing ints
 1.18 14-Jul-2000  fvdl Add explicit int32 get/put macros (and 2 inline functions), as in Solaris.
Needed to get things right on 64bit big-endian systems.
 1.17 02-Jun-2000  fvdl branches: 1.17.2;
New headers for the new RPC code (based on TI-RPC from Sun).
 1.16 01-Dec-1999  thorpej branches: 1.16.2;
Implement XDR routines for 64-bit integer data types:
- xdr_int64_t(), xdr_u_int64_t(), per NetBSD convention.
- xdr_hyper(), xdr_u_hyper(), xdr_longlong_t(), xdr_u_longlong_t(), a'la
Solaris, implemented in terms of the above.
 1.15 16-Nov-1998  christos branches: 1.15.6;
delint
 1.14 26-Jul-1998  mycroft Oops; that wasn't quite right.
 1.13 26-Jul-1998  mycroft const poisoning.
 1.12 26-Jul-1998  mycroft const poisoning.
 1.11 26-Jul-1998  mycroft const poisoning.
 1.10 11-Feb-1998  lukem revert; we can't break the existing ABI and API
 1.9 10-Feb-1998  lukem major cleanup
* use int32_t instead of long
* use size_t instead of u_int as appropriate
* use in_port_t instead of u_short as appropriate
* KNF, cleanup typos and spellos in comments
* deprecate svc_fds; it's obselete and not supported in libc/rpc anyway
 1.8 10-Feb-1998  perry cleanup multiple inclusion protection.
 1.7 29-Apr-1995  cgd change some of the rpc "on-the-wire" structures' fields to be explicitly-sized
types. add xdr_{,u_}int{16,32}_t() functions to convert them.
This is necessary, because things like BPF use the RPC headers to look
at the on-the-wire data, so the headers must accurately represent
what's on the wire, too.
 1.6 04-Dec-1994  cgd be much more careful with types, and add prototype everything.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 09-Aug-1994  jtc Fix prototype for xdr_u_char() (PR #364)
 1.3 01-Aug-1993  mycroft branches: 1.3.2;
Add RCS identifiers.
 1.2 09-Jun-1993  brezak Changes from:
conklin@talisman.kaleida.com

* use consistant macro names for multiple #include protection
of header files. I used the same convention used by TIRPC.

* added function prototypes to header files.

* fixed C source where it conflicted with prototypes, documentation,
and TIRPC.
 1.1 03-May-1993  deraadt rpc include files moved into /usr/src/include. Makes more sense and
lets YP and libc compile cleanly.
 1.3.2.1 13-Aug-1994  mycroft update from trunk
 1.15.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.16.2.1 23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.17.2.3 27-Mar-2003  msaitoh Pull up revisions 1.20 (requested by David Maxwell in ticket #36):

x_handy is currently used only by xdr_mem and contains the number of
bytes
left. make it unsigned.
 1.17.2.2 18-Jul-2000  matt Add missing int to untyped static __inline__ xdr_{get,put}int32
 1.17.2.1 14-Jul-2000  fvdl From trunk: add explicit int32 put/get macros (or inline functions).
 1.19.4.1 21-Mar-2003  tron Pull up revision 1.20 (requested by david in ticket #1224):
x_handy is currently used only by xdr_mem and contains the number of
bytes
left. make it unsigned.
 1.30.4.1 10-Jun-2019  christos Sync with HEAD
 1.11 08-Oct-1993  mycroft Clean up deleted files.
 1.10 01-Oct-1993  jtc Use `:', rather than `.' to separate user and group in chown commands
in case we ever decide to remove the support for the (obsolete) `.'
separator.
 1.9 01-Aug-1993  mycroft Add RCS identifiers.
 1.8 18-Jul-1993  mycroft Use ${COPY}, not -c for install.
 1.7 07-Jun-1993  deraadt install incluide files mode 644
 1.6 03-Jun-1993  brezak rquota.h was repeated.
 1.5 06-May-1993  proven ftp put doesn't cleanly truncate and overwrite a file.
 1.4 06-May-1993  proven Fixed dependency problem.
 1.3 05-May-1993  proven Set permissions and ownership all at once. (No more directories mode 0777)
 1.2 26-Apr-1993  deraadt Allow include/rpcsvc to have .h files that are not generated from .x files
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.5 08-Oct-1993  mycroft Clean up deleted files.
 1.4 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.3 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.6 08-Oct-1993  mycroft Clean up deleted files.
 1.5 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.4 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 03-Jun-1993  brezak Put protocol definition at end so it compiles.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.5 08-Oct-1993  mycroft Clean up deleted files.
 1.4 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.3 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.5 08-Oct-1993  mycroft Clean up deleted files.
 1.4 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.3 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.5 01-Mar-1995  mycroft Clean up deleted files.
 1.4 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.3 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.5 01-Mar-1995  mycroft Clean up deleted files.
 1.4 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.3 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.6 01-Mar-1995  mycroft Clean up deleted files.
 1.5 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.4 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 02-Jun-1993  brezak Reverse the versions of the call.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.5 01-Mar-1995  mycroft Clean up deleted files.
 1.4 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.3 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.5 01-Mar-1995  mycroft Clean up deleted files.
 1.4 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.3 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.4 01-Mar-1995  mycroft Clean up deleted files.
 1.3 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.2 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.1 04-Apr-1993  cgd rwall RPC definition. original, by cgd, but numbers gleaned
from headers+portmap on other machines.
 1.5 01-Mar-1995  mycroft Clean up deleted files.
 1.4 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.3 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.5 01-Mar-1995  mycroft Clean up deleted files.
 1.4 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.3 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.5 01-Mar-1995  mycroft Clean up deleted files.
 1.4 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.3 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.2 01-Aug-1993  mycroft Add RCS identifiers.
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.22 30-May-2024  msaitoh Fix previous comment fix.

It seems that the work "yppush" was not duplicated.
It was two sentences without period. To make it clear,
add a colon and a newline. Found by rillig@.
 1.21 12-May-2024  msaitoh Remove duplicated yppush.
 1.20 02-Apr-2020  msaitoh s/impliment/implement/ in comment.
 1.19 22-Jan-2016  dholland branches: 1.19.16;
Include <rpc/rpc.h> so XDR is defined.
 1.18 23-Jan-2013  mbalmer Fix typo.
 1.17 06-Oct-2007  yamt branches: 1.17.34; 1.17.40;
kill another definition of bool.
 1.16 24-Apr-2006  snj branches: 1.16.10;
It's "its."
 1.15 26-Dec-2005  perry u_intN_t -> uintN_t
 1.14 03-Feb-2005  perry de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.13 10-Dec-2003  agc Modify the licences of code written by Theo De Raadt from a 4-clause
to a 2-clause licence (retaining UCB clauses (1) and (2)), per PR
22409 from Joel Baker, approved by Theo de Raadt, and ratified by
myself - the only discrepancy being the handling of the original
clause 3 in src/usr.sbin/yppoll/yppoll.c.
 1.12 27-Jul-1998  mycroft YP status codes are all unsigned.
 1.11 11-Feb-1998  lukem revert; we can't break the existing ABI and API
 1.10 10-Feb-1998  lukem cleanup type usage
 1.9 13-Jul-1997  christos Add prototypes for obsolete: xdr_{domainname,peername,mapname} and mark them
as such.
 1.8 09-Aug-1996  thorpej Fix some potential type-size problems.
 1.7 29-May-1996  thorpej Pull down yp/xdr fixes from release branch.
 1.6 14-Jul-1995  christos branches: 1.6.6;
- Const poisoning
- Fix prototypes
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 25-May-1994  deraadt correct copyright
 1.3 02-Aug-1993  mycroft Add RCS identifiers, remove some completely useless RCS logs and patchkit
headers, and a few other insignificant changes.
 1.2 24-Jul-1993  deraadt rewrote sun-copyrighted header files
 1.1 20-Apr-1993  deraadt branches: 1.1.2;
Added two include files for YP
 1.1.2.1 27-Jul-1993  cgd changes from theo that are in the main tree that must go in for 0.9.
 1.6.6.2 20-Feb-1997  thorpej Pull up tip-of-the-trunk; fix potential type-size problems.
 1.6.6.1 26-May-1996  jtc yp/xdr fixes from Jason Thorpe
 1.16.10.1 06-Nov-2007  matt sync with HEAD
 1.17.40.1 25-Feb-2013  tls resync with head
 1.17.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.19.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15 22-Jan-2016  dholland Uses BEGIN_DECLS and needs sys/cdefs.h.
 1.14 02-Mar-2012  christos PR/46111: Wolfgang Stukenbrock: Add yp_setbindtries(3) so that yp operations
don't hang forever if requested.
 1.13 03-Feb-2005  perry branches: 1.13.54;
de-__P -- the hack is long since useless. Discussed with christos,
matt, kleink, others. Approved by christos.
 1.12 10-Dec-2003  agc Modify the licences of code written by Theo De Raadt from a 4-clause
to a 2-clause licence (retaining UCB clauses (1) and (2)), per PR
22409 from Joel Baker, approved by Theo de Raadt, and ratified by
myself - the only discrepancy being the handling of the original
clause 3 in src/usr.sbin/yppoll/yppoll.c.
 1.11 11-Feb-1998  lukem revert; we can't break the existing ABI and API
 1.10 10-Feb-1998  lukem cleanup type usage
 1.9 18-Jul-1997  thorpej Correct the prototype of the (*foreach)() member of the yp_all callback.
 1.8 13-Jul-1997  christos Add missing prototypes for _yp_check and yp_maplist
 1.7 14-Jul-1995  christos - Const poisoning
- Fix prototypes
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 25-May-1994  deraadt correct copyright
 1.4 06-Jan-1994  deraadt forward decl of dom_binding for proto
 1.3 02-Aug-1993  mycroft Add RCS identifiers, remove some completely useless RCS logs and patchkit
headers, and a few other insignificant changes.
 1.2 24-Jul-1993  deraadt rewrote sun-copyrighted header files
 1.1 20-Apr-1993  deraadt branches: 1.1.2;
Added two include files for YP
 1.1.2.1 27-Jul-1993  cgd changes from theo that are in the main tree that must go in for 0.9.
 1.13.54.1 17-Apr-2012  yamt sync with head
 1.6 01-Mar-1995  mycroft Clean up deleted files.
 1.5 03-Aug-1993  mycroft Oops. Don't include the rcsid strings in generated .h files.
 1.4 03-Aug-1993  mycroft Make RCS id stuff compatible with stupid rpcgen.
 1.3 01-Aug-1993  mycroft Add RCS identifiers.
 1.2 26-Apr-1993  deraadt this file used to try to generate a "struct passwd". Nope, won't work..
 1.1 04-Apr-1993  cgd from SUNRPC 4.0
 1.16 15-Nov-2023  christos Allow __ssp_inline to be overriden
 1.15 10-Nov-2023  christos PR/57689: RVP: getcwd() not overridable with -D_FORTIFY_SOURCE
 1.14 29-Mar-2023  christos PR/57288: Mingye Wang: <ssp/ssp.h>: Use __builtin_dynamic_object_size
for LLVM > 9 and GCC > 12, introducing _SSP_FORTIFY_LEVEL == 3
 1.13 03-Sep-2015  plunky correct __ssp_overlap() to not trigger for adjacent areas
 1.12 25-Jun-2015  joerg Allow SSP enabled functions to conditionally skip the object size check.
Use this is fix the getcwd(NULL, lmit) case, which breaks in lang/parrot.
 1.11 09-May-2015  christos add a macro to check overlapping pointers
 1.10 08-Aug-2012  joerg SSP mostly works with Clang, even if optimisation is disabled.
Explicitly disable it for Lint though.
 1.9 21-Feb-2011  joerg branches: 1.9.4;
Redo the SSP wrappers to be transparent on the resulting object files.
This works by having the inline wrapper calling a second function which
uses renaming to output the correct function name.
 1.8 26-Jan-2011  christos provide a way to override the weak name.
 1.7 25-Jan-2011  christos proved an __ssp_check macro.
 1.6 20-Jan-2011  christos Use the _sys alias instead of the _ alias as the way to access the baseline
syscall.
 1.5 19-Jan-2011  christos branches: 1.5.2;
Re-do ssp hijacking by defining inline functions and using the weak libc
symbols to do the indirection for unistd.h instead of #define tricks.
Fixes compilation for things that define struct { ssize_t read(int fd, ...); }.
 1.4 22-Dec-2010  jruoho Use __dead instead of __attribute__((__noreturn__)) directly.
 1.3 28-Apr-2008  martin branches: 1.3.10;
Remove clause 3 and 4 from TNF licenses
 1.2 03-Jun-2007  christos branches: 1.2.2; 1.2.8; 1.2.14;
- Misc cleanups to make the code more readable.
- Detect if we are compiling in libc and provide the appropriate name.
 1.1 30-May-2007  tls Move FORTIFY_SOURCE implementation from the somewhat ill-named "libssp"
(what other systems keep in libssp, we already have in libc) into libc
to match what other systems with FORTIFY_SOURCE do. Goodbye, libssp
dependency in libraries and executables. Discussed with christos and
mrg; Christos will merge the headers to get us the rest of the way to a
FORTIFY_SOURCE implementation that works as others' code expects.
 1.2.14.1 18-May-2008  yamt sync with head.
 1.2.8.2 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.2.8.1 03-Jun-2007  wrstuden file ssp.h was added on branch wrstuden-fixsa on 2007-09-03 07:01:09 +0000
 1.2.2.2 22-Jul-2007  liamjfoy Pull up to netbsd-4 (requested by christos in ticket #773):

Move libssp to libc.
 1.2.2.1 03-Jun-2007  liamjfoy file ssp.h was added on branch netbsd-4 on 2007-07-22 18:44:39 +0000
 1.3.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.10.1 28-Apr-2008  martin file ssp.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.5.2.2 05-Mar-2011  bouyer Sync with HEAD
 1.5.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.9.4.1 30-Oct-2012  yamt sync with head
 1.5 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.4 25-Feb-2010  joerg Consistently use __printflike and __scanflike.
 1.3 28-Apr-2008  martin branches: 1.3.10; 1.3.18;
Remove clause 3 and 4 from TNF licenses
 1.2 30-May-2007  tls branches: 1.2.2; 1.2.8; 1.2.14;
Match usage of FORTIFY_SOURCE on other platforms by not requiring special
include path: the normal header files now include the "SSP" ones (which one
should note are not really named right: SSP and FORTIFY_SOURCE are independent
features).

Disable USE_SSP on targets where the compiler doesn't support it at all
(mips, alpha) or it's known broken (sh3). But enable FORTIFY_SOURCE,
without SSP, on those platforms -- tested on mipsel.
 1.1 30-May-2007  tls Move FORTIFY_SOURCE implementation from the somewhat ill-named "libssp"
(what other systems keep in libssp, we already have in libc) into libc
to match what other systems with FORTIFY_SOURCE do. Goodbye, libssp
dependency in libraries and executables. Discussed with christos and
mrg; Christos will merge the headers to get us the rest of the way to a
FORTIFY_SOURCE implementation that works as others' code expects.
 1.2.14.1 18-May-2008  yamt sync with head.
 1.2.8.2 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.2.8.1 30-May-2007  wrstuden file stdio.h was added on branch wrstuden-fixsa on 2007-09-03 07:01:09 +0000
 1.2.2.2 22-Jul-2007  liamjfoy Pull up to netbsd-4 (requested by christos in ticket #773):

Move libssp to libc.
 1.2.2.1 30-May-2007  liamjfoy file stdio.h was added on branch netbsd-4 on 2007-07-22 18:44:40 +0000
 1.3.18.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.3.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.10.1 28-Apr-2008  martin file stdio.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.14 05-Sep-2020  mrg make the 2nd argument to __memmove_chk() const
 1.13 29-Nov-2014  pooka Create the stpncpy() inline only when GCC>=4.8 || clang

Mirrors the stpncpy() wrapper macro and avoids the following:
warning: implicit declaration of function ‘__builtin___stpncpy_chk’
 1.12 25-Apr-2014  pooka Apparently clang pretends to be gcc 4.2 but is secretly much awesomer
than gcc 4.2, so enable the stpncpy() wrapper also for clang.
 1.11 24-Apr-2014  pooka Wrap stpncpy() iff GNUC_PREREQ(4,8). Fixes USE_SSP=yes builds
with gcc 4.5.
 1.10 06-Apr-2014  christos add stpncpy()
 1.9 07-Nov-2013  christos branches: 1.9.2;
gcc-4.8.1 is has a builtin stpncpy, but is missing the __builtin_ ssp
equivalent. go figure.
 1.8 07-Nov-2013  tron Revert my last change. I'm not convinced it is correct and while it seems
to fix some build problems it might cause others.
 1.7 06-Nov-2013  tron Add missing declarations for SSP versions of stpcpy(3) and stpncpy(3).
 1.6 06-Nov-2013  christos add stp{,n}cpy
 1.5 22-Jul-2012  joerg branches: 1.5.2;
Always provide *_chk prototypes. Fixes DBG=-g build of libc.
 1.4 17-Nov-2009  drochner branches: 1.4.8;
add some prototypes for checked string functions
 1.3 28-Apr-2008  martin branches: 1.3.10;
Remove clause 3 and 4 from TNF licenses
 1.2 30-May-2007  tls branches: 1.2.2; 1.2.8; 1.2.14;
Match usage of FORTIFY_SOURCE on other platforms by not requiring special
include path: the normal header files now include the "SSP" ones (which one
should note are not really named right: SSP and FORTIFY_SOURCE are independent
features).

Disable USE_SSP on targets where the compiler doesn't support it at all
(mips, alpha) or it's known broken (sh3). But enable FORTIFY_SOURCE,
without SSP, on those platforms -- tested on mipsel.
 1.1 30-May-2007  tls Move FORTIFY_SOURCE implementation from the somewhat ill-named "libssp"
(what other systems keep in libssp, we already have in libc) into libc
to match what other systems with FORTIFY_SOURCE do. Goodbye, libssp
dependency in libraries and executables. Discussed with christos and
mrg; Christos will merge the headers to get us the rest of the way to a
FORTIFY_SOURCE implementation that works as others' code expects.
 1.2.14.1 18-May-2008  yamt sync with head.
 1.2.8.2 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.2.8.1 30-May-2007  wrstuden file string.h was added on branch wrstuden-fixsa on 2007-09-03 07:01:10 +0000
 1.2.2.2 22-Jul-2007  liamjfoy Pull up to netbsd-4 (requested by christos in ticket #773):

Move libssp to libc.
 1.2.2.1 30-May-2007  liamjfoy file string.h was added on branch netbsd-4 on 2007-07-22 18:44:40 +0000
 1.3.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.10.1 28-Apr-2008  martin file string.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.4.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.8.1 30-Oct-2012  yamt sync with head
 1.5.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.2.1 10-Aug-2014  tls Rebase.
 1.3 28-Apr-2008  martin branches: 1.3.10;
Remove clause 3 and 4 from TNF licenses
 1.2 30-May-2007  tls branches: 1.2.2; 1.2.8; 1.2.14;
Match usage of FORTIFY_SOURCE on other platforms by not requiring special
include path: the normal header files now include the "SSP" ones (which one
should note are not really named right: SSP and FORTIFY_SOURCE are independent
features).

Disable USE_SSP on targets where the compiler doesn't support it at all
(mips, alpha) or it's known broken (sh3). But enable FORTIFY_SOURCE,
without SSP, on those platforms -- tested on mipsel.
 1.1 30-May-2007  tls Move FORTIFY_SOURCE implementation from the somewhat ill-named "libssp"
(what other systems keep in libssp, we already have in libc) into libc
to match what other systems with FORTIFY_SOURCE do. Goodbye, libssp
dependency in libraries and executables. Discussed with christos and
mrg; Christos will merge the headers to get us the rest of the way to a
FORTIFY_SOURCE implementation that works as others' code expects.
 1.2.14.1 18-May-2008  yamt sync with head.
 1.2.8.2 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.2.8.1 30-May-2007  wrstuden file strings.h was added on branch wrstuden-fixsa on 2007-09-03 07:01:10 +0000
 1.2.2.2 22-Jul-2007  liamjfoy Pull up to netbsd-4 (requested by christos in ticket #773):

Move libssp to libc.
 1.2.2.1 30-May-2007  liamjfoy file strings.h was added on branch netbsd-4 on 2007-07-22 18:44:40 +0000
 1.3.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3.10.1 28-Apr-2008  martin file strings.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.7 25-Jun-2015  joerg Allow SSP enabled functions to conditionally skip the object size check.
Use this is fix the getcwd(NULL, lmit) case, which breaks in lang/parrot.
 1.6 26-Jan-2011  christos fix readlink prototype.
 1.5 19-Jan-2011  christos branches: 1.5.2;
Re-do ssp hijacking by defining inline functions and using the weak libc
symbols to do the indirection for unistd.h instead of #define tricks.
Fixes compilation for things that define struct { ssize_t read(int fd, ...); }.
 1.4 28-Apr-2008  martin branches: 1.4.10;
Remove clause 3 and 4 from TNF licenses
 1.3 03-Jun-2007  christos branches: 1.3.2; 1.3.8; 1.3.14;
- Misc cleanups to make the code more readable.
- Detect if we are compiling in libc and provide the appropriate name.
 1.2 30-May-2007  tls Match usage of FORTIFY_SOURCE on other platforms by not requiring special
include path: the normal header files now include the "SSP" ones (which one
should note are not really named right: SSP and FORTIFY_SOURCE are independent
features).

Disable USE_SSP on targets where the compiler doesn't support it at all
(mips, alpha) or it's known broken (sh3). But enable FORTIFY_SOURCE,
without SSP, on those platforms -- tested on mipsel.
 1.1 30-May-2007  tls Move FORTIFY_SOURCE implementation from the somewhat ill-named "libssp"
(what other systems keep in libssp, we already have in libc) into libc
to match what other systems with FORTIFY_SOURCE do. Goodbye, libssp
dependency in libraries and executables. Discussed with christos and
mrg; Christos will merge the headers to get us the rest of the way to a
FORTIFY_SOURCE implementation that works as others' code expects.
 1.3.14.1 18-May-2008  yamt sync with head.
 1.3.8.2 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.3.8.1 03-Jun-2007  wrstuden file unistd.h was added on branch wrstuden-fixsa on 2007-09-03 07:01:11 +0000
 1.3.2.2 22-Jul-2007  liamjfoy Pull up to netbsd-4 (requested by christos in ticket #773):

Move libssp to libc.
 1.3.2.1 03-Jun-2007  liamjfoy file unistd.h was added on branch netbsd-4 on 2007-07-22 18:44:41 +0000
 1.4.10.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4.10.1 28-Apr-2008  martin file unistd.h was added on branch christos-time_t on 2008-04-28 20:22:55 +0000
 1.5.2.1 08-Feb-2011  bouyer Sync with HEAD

RSS XML Feed