History log of /freebsd-10.0-release/include/stdlib.h
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 254151 09-Aug-2013 jilles

Add mkostemp() and mkostemps().

These are like mkstemp() and mkstemps() but allow passing open(2) flags like
O_CLOEXEC.


# 252784 05-Jul-2013 jilles

stdlib.h: Add correct POSIX version for POSIX extensions to C.


# 252608 03-Jul-2013 ache

1) POSIX requires rand(3) return values to be in the [0, RAND_MAX] range,
but ACM formula we use have internal state (and return value) in the
[1, 0x7ffffffe] range, so our RAND_MAX (0x7fffffff) is never reached
because it is off by one, zero is not reached too.

Correct both RAND_MAX and rand(3) return value, shifting last one
to the 0 by 1 subtracted, resulting POSIXed [0, 0x7ffffffd(=new RAND_MAX)]
range.

2) Add a checks for not overflowing on too big seeds. It may happens on
the machines, where sizeof(unsigned int) > 32 bits.

Reviewed by: bde [1]
MFC after: 2 weeks


# 234370 17-Apr-2012 jasone

Import jemalloc 9ef7f5dc34ff02f50d401e41c8d9a4a928e7c2aa (dev branch,
prior to 3.0.0 release) as contrib/jemalloc, and integrate it into libc.
The code being imported by this commit diverged from
lib/libc/stdlib/malloc.c in March 2010, which means that a portion of
the jemalloc 1.0.0 ChangeLog entries are relevant, as are the entries
for all subsequent releases.


# 233600 28-Mar-2012 theraven

Correctly expose xlocale functions if people include the headers in the wrong
order (as some ports apparently do).

Approved by: dim (mentor)


# 232971 14-Mar-2012 theraven

Expose some C11 stuff that is also C++11 stuff in C++11 mode.

Approved by: dim (mentor)


# 229848 09-Jan-2012 ed

Add aligned_alloc(3).

The C11 folks reinvented the wheel by introducing an aligned version of
malloc(3) called aligned_alloc(3), instead of posix_memalign(3). Instead
of returning the allocation by reference, it returns the address, just
like malloc(3).

Reviewed by: jasone@


# 229807 08-Jan-2012 ed

Fix spelling of C11 and sort functions by name.


# 228901 26-Dec-2011 ed

Improve C11 bits in <stdlib.h>:

- Add missing semicolon to quick_exit(),
- Remove `func' parameter name from at_quick_exit(),
- Fix indentation.
- Compare against 2011 value.


# 228468 13-Dec-2011 ed

Replace __const by const in all non-contributed source code.

As C1X is close to being released, there is no need to wrap around a
feature that is already part of C90. Most of these files already use
`const' in different placed as well.


# 228330 07-Dec-2011 theraven

As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is an
identifier reserved for the implementation in C99 and earlier so there is
no sensible reason for introducing yet another reserved identifier when we
could just use the one C1x uses.

Approved by: brooks (mentor)


# 228322 07-Dec-2011 theraven

Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a
__noreturn macro and modify the other exiting functions to use it.

The __noreturn macro, unlike __dead2, must be used BEFORE the function.
This is in line with the C and C++ specifications that place _Noreturn (c1x)
and [[noreturn]] (C++11) in front of the functions. As with __dead2, this
macro falls back to using the GCC attribute.

Unfortunately, clang currently sets the same value for the C version macro
in C99 and C1x modes, so these functions are hidden by default. At some
point before 10.0, I need to go through the headers and clean up the C1x /
C++11 visibility.

Reviewed by: brooks (mentor)


# 227753 20-Nov-2011 theraven

Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a
load of _l suffixed versions of various standard library functions that use
the global locale, making them take an explicit locale parameter. Also
adds support for per-thread locales. This work was funded by the FreeBSD
Foundation.

Please test any code you have that uses the C standard locale functions!

Reviewed by: das (gdtoa changes)
Approved by: dim (mentor)


# 206997 21-Apr-2010 kib

Move realpath(3) prototype to a POSIX section.

Noted by: bde
MFC after: 2 weeks


# 206893 20-Apr-2010 kib

Slightly modernize realpath(3).

SUSv4 requires that implementation returns EINVAL if supplied path is NULL,
and ENOENT if path is empty string [1].
Bring prototype in conformance with SUSv4, adding restrict keywords.
Allow the resolved path buffer pointer be NULL, in which case realpath(3)
allocates storage with malloc().

