History log of /netbsd-current/include/stdlib.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.125 28-Oct-2022 wiz

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


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.122 26-May-2020 joerg

Avoid depending on namespace pollution in stdlib.h.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118
# 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.


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.120 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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)


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.107 08-Jan-2014 christos

branches: 1.107.2;
add ptsname_r


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 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.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: yamt-pagecache-base5
# 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.


Revision tags: yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 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)


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.95 04-Feb-2011 christos

add arc4random_{buf,uniform}, from OpenBSD.


Revision tags: matt-mips64-premerge-20101231
# 1.94 22-Dec-2010 jruoho

branches: 1.94.2;
Use __constfunc(3) instead of __attribute__((const)) directly.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.93 01-Oct-2010 christos

make putenv POSIX compliant.


Revision tags: uebayasi-xip-base2
# 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


Revision tags: uebayasi-xip-base1
# 1.91 25-Feb-2010 joerg

Consistently use __printflike and __scanflike.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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


Revision tags: matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 christos-time_t-nbase christos-time_t-base netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase simonb-wapbl-base wrstuden-revivesa-base
# 1.85 21-Jun-2008 gmcgarry

branches: 1.85.4; 1.85.6; 1.85.12;
Use __builtin_alloc() with pcc.


Revision tags: yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase
# 1.82 28-Feb-2008 christos

add RANDOM_MAX define from anon ymous


Revision tags: hpcarm-cleanup-base
# 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.


Revision tags: cube-autoconf-base
# 1.78 19-Nov-2007 ad

Enable posix_memalign().


Revision tags: matt-armv6-prevmlocking matt-armv6-base matt-mips64-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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).


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.25 27-Dec-1995 jtc

Add __dead qualifier to abort() and exit(); PR 1845


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.3 08-Jun-1993 brezak

GCC2 defines alloca() differently.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 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.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


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.122 26-May-2020 joerg

Avoid depending on namespace pollution in stdlib.h.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118
# 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.


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.120 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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)


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.107 08-Jan-2014 christos

branches: 1.107.2;
add ptsname_r


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 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.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: yamt-pagecache-base5
# 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.


Revision tags: yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 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)


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.95 04-Feb-2011 christos

add arc4random_{buf,uniform}, from OpenBSD.


Revision tags: matt-mips64-premerge-20101231
# 1.94 22-Dec-2010 jruoho

branches: 1.94.2;
Use __constfunc(3) instead of __attribute__((const)) directly.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.93 01-Oct-2010 christos

make putenv POSIX compliant.


Revision tags: uebayasi-xip-base2
# 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


Revision tags: uebayasi-xip-base1
# 1.91 25-Feb-2010 joerg

Consistently use __printflike and __scanflike.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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


Revision tags: matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 christos-time_t-nbase christos-time_t-base netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase simonb-wapbl-base wrstuden-revivesa-base
# 1.85 21-Jun-2008 gmcgarry

branches: 1.85.4; 1.85.6; 1.85.12;
Use __builtin_alloc() with pcc.


Revision tags: yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase
# 1.82 28-Feb-2008 christos

add RANDOM_MAX define from anon ymous


Revision tags: hpcarm-cleanup-base
# 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.


Revision tags: cube-autoconf-base
# 1.78 19-Nov-2007 ad

Enable posix_memalign().


Revision tags: matt-armv6-prevmlocking matt-armv6-base matt-mips64-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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).


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.25 27-Dec-1995 jtc

Add __dead qualifier to abort() and exit(); PR 1845


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.3 08-Jun-1993 brezak

GCC2 defines alloca() differently.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 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.123 03-Jul-2021 christos

PR/56250: Michael Forney: mkstemp/mkdtemp not declared with
_POSIX_C_SOURCE=200809L


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.122 26-May-2020 joerg

Avoid depending on namespace pollution in stdlib.h.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118
# 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.


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.120 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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)


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.107 08-Jan-2014 christos

branches: 1.107.2;
add ptsname_r


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 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.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: yamt-pagecache-base5
# 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.


Revision tags: yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 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)


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.95 04-Feb-2011 christos

add arc4random_{buf,uniform}, from OpenBSD.


Revision tags: matt-mips64-premerge-20101231
# 1.94 22-Dec-2010 jruoho

