summaryrefslogtreecommitdiff
path: root/include/stdlib.h
AgeCommit message (Collapse)Author
2015-07-14The first argument to devname(3) should be dev_t, not int.Todd C. Miller
The man page was already correct.
2015-02-08add restrict to strtol like functions. ok guentherTed Unangst
2015-01-15we don't have an alloca() symbol anywhere in libc, don't prototype it.Ted Unangst
instead, #define to __builtin_alloca. if that doesn't work, you're hosed. from an old discussion about the perils of alloca. (don't use alloca!)
2014-12-08Change rand(), random(), drand48(), lrand48(), mrand48(), and srand48()Theo de Raadt
to returning strong random by default, source from arc4random(3). Parameters to the seeding functions are ignored, and the subsystems remain in strong random mode. If you wish the standardized deterministic mode, call srand_deterministic(), srandom_determistic(), srand48_deterministic(), seed48_deterministic() or lcong48_deterministic() instead. The re-entrant functions rand_r(), erand48(), nrand48(), jrand48() are unaffected by this change and remain in deterministic mode (for now). Verified as a good roadmap forward by auditing 8800 pieces of software. Roughly 60 pieces of software will need adaptation to request the deterministic mode. Violates POSIX and C89, which violate best practice in this century. ok guenther tedu millert
2014-12-08header changes for recent libc changes:Ted Unangst
add siphash delete setkey, encrypt, cfree
2014-08-31Add additional userland interfaces for setting close-on-exec on fdsPhilip Guenther
when creating them: mkostemp(), mkostemps(), the 'e' mode letter for fopen(), freopen(), fdopen(), and popen(). The close-on-exec flag will be cleared by the action created by posix_spawn_file_actions_adddup2(). Also, add support for the C11 'x' mode letter for fopen() and freopen(), setting O_EXCL when possibly creating files. Note: this requires kernel support for pipe2() and dup3()! ok millert@
2014-07-09Clean up after arc4random u_int32_t uint32_t changeBob Beck
ok jsing@
2014-04-22change mallocarray to reallocarray. useful in a few more situations.Ted Unangst
malloc can, as always, be emulated via realloc(NULL). ok deraadt
2014-04-21Introducing: void *mallocarray(size_t nmemb, size_t size);Theo de Raadt
Like calloc(), except without the cleared-memory gaurantee ok beck guenther, discussed for more than a year...
2013-12-28Annotate a few more bounded functions: realpath(3) needs a bufferMartynas Venckus
of size at least PATH_MAX. pread(2), pwrite(2) and readlinkat(2) also take the buffer and the bound. OK theo.
2013-12-13Fix typo; 200809 not 20080 for __POSIX_VISIBLE. Noticed by jca@Todd C. Miller
2013-11-22The getopt() prototype and externs don't belong in stdlib.h. BerkeleyTodd C. Miller
moved them to unistd.h to match POSIX in 1995 but we never did. The exception to this is getsubopt() which POSIX says should be in stdlib.h. The non-standard suboptarg extern remains in the BSD-only section of stdlib.h. Neither getsubopt() nor suboptarg belong in unistd.h or getopt.h. They were only there to allow us to protect all the getopt() bits from being multiply defined. OK guenther@
2013-10-21Remove arc4random_stir() and arc4random_addrandom(), which none shouldTheo de Raadt
be using directly. Well, a few rare people cloned it upstream and it will take a bit of time for them to learn. ok various
2013-05-31Add getprogname() and setprogname() to ease slackers^porters' work.Antoine Jacoutot
Man page adapted from FreeBSD and NetBSD. Bump libc minor now (there will be more upcoming changes). input from tedu@ get it in deraadt@
2012-12-03Simple emulation of POSIX pty APIs posix_openpt(), ptsname(),Todd C. Miller
grantpt() and unlockpt() using /dev/ptm. Man pages from FreeBSD. OK kettenis@ deraadt@ beck@ ajacoutot@ naddy@
2012-06-01Improve standards conformance: ecvt(), fcvt(), gcvt(), mktemp(), ttyslot(),Philip Guenthe
and valloc() are not in the current version, while posix_memalign() mkstemp(), and mkdtemp() are, and setstate()'s argument has lost a bogus 'const'. ok millert@ jmc@ espie@ kettenis@; ports build testing by naddy@
2011-07-03As pointed out by Richard Guenther our definitionJonathan Gray
of NULL was incorrect for c++ compilers that aren't gcc (or pretend to be gcc like clang). ok miod@
2011-04-06Define NULL as a void * instead of a long integer, as required by Single Unix.Miod Vallat
Kernel and bootblocks still use the old 0L value until all the NULL abuses in the code are fixed.
2010-05-18add posix_madvise, posix_memalign, strndup, and strnlen. mostly fromTed Unangst
brad and millert, with hints from guenther, jmc, and otto I think. ok previous.
2009-06-03Make putenv(), setenv() and unsetenv() standards compliant. TheTodd C. Miller
standard explicitly disallows passing setenv a name with a '=' in it but historic BSD behavior is to allow this but to ignore the '=' and anything after it.
2008-09-07- replace dtoa w/ David's gdtoa, version 2008-03-15Martynas Venckus
- provide proper dtoa locks - use the real strtof implementation - add strtold, __hdtoa, __hldtoa - add %a/%A support - don't lose precision in printf, don't round to double anymore - implement extended-precision versions of libc functions: fpclassify, isnan, isinf, signbit, isnormal, isfinite, now that the ieee.h is fixed - separate vax versions of strtof, and __hdtoa - add complex math support. added functions: cacos, casin, catan, ccos, csin, ctan, cacosh, casinh, catanh, ccosh, csinh, ctanh, cexp, clog, cabs, cpow, csqrt, carg, cimag, conj, cproj, creal, cacosf, casinf, catanf, ccosf, csinf, ctanf, cacoshf, casinhf, catanhf, ccoshf, csinhf, ctanhf, cexpf, clogf, cabsf, cpowf, csqrtf, cargf, cimagf, conjf, cprojf, crealf - add fdim, fmax, fmin - add log2. (adapted implementation e_log.c. could be more acruate & faster, but it's good enough for now) - remove wrappers & cruft in libm, supposed to work-around mistakes in SVID, etc.; use ieee versions. fixes issues in python 2.6 for djm@ - make _digittoint static - proper definitions for i386, and amd64 in ieee.h - sh, powerpc don't really have extended-precision - add missing definitions for mips64 (quad), m{6,8}k (96-bit) float.h for LDBL_* - merge lead to frac for m{6,8}k, for gdtoa to work properly - add FRAC*BITS & EXT_TO_ARRAY32 definitions in ieee.h, for hdtoa&ldtoa to use - add EXT_IMPLICIT_NBIT definition, which indicates implicit normalization bit - add regression tests for libc: fpclassify and printf - arith.h & gd_qnan.h definitions - update ieee.h: hppa doesn't have quad-precision, hppa64 does - add missing prototypes to gdtoaimp - on 64-bit platforms make sure gdtoa doesn't use a long when it really wants an int - etc., what i may have forgotten... - bump libm major, due to removed&changed symbols - no libc bump, since this is riding on djm's libc major crank from a day ago discussed with / requested by / testing theo, sthen@, djm@, jsg@, merdely@, jsing@, tedu@, brad@, jakemsr@, and others. looks good to millert@ parts of the diff ok kettenis@ this commit does not include: - man page changes
2008-06-24remove recalloc; sloppy me; ok deraadt@Otto Moerbeek
2008-06-20Remove obsolete (and erroneous) #if statement that caused all compilersAnders Magnusson
except for gcc to get the wrong prototype. Ok millert@
2008-06-13Add strtof() to libc, some ports seem to like it. Currently it's a simpleLandry Breuil
call to strtod() with bounding check. Discussed with pyr@ and otto@ ok otto@ deraadt@
2008-03-16diff from djm@ committed at his request:Otto Moerbeek
introduce two new APIs for requesting strong random numbers: arc4random_buf() - fill an arbitrary memory range with random numbers arc4random_uniform() - return a uniformly distributed random number below a specified upper bound, avoiding the bias that comes from a naive "arc4random() % upper_bound" construction. these mirror similarly-named functions in the kernel; lots of discussion deraadt@ mcbride@
2007-09-03add recaloc(3)Todd C. Miller
2006-09-17add lldiv prototype; ok deraadt@Damien Miller
2006-03-31after we changed mode_t to be an int, the devname() man page wasTheo de Raadt
updated but the function itself never was; ok millert
2006-01-13Add lldiv(), imaxabs(), imaxdiv(), strtoimax() and strtoumax()Todd C. Miller
2006-01-06Adapt things to use __type_t instead of _BSD_TYPE_T_Todd C. Miller
Add new sys/_types.h header Include machine/_types.h or sys/_types.h where applicable
2005-12-13First step in include files overhaul. Use __FOO_VISIBLE (as definedTodd C. Miller
in sys/cdefs.h) instead of _FOO_SOURCE. Also fix several namespace pollution issues, including the byte order defines. OK deraadt@
2005-05-27mktemp(3) et al. go in stdlib.h, not unistd.h. While there be moreTodd C. Miller
explicit about mktemp(3) in the man page.
2005-05-11major abi changes:Marc Espie
* introduce the mbstate_t typedef. impacts gnu libiconv, which has already been taken care of. * Prepare for mb stuff to really exist, replace macro MB_CUR_MAX with an external variable __mb_cur_max (impacts libX11 and various ports). * use mbstate in all the mb <-> wchar functions with state. * add a stub iswctype function allowing some ports to compile. bash and gdiff are missing wcscoll, and need to be told there's no i18n until this is fixed. Discussed and matthieu, otto, millert, kettenis, deraadt. Major libc bump
2004-08-03Update strtonum() protorTodd C. Miller
2004-05-03strtonum prototypeTed Unangst
2004-05-03Add _Exit(3) as per C99. Discussed with espie@ some time ago.Todd C. Miller
2004-01-21Prototype llabs(3). Forgotten commit gathering bit rot in my tree...Todd C. Miller
2003-08-01add __bounded__ attributes for userland headers; enabled with -WboundedAnil Madhavapeddy
ok deraadt@
2003-06-26backout the __bounded__ attributes for a while; requested by deraadt@Anil Madhavapeddy
2003-06-26Mark various standard library functions with the __bounded__ attribute.Anil Madhavapeddy
You must have an up-to-date gcc for this! deraadt@ ok
2003-06-02Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
2002-12-03GNU-like getopt_long() from NetBSD with changes by me to supportTodd C. Miller
getopt_long_only(). At some point this should replace the BSD getopt(3) but we are not there yet. While I am here add protection from the multiple getopt() definitions due to conflicting standards.
2002-12-02Add ecvt(), fcvt() and gcvt() for standard compliance and legacy code.Todd C. Miller
2002-12-02Add prototype for atoll(3). I must have forgotten to commit this bitTodd C. Miller
when I committed atoll(3).
2002-10-25NULL is now 0L so it is the same size as a pointer.Todd C. Miller
OK mickey@ and discussed with deraadt@
2002-06-29Replace strtou?q() with the more standard strtou?ll(), using weakTodd C. Miller
aliases to fake up strtou?q(). espie@ OK.
2002-02-20Revert local changes that snuck in to the last commit.Todd C. Miller
2002-02-20Some user header files may define an abs macro which will cause aTodd C. Miller
syntax error if the #define happens before stdlib.h is included. If abs is #defined, #undef and issue a warning. This is similar to what Tru64 UNIX does and is effectively the same as what happens on Solaris (though on Solaris the real abs() is a macro).
2002-02-17Manual cleanup of remaining userland __P use (excluding packages maintained ↵Todd C. Miller
outside the tree)
2002-02-16Part one of userland __P removal. Done with a simple regexp with some minor ↵Todd C. Miller
hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.