PR: kern/121897 [1]
MFC after: 2 weeks


# 203964 16-Feb-2010 imp

Remove the Berkeley clause 3's.
Add a few $FreeBSD$


# 189820 14-Mar-2009 das

Namespace: abort2() is a BSD extension.


# 189782 14-Mar-2009 das

r189349 removed mktemp() from the XSI namespace when
__XOPEN_SOURCE >= 700, since mktemp() was withdrawn
from the standard. However, __XSI_VISIBLE is set to
700 in the default BSD envrionment, where mktemp()
should still exist; hence, check for this.


# 189349 04-Mar-2009 das

- Add getsubopt and mkdtemp to the POSIX.1-2008 namespace.
- Add mkstemp to the POSIX.1-2008 and BSD namespaces.
- Remove mktemp from the XSI namespace.


# 188497 11-Feb-2009 ed

Add two new routines: fdevname() and fdevname_r().

A more elegant way of obtaining a name of a character device by its file
descriptor on FreeBSD, is to use the FIODGNAME ioctl. Because a valid
file descriptor implies a file descriptor is visible in /dev, it will
always resolve a valid device name.

I'm adding a more friendly wrapper for this ioctl, called fdevname(). It
is a lot easier to use than devname() and also has better error
handling. When a device name cannot be resolved, it will just return
NULL instead of a generated device name that makes no sense.

Discussed with: kib


# 187961 31-Jan-2009 das

Add a function attribute called `__malloc_like', which informs gcc
that the annotated function returns a pointer that doesn't alias any
extant pointer. This results in a 50%+ speedup in microbenchmarks such
as the following:

char *cp = malloc(1), *buf = malloc(BUF);
for (i = 0; i < BUF; i++) buf[i] = *cp;

In real programs, your mileage will vary. Note that gcc already
performs this optimization automatically for any function called
`malloc', `calloc', `strdup', or `strndup' unless -fno-builtins is
used.


# 180689 22-Jul-2008 ache

Add arc4random_uniform()

Obtained from: OpenBSD


# 180658 21-Jul-2008 ache

Add arc4random_buf.
Style: remove arg names from arc4random_addrandom.


# 171195 03-Jul-2007 scf

Significantly reduce the memory leak as noted in BUGS section for
setenv(3) by tracking the size of the memory allocated instead of using
strlen() on the current value.

Convert all calls to POSIX from historic BSD API:
- unsetenv returns an int.
- putenv takes a char * instead of const char *.
- putenv no longer makes a copy of the input string.
- errno is set appropriately for POSIX. Exceptions involve bad environ
variable and internal initialization code. These both set errno to
EFAULT.

Several patches to base utilities to handle the POSIX changes from
Andrey Chernov's previous commit. A few I re-wrote to use setenv()
instead of putenv().

New regression module for tools/regression/environ to test these
functions. It also can be used to test the performance.

Bump __FreeBSD_version to 700050 due to API change.

PR: kern/99826
Approved by: wes
Approved by: re (kensmith)


# 169177 01-May-2007 ache

Back out all POSIXified *env() changes.

Not because I admit they are technically wrong and not because of bug
reports (I receive nothing). But because I surprisingly meets so
strong opposition and resistance so lost any desire to continue that.

Anyone who interested in POSIX can dig out what changes and how
through cvs diffs.


# 169110 30-Apr-2007 ache

Fix unsetenv and putenv prototypes to conform Open Group specs Issue 6
(also IEEE Std 1003.1-2001)


# 156707 14-Mar-2006 andre

Import of OpenBSD's strtonum(3) which is a nicer version of strtoll(3)
providing proper error checking and other improvements.

Obtained from: OpenBSD
Requested by: flz (to port Open[BGP|OSPF]D)
MFC after: 3 days


# 154250 12-Jan-2006 jasone

Expose the posix_memalign() prototype, now that the function is implemented
by libc.


# 153707 24-Dec-2005 trhodes

Add a64l(), l64a(), and l64a_r() XSI extentions. These functions convert
between a 32-bit integer and a radix-64 ASCII string. The l64a_r() function
is a NetBSD addition.

PR: 51209 (based on submission, but very different)
Reviewed by: bde, ru


# 153684 23-Dec-2005 phk

Add abort2() prototype


# 150052 12-Sep-2005 stefanf

Fix the prototypes for devname() and devname_r(), the first two argument
types are supposed to be dev_t and mode_t (prefixed with __ due to
namespace reasons).


# 139922 09-Jan-2005 tjr