branches: 1.94.2;
Use __constfunc(3) instead of __attribute__((const)) directly.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.93 01-Oct-2010 christos

make putenv POSIX compliant.


Revision tags: uebayasi-xip-base2
# 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


Revision tags: uebayasi-xip-base1
# 1.91 25-Feb-2010 joerg

Consistently use __printflike and __scanflike.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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


Revision tags: matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 christos-time_t-nbase christos-time_t-base netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase simonb-wapbl-base wrstuden-revivesa-base
# 1.85 21-Jun-2008 gmcgarry

branches: 1.85.4; 1.85.6; 1.85.12;
Use __builtin_alloc() with pcc.


Revision tags: yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase
# 1.82 28-Feb-2008 christos

add RANDOM_MAX define from anon ymous


Revision tags: hpcarm-cleanup-base
# 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.


Revision tags: cube-autoconf-base
# 1.78 19-Nov-2007 ad

Enable posix_memalign().


Revision tags: matt-armv6-prevmlocking matt-armv6-base matt-mips64-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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).


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.25 27-Dec-1995 jtc

Add __dead qualifier to abort() and exit(); PR 1845


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.3 08-Jun-1993 brezak

GCC2 defines alloca() differently.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 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.122 26-May-2020 joerg

Avoid depending on namespace pollution in stdlib.h.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118
# 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.


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.120 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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)


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.107 08-Jan-2014 christos

branches: 1.107.2;
add ptsname_r


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 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.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: yamt-pagecache-base5
# 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.


Revision tags: yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 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)


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.95 04-Feb-2011 christos

add arc4random_{buf,uniform}, from OpenBSD.


Revision tags: matt-mips64-premerge-20101231
# 1.94 22-Dec-2010 jruoho

branches: 1.94.2;
Use __constfunc(3) instead of __attribute__((const)) directly.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.93 01-Oct-2010 christos

make putenv POSIX compliant.


Revision tags: uebayasi-xip-base2
# 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


Revision tags: uebayasi-xip-base1
# 1.91 25-Feb-2010 joerg

Consistently use __printflike and __scanflike.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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


Revision tags: matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 christos-time_t-nbase christos-time_t-base netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase simonb-wapbl-base wrstuden-revivesa-base
# 1.85 21-Jun-2008 gmcgarry

branches: 1.85.4; 1.85.6; 1.85.12;
Use __builtin_alloc() with pcc.


Revision tags: yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase
# 1.82 28-Feb-2008 christos

add RANDOM_MAX define from anon ymous


Revision tags: hpcarm-cleanup-base
# 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.


Revision tags: cube-autoconf-base
# 1.78 19-Nov-2007 ad

Enable posix_memalign().


Revision tags: matt-armv6-prevmlocking matt-armv6-base matt-mips64-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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).


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.25 27-Dec-1995 jtc

Add __dead qualifier to abort() and exit(); PR 1845


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.3 08-Jun-1993 brezak

GCC2 defines alloca() differently.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118
# 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.


Revision tags: pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.120 15-Aug-2018 martin

PR standards/53525: move getsubopt() to stdlib.h


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.119 07-Oct-2017 christos

branches: 1.119.2;
remove recallocarray


# 1.118 07-Oct-2017 christos

add recallocarray (used by openssh-7.6)


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.107 08-Jan-2014 christos

branches: 1.107.2;
add ptsname_r


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 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.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: yamt-pagecache-base5
# 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.


Revision tags: yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 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)


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.95 04-Feb-2011 christos

add arc4random_{buf,uniform}, from OpenBSD.


Revision tags: matt-mips64-premerge-20101231
# 1.94 22-Dec-2010 jruoho

branches: 1.94.2;
Use __constfunc(3) instead of __attribute__((const)) directly.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.93 01-Oct-2010 christos

make putenv POSIX compliant.


Revision tags: uebayasi-xip-base2
# 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


Revision tags: uebayasi-xip-base1
# 1.91 25-Feb-2010 joerg

Consistently use __printflike and __scanflike.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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


Revision tags: matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 christos-time_t-nbase christos-time_t-base netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase simonb-wapbl-base wrstuden-revivesa-base
# 1.85 21-Jun-2008 gmcgarry

branches: 1.85.4; 1.85.6; 1.85.12;
Use __builtin_alloc() with pcc.


