summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix the handle locking in stdio to use flockfile/funlockfileguenther2009-10-2144-133/+276
| | | | | | | | | | | | internally when and where required. Macros in <stdio.h> are updated to automatically call the underlying functions when the process is threaded to obtain the necessary locking. A private mutex is added to protect __sglue, the internal list of FILE handles, and another to protect the one-time initialization. Some routines in libc that use getc() change to use getc_unlocked() as they're either protected by their own lock or aren't thread-safe routines anyway. ok kurt@, earlier version tested by sthen@ and jj@
* teach gdtoa & its subroutines that malloc can fail; in which casemartynas2009-10-161-1/+17
| | | | | | ecvt, fcvt, gcvt, *printf, strtof, strtod, strtold act per ieee 1003.1. after these massive changes, remove unused files which would not work now. reported by Maksymilian Arciemowicz; ok theo
* cvs log message from ed@freebsd, revision 197045:jmc2009-09-101-3/+3
| | | | | | | | | | | Make the description of `b' a little better. If you have a one-byte sequence, `w', `b' is the second character. Not the third. Submitted by: Christoph Mallon checked by otto
* fwrite() should also return 0 if either size or nmemb are 0.millert2009-07-123-8/+22
| | | | Adapted from FreeBSD. OK deraadt@
* Set errno to EINVAL when fgets is given a non-positive size.ray2009-06-022-4/+11
| | | | OK millert otto
* accept %F, which actually behaves the same as %f. per C99martynas2009-04-052-4/+5
| | | | ok millert@
* Return -1 from mktemp_internal() on EINVAL like we used to.millert2009-03-201-3/+3
| | | | OK oga@ thib@
* Update to match mktemp.c changesmillert2009-03-011-4/+4
|
* New mktemp(3) based on the one from portable mktemp(1). Now includesmillert2009-03-011-89/+88
| | | | | | | digits (in addition to letters) in the random file name. Instead of looping forever, mktemp(3) will terminate when it has tried 2 * N^62 times where N is the number of X's. This is effectively forever for lots of X's.
* when the template is entirely XXX characters, would crashderaadt2009-02-171-4/+6
| | | | | from Vadim Zhukov <persgray@gmail ok millert
* from Yoshihiko Sarumaru, freebsd pr #76333: fseek(3) can clear EOF too;jmc2009-01-291-4/+2
| | | | ok millert
* The process number is longer used to replace trailing 'Xs'.tobias2009-01-101-4/+3
| | | | ok jmc, millert
* use decimal point from locale. ok millert@martynas2008-10-211-3/+3
|
* add missing header needed by strlen().chl2008-09-151-1/+2
| | | | ok millert@
* - describe how printf(1) and printf(3) %e, %E, %g, %G, %a, %A behavemartynas2008-09-151-2/+38
| | | | | when the argument is infinity/not-a-number ok millert@, jmc@
* describe %a/%A. from freebsdmartynas2008-09-141-2/+58
| | | | tweaks/ok millert@, jmc@
* - replace dtoa w/ David's gdtoa, version 2008-03-15martynas2008-09-072-162/+212
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* comment fixesmartynas2008-08-271-7/+7
|
* - add Fmartynas2008-08-262-11/+33
| | | | | | - make inf INF nan NAN comply to standards (eEfFgG) - extend man page bits ok millert@. w/ a man page tweak and ok jmc@
* don't zero-pad special values. ok millert@martynas2008-08-261-1/+3
|
* Replace the old algorithm that included the process id as part of themillert2008-08-221-49/+20
| | | | temporary file name with one that only uses random data. OK deraadt@
* Remove useless code, the kernel will set errno appropriately if anmillert2008-08-211-21/+1
| | | | element in the path does not exist. OK deraadt@ pvalchev@
* use arc4random_uniform(); ok djm millertderaadt2008-07-221-2/+2
|
* - handle sign of negative zero. use sign dtoa setsmartynas2008-07-101-11/+6
| | | | | | - remove 'value < 0' cruft, dtoa already clears sign bit for us discussed with, and tested by phessler@ ok millert@, who noticed to remove now-unused variable, and phessler@
* Fix ssize_t vs. size_t mismatchmillert2008-05-161-2/+2
|
* C99 says that for each va_copy() there must be a matching va_end().millert2008-05-161-30/+59
| | | | | Replace the non-portable hackery in __find_arguments() with a union. From FreeBSD.
* Don't forget to va_end() the va_list we get from va_copy(). From FreeBSD.millert2008-05-131-1/+2
|
* add missing header for getpagesizechl2008-05-051-1/+2
| | | | ok espie@
* add missing header for closechl2008-05-031-1/+2
| | | | ok otto@ espie@ millert@
* _file is only a short, so prevent truncation if we happen to hitotto2008-04-213-3/+28
| | | | | upon a fd > SHRT_MAX. From freebsd via Jan Schaumann; ok deraadt@ millert@ espie@
* %hhd was being printed as if %hd was specifiedderaadt2007-11-281-11/+16
| | | | ok millert tedu
* Comment fix about time consumption of _gettemp.tobias2007-10-211-5/+2
| | | | | | FreeBSD did this in revision 1.20. OK deraadt@, krw@
* Add some more truncation checks for path construction in tmpnam(3).moritz2007-09-211-8/+24
| | | | ok ray@
* Prevent out-of-bounds memory access in tempnam(3), if the environmentmoritz2007-09-171-3/+4
| | | | | | variable TMPDIR or the argument `dir' is an empty string. With and ok millert@ ray@
* Say NUL when referring to \0cloder2007-09-071-3/+3
|
* Show how to use strcspn(3) to trim newlines.ray2007-08-081-7/+5
| | | | OK jmc and millert.
* The `len' argument is guaranteed to be > 0 upon successful completion.moritz2007-06-211-3/+3
| | | | ok jmc@ ray@ millert@
* convert to new .Dd format;jmc2007-05-3127-54/+54
|
* Document errno usage. From Tobias Stoeckmann.ray2007-05-121-2/+16
| | | | Earlier diff OK jmc@, with nit by otto@.
* grammar,espie2007-05-101-2/+2
| | | | okay jmc@
* clarify return values, prompted by moritz; ok moritz jmcderaadt2007-04-011-4/+8
|
* Remove and simplify an impossible case (if *p = memchr(cp, 0, prec),ray2007-01-301-9/+7
| | | | | | | | | | | p - cp cannot be greater than prec). Prevent an integer overflow when printing a string with length greater than INT_MAX. Initial diff from millert@. OK millert@, beck@, and otto@.
* add an ENVIRONMENT section for TMPDIR;jmc2007-01-291-1/+15
| | | | | | from freebsd pr# 108346, from Anton Yuzhaninov much tweaked by otto and myself;
* Fix potential int overflow for printf(3) when passing in very largemillert2007-01-161-13/+50
| | | | values for the field width. Adapted from a diff by Christian Biere.
* try first mmap() allocation at pagesize, no need to re-mmap at every powerderaadt2006-11-261-1/+4
| | | | of 2 from 16 to pagesize(); ok otto
* suceed -> succeed; from chad doughertyjmc2006-10-301-2/+2
|
* make __dtoa & strtod() thread-safe useing the same method as newer gdtoaderaadt2006-10-291-4/+11
| | | | | codebase. tested mostly by ckuethe and myself. __dtoa() use now requires a call to __freedtoa()
* mark up `>';jmc2006-10-151-3/+3
|
* Add a CAVEAT section that describes how to properly trim a newline fromcloder2006-10-141-10/+41
| | | | | a string, being careful to deal with 0-length strings. Help and input from jmc, ok deraadt
* Make fgets description much clearer with respect to its exact behavior.cloder2006-10-141-7/+9
| | | | OK and input from deraadt, jmc, millert.