Implement rpmatch(), a semi-standard interface (as found on AIX, Tru64,
GNU) for determining whether a string is an affirmative or negative
response to a question according to the current locale. This is done
by matching the response against nl_langinfo(3) items YESEXPR and NOEXPR.


# 126136 23-Feb-2004 ache

POSIX clearly states that getsubopt() should be declared in <stdlib.h>,
not in <unistd.h>


# 123257 07-Dec-2003 marcel

Change the definition of NULL on ia64 (for LP64 compilations) from
an int constant to a long constant. This change improves consistency
in the following two ways:
1. The first 8 arguments are always passed in registers on ia64, which
by virtue of the generated code implicitly widens ints to longs and
allows the use of an 32-bit integral type for 64-bit arguments.
Subsequent arguments are passed onto the memory stack, which does
not exhibit the same behaviour and consequently do not allow this.
In practice this means that variadic functions taking pointers
and given NULL (without cast) work as long as the NULL is passed
in one of the first 8 arguments. A SIGSEGV is more likely the
result if such would be done for stack-based arguments. This is
due to the fact that the upper 4 bytes remain undefined.
2. All 64-bit platforms that FreeBSD supports, with the obvious
exception of ia64, allow 32-bit integral types (specifically NULL)
when 64-bit pointers are expected in variadic functions by way of
how the compiler generates code. As such, code that works correctly
(whether rightfully so or not) on any platform other than ia64, may
fail on ia64.

To more easily allow tweaking of the definition of NULL, this commit
removes the 12 definitions in the various headers and puts it in a
new header that can be included whenever NULL is to be made visible.

This commit fixes GNOME, emacs, xemacs and a whole bunch of ports
that I don't particularly care about at this time...


# 116833 25-Jun-2003 obrien

Push the alloca #error warning farther down to play nicer with some out of
tree local translator.

Requested by: jmallett


# 116832 25-Jun-2003 obrien

Fix a mismerge.


# 116831 25-Jun-2003 obrien

Don't blindly provide alloca() for all compilers -- it is too implementation
dependent. Instead provide one for GCC & Intel's GCC copy and one for lint.
Anyone using any other translator tool needs to look closely at how that tool
can handle alloca.


# 116680 22-Jun-2003 dwmalone

Remove argument names from a function declaration.

Reviewed by: phk


# 116610 20-Jun-2003 phk

Add devname_r(3) which takes a buffer as argument.


# 116397 15-Jun-2003 des

Use __builtin_alloca() on compilers that have it. Keep the prototype for
the benefit of lint and non-{GNU,Intel} compilers.


# 112163 12-Mar-2003 das

Replace our ancient dtoa/strtod implementation with the gdtoa
package, a more recent, generalized set of routines. Among the
changes:
- Declare strtof() and strtold() in stdlib.h.
- Add glue to libc to support these routines for all kinds
of ``long double''.
- Update printf() to reflect the fact that dtoa works slightly
differently now.

As soon as I see that nothing has blown up, I will kill
src/lib/libc/stdlib/strtod.c. Soon printf() will be able
to use the new routines to output long doubles without loss
of precision, but numerous bugs in the existing code must
be addressed first.

Reviewed by: bde (briefly), mike (mentor), obrien


# 108574 02-Jan-2003 jmallett

Implement POSIX grantpt(3) functionality, and add a pt_chown utility (akin
to Solaris, it is in /usr/libexec) to perform the handing over of tty nodes
to the user being granted the pty.

Submitted by: Ryan Younce <ryany@pobox.com>
Reviewed by: security-officer@, standards@, mike@


# 108445 30-Dec-2002 obrien

Back out the s/int */size_t */ commit.
It makes a difference on 64-bit arches, and no one really wants a 2^64
block size [yet].


# 105797 23-Oct-2002 markm

Make the first argument of getbsize a size_t* instead of an int*, as this is what the quantity actually is. Fix an easy const while I'm here.


# 103766 21-Sep-2002 bde