Revision tags: yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase
# 1.82 28-Feb-2008 christos

add RANDOM_MAX define from anon ymous


Revision tags: hpcarm-cleanup-base
# 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.


Revision tags: cube-autoconf-base
# 1.78 19-Nov-2007 ad

Enable posix_memalign().


Revision tags: matt-armv6-prevmlocking matt-armv6-base matt-mips64-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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).


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.25 27-Dec-1995 jtc

Add __dead qualifier to abort() and exit(); PR 1845


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.3 08-Jun-1993 brezak

GCC2 defines alloca() differently.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 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.119 07-Oct-2017 christos

remove recallocarray


# 1.118 07-Oct-2017 christos

add recallocarray (used by openssh-7.6)


Revision tags: perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.107 08-Jan-2014 christos

branches: 1.107.2;
add ptsname_r


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 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.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: yamt-pagecache-base5
# 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.


Revision tags: yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 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)


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.95 04-Feb-2011 christos

add arc4random_{buf,uniform}, from OpenBSD.


Revision tags: matt-mips64-premerge-20101231
# 1.94 22-Dec-2010 jruoho

branches: 1.94.2;
Use __constfunc(3) instead of __attribute__((const)) directly.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.93 01-Oct-2010 christos

make putenv POSIX compliant.


Revision tags: uebayasi-xip-base2
# 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


Revision tags: uebayasi-xip-base1
# 1.91 25-Feb-2010 joerg

Consistently use __printflike and __scanflike.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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


Revision tags: matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 christos-time_t-nbase christos-time_t-base netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase simonb-wapbl-base wrstuden-revivesa-base
# 1.85 21-Jun-2008 gmcgarry

branches: 1.85.4; 1.85.6; 1.85.12;
Use __builtin_alloc() with pcc.


Revision tags: yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase
# 1.82 28-Feb-2008 christos

add RANDOM_MAX define from anon ymous


Revision tags: hpcarm-cleanup-base
# 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.


Revision tags: cube-autoconf-base
# 1.78 19-Nov-2007 ad

Enable posix_memalign().


Revision tags: matt-armv6-prevmlocking matt-armv6-base matt-mips64-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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).


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.25 27-Dec-1995 jtc

Add __dead qualifier to abort() and exit(); PR 1845


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.3 08-Jun-1993 brezak

GCC2 defines alloca() differently.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 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


Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 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


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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)


Revision tags: yamt-pagecache-base9 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.107 08-Jan-2014 christos

branches: 1.107.2;
add ptsname_r


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 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.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: yamt-pagecache-base5
# 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.


Revision tags: yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base
# 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)


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base
# 1.95 04-Feb-2011 christos

add arc4random_{buf,uniform}, from OpenBSD.


Revision tags: matt-mips64-premerge-20101231
# 1.94 22-Dec-2010 jruoho

branches: 1.94.2;
Use __constfunc(3) instead of __attribute__((const)) directly.


Revision tags: uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3
# 1.93 01-Oct-2010 christos

make putenv POSIX compliant.


Revision tags: uebayasi-xip-base2
# 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


Revision tags: uebayasi-xip-base1
# 1.91 25-Feb-2010 joerg

Consistently use __printflike and __scanflike.


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 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


Revision tags: matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 christos-time_t-nbase christos-time_t-base netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase simonb-wapbl-base wrstuden-revivesa-base
# 1.85 21-Jun-2008 gmcgarry

branches: 1.85.4; 1.85.6; 1.85.12;
Use __builtin_alloc() with pcc.


Revision tags: yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-pf42-base
# 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"


Revision tags: keiichi-mipv6-base matt-armv6-nbase
# 1.82 28-Feb-2008 christos

add RANDOM_MAX define from anon ymous


Revision tags: hpcarm-cleanup-base
# 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.


Revision tags: cube-autoconf-base
# 1.78 19-Nov-2007 ad

Enable posix_memalign().


Revision tags: matt-armv6-prevmlocking matt-armv6-base matt-mips64-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-4-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 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


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 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.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
# 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).


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
# 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


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.25 27-Dec-1995 jtc

Add __dead qualifier to abort() and exit(); PR 1845


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 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


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.3 08-Jun-1993 brezak

GCC2 defines alloca() differently.


Revision tags: netbsd-0-8 netbsd-alpha-1
# 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