Whitespace cleanup (half for fixing missing whitespace before `__restrict'
again).

Removed the second pair of banal comments about `quot' and `rem'.


# 103728 21-Sep-2002 wollman

Use new visibility macros. Reorder some disordered declarations. Add
new 1003.1-2001 declarations, commented out in cases where we do not
implement the function. Note that strtoq() and strtouq() are slated
for deletion in 6.0. (2 of 5)


# 103164 10-Sep-2002 wollman

Without fixing the namespace issues, add prototypes for the new _Exit()
and qsort_r() functions. Fix one other missorted declaration.


# 103012 06-Sep-2002 tjr

Style: One space between "restrict" qualifier and "*".


# 102762 01-Sep-2002 tjr

Add restrict qualifiers to the arguments of mbstowcs, mbtowc() and
wcstombs().


# 102227 21-Aug-2002 mike

o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
macros, which are only MD because of gratuitous differences between
architectures.
o Change all headers to make use of this. This mainly involves
changing:
#ifdef _BSD_FOO_T_
typedef _BSD_FOO_T_ foo_t;
#undef _BSD_FOO_T_
#endif
to:
#ifndef _FOO_T_DECLARED
typedef __foo_t foo_t;
#define _FOO_T_DECLARED
#endif

Concept by: bde
Reviewed by: jake, obrien


# 101912 15-Aug-2002 robert

- Add the 'restrict' qualifier to the function prototypes and
definitions of the functions that convert strings to numbers
and are defined by IEEE Std 1003-1.2001.
- Use ANSI-C function definitions for all of the functions
mentioned above plus strtouq and strtoq.
- Update the prototypes in the manual pages.


# 99640 09-Jul-2002 obrien

Don't define wchar_t if we are a C++ compiler.

PR: 31864, 40084


# 99404 04-Jul-2002 markm

Convince lint via the standard lint-comment /* LONGLONG */ to not
whine about our (valid) "long long" usage.


# 97639 30-May-2002 phk

Const poison.

Partially submitted by: wollman


# 95377 24-Apr-2002 phk

Constify _malloc_options.


# 93032 23-Mar-2002 imp

Breath deep and take __P out of the system include files.

# This appears to not break X11, but I'm having problems compiling the
# glide part of the server with or without this patch, so I can't tell
# for sure.


# 92925 22-Mar-2002 imp

const poison just like NetBSD.


# 90644 13-Feb-2002 imp

Move user_from_uid to pwd.h
Move group_from_gid to grp.h
Remove from stdlib.h
Make the prototypes match the code
Fix rm and mv to include new files.

NetBSD has these defined in those files, and others too that I've not
done.

Approved by: terminal room kabal
Reviewed by: jhb, phk


# 90607 13-Feb-2002 imp

Revert 1.29. It breaks the build. Will figure out a better way to do
this that doesn't break things.


# 90606 13-Feb-2002 imp

Make the user_from_uid and group_from_gid prototypes match the actual
function definitions.


# 88399 22-Dec-2001 mike

Fix support for K&R C.

MFC after: 3 days


# 87086 29-Nov-2001 bde

Oops, actually fix the namespace pollution for atoll() as the previous
commit claimed to do.


# 87071 28-Nov-2001 bde

Fixed namespace pollution and/or breakage of K&R and C90 support related to
the following functions in the following commits:
- atoll() in revs 1.23-1.25
- llabs() and lldiv() in revs 1.22
- strtoq() and strtouq() in revs 1.18
C99 functions must not be declared in C90/POSIX.1-1990 sections, and
"long long" must not be exposed to compilers that don't support it.

Fixed style bugs (mainly misindentation and disorder) related the
following functions in the following commits:
- atoll() in revs 1.23-1.25
- getprogname() in rev.1.21
- sranddev() in revs 1.19-1.20
- strtoq() and strtouq() in rev.1.13
- user_from_uid() in rev.1.1
Breakage of K&R and C90 support used to be avoided by conditializing the
"long long"s for strtoq() and strtouq() on __STRICT_ANSI__, but the
conditionals should have gone away in rev.1.13 when the "long long"s went
away (the problem was moved to the places that declare quad_t and u_quad_t).


# 87021 28-Nov-2001 ache

Whitespace formatting


# 87019 27-Nov-2001 ache

Fix just added atoll prototype


# 87017 27-Nov-2001 ache

Add atoll(3) to conform POSIX and C99


# 86368 15-Nov-2001 mike

o Implement imaxabs(), imaxdiv(), llabs(), lldiv().
o Update abs(3), div(3), labs(3), ldiv(3) to reflect standards
conformance and add additional references.

Reviewed by: bde, wollman


# 76653 15-May-2001 dd

Introduce getprogname(3) and setprogname(3) library calls. These get
and set __progname, respectively.

Discussed on: -arch (Feb 2001), -audit
Reviewed by: -audit
Approved by: kris
Obtained from: (mostly) NetBSD


# 75859 23-Apr-2001 ache

Move sranddev() to !ANSI_SOURCE !POSIX_SOURCE section

Pointed out by: bde


# 75846 23-Apr-2001 ache

Add sranddev() prototype


# 73152 27-Feb-2001 obrien

Impliment the ISO-C99 strto[u]ll()
and rewrite strto[u]q() in terms of it.


# 69201 26-Nov-2000 phk

Make it possible to override the function which writes messages to
stderr in case of warnings and errors.

Rename malloc_options to have a leading underscore, I belive I have been
told that is more correct namespace wise.


# 55031 23-Dec-1999 bde

Fixed missing declaration of rand_r(3).


# 41927 18-Dec-1998 dt

Little reorganization:
- created internal names for fixed-size integral types, like __int32_t. They
will be used to make several headers self-sufficient.
- <stdlib.h> don't include <machine/types.h> anymore.
- created <sys/inttypes.h>, which can be used as <inttypes.h>.
- declaration of uoff_t and ufs_daddr_t moved to <sys/types.h>.

Reviewed by: bde


# 39191 14-Sep-1998 imp

Add reallocf to the library. This function is simliar to realloc, but
when it returns NULL to indicate failure, it will also free the memory
that was passed to it, if that was non-null.

This does not change the semantics of realloc.

A second commit will be done to commit the conversion of those places in
the code that can safely use this to avoid memory leaks when confronted
with low memory situations.

Beaten-to-death-but-finally-approved-in: -current


# 35943 11-May-1998 jb

Change the return types for strtoq and strtouq to int64_t and u_int64_t
instead of long long and unsigned long long. Really they should be
quad_t and u_quad_t, but that would require sys/types.h and this
header only includes machine/types.h. The difference here is that
int64_t and u_int64_t on alpha are long and unsigned long, not
long long etc. This is required to pass gcc's type checking where
long != long long even though they are the same size of alpha.


# 33861 27-Feb-1998 bde

Moved include of <sys/cdefs.h> earlier for the same reasons as moving
it in <sys/types.h>.

PR: 5785


# 26636 14-Jun-1997 ache

Move machine/types.h to non-standard section
Change order of arc4* functions
Pointed-by: bde


# 26630 13-Jun-1997 ache

Add arc4random family declaration


# 26624 13-Jun-1997 ache

Instead of copying fallback code over and over in each program,
implement (better) falback code inside srandomdev() itself.
Change return type from int to void (binary compatibility surprisely
achieved). Userland code will be changed soon.


# 24152 23-Mar-1997 ache

Add srandomdev() prototype


# 23657 11-Mar-1997 peter

Merge Lite2 changes -
move getopt etc declarations from stdlib.h to unistd.h


# 18286 14-Sep-1996 bde

Don't use __dead or __pure in user code. They were obfuscations
for gcc >= 2.5 and no-ops for gcc >= 2.6. Converted to use __dead2
or __pure2 where it wasn't already done, except in math.h where use
of __pure was mostly wrong.


# 15483 30-Apr-1996 bde

Fixed longstanding namespace convolution involving rune_t vs wchar_t.
If _ANSI_SOURCE or _POSIX_SOURCE is defined, then <ctype.h> had to
be included before <stddef.h> or <stdlib.h> to get rune_t declared.
Now rune_t is declared perfectly bogusly in all cases when <ctype.h>
is included.

This change breaks similar (but more convoluted) convolutions in the
stddef.h in gcc distributions. Ports of gcc should avoid using the
gcc headers.


# 7865 15-Apr-1995 bde

Don't declare rune_t, putenv() or setenv() if _POSIX_SOURCE is declared.
Previously they were only guarded by `#ifndef _ANSI_SOURCE'. They are
neither ANSI nor POSIX nor std and should never have been declared here.

Declare functions like abs() as having attribute `__pure2'. Declaring them
as having type `__pure' has been a no-op for some time.

Delete obsolete comment about stub locale functions.

Use consistent formatting for the rand48 functions. These and about 30
other functions should never have been declared here either.


# 4749 21-Nov-1994 ats

Reviewed by: Bruce Evans
Add prototypes for the *rand48 family here in the moment to get them
running again.


# 2572 08-Sep-1994 bde

Declare functions that don't return as having attribute __dead2.


# 1540 24-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1539,
which included commits to RCS files with non-trunk default branches.


# 1539 24-May-1994 rgrimes

BSD 4.4 Lite Include Sources