summaryrefslogtreecommitdiff
path: root/lib/libc/stdio
AgeCommit message (Collapse)Author
2023-04-04PR/57250: Martin Husemann: dtoa mishandles infinite doubles on 32bit bigchristos
endian machines. When long double support was added, the old code was kept for the regular double code. This code was never used because WIDE_DOUBLE was always defined in the Makefile. Remove that old code, and conditionalize the WIDE_DOUBLE code based on if long doubles are different than doubles on the specific platform.
2022-05-24fix various typos in comments, docs and log messages.andvar
2022-04-19lib: remove CONSTCOND commentrillig
Since 2021-01-31, lint doesn't need it anymore for the common pattern of 'do ... while (0)'.
2022-04-03Improve wording to avoid confusion about the return value of {v,}asprintf(3)christos
2022-03-12reallocarr returns errno. preserve it.christos
2022-03-12vfwprintf(3): use reallocarrnia
2021-12-12fix typos in word "operation(s)".andvar
2021-10-28Use .Sq instead of a dangling .Sokim
2021-09-23printf(3): mention snprintb(3)wiz
2021-09-11fseek.3: fix grammarrillig
2021-07-25Update to reflect current reality for template characters - the processsimonb
ID is not longer used and we replace each "X" with one of 64 values not 26 values.
2021-07-22revert changes to fflush.c (1.18) and fvwrite.c (1.25) until we investigatechristos
collateral damage. Breaks h_intr.c test. Requested by RVP.
2021-07-19There's no need to adjust `iov' in the error path.christos
Returning the amount written is all that's needed. from RVP
2021-07-16When fflush fails, adjust pointers and the io vectors. From RVP. Fixeschristos
core-dump at cvs(1) exit(3).
2021-07-09Don't adjust the buffers when write returns 0. This happens with fmemopenchristos
and other synthetic write functions. This fixes the unit-tests for fmemopen, but adjusting should be the right behavior for all cases?
2021-07-08Include the 0 return from write. Although the real write system call doeschristos
not return 0, the synthetic writes from funopen/fmemopen could. This avoids infinite loops in >= test19 in fmemopen, but the tests still fail, perhaps because they assume the previous behavior, where flush does not adjust the stdio pointers on error.
2021-07-08Obey EINTR and return immediately adjusting for unwritten. From RVPchristos
2021-07-06Handle EINTR, from RVP.christos
2021-07-05Account for partial writes when interrupted (from FreeBSD).christos
2021-02-16Correct floating-point terminology.riastradh
Might want to harmonize the printf(3) and wprintf(3) descriptions of `%a'.
2021-02-07restore change from rev 1.23 "Avoid undefined behavior in fread(3)", mistakelyjdolecek
removed as part __SNBF optimization
2021-02-01for fread(3) and fwrite(3) check for (size * nmemb) size_t overflow, andjdolecek
error out with EOVERFLOW if it happens; this is less silly answer to a silly call than returning some randomly wrapped length change adapted from OpenBSD FreeBSD has a similar check, but they return EINVAL instead, feel free to adjust if SUS or other standard mandates specific value suggested by Kamil Rytarowski
2021-01-31for unbuffered I/O arrange for the destination buffer to be filled in onejdolecek
go, instead of triggering long series of 1 byte read(2)s; this speeds up fread() several order of magnitudes for this case, directly proportional to the size of the supplied buffer change adapted from OpenBSD rev. 1.19 fixes PR lib/55808 by Roland Illig
2020-08-29stdio(3): fix typos in the manual pagerillig
fputc cannot read characters, it can only write them.
2020-08-28Allow vdprintf to work on non-blocking non-regular files (Rob Newberry)christos
2020-02-22Avoid undefined behavior in fread(3)kamil
On the first call to fread(3), just after fopen(3) the internal buffers are empty. This means that _r and _p (among others) are zeroed. Passing NULL to the 2nd argument of memcpy(3) for the zero length is undefined. Calling _p += 0 triggers LLVM UBSan (NULL pointer arithmetic). Calling _p += 0, p += 0 and resid -= 0 has no effect. Replace the "fp->_r = 0;" logic with a short circuit jump to __srefill() that sets _r internally and refills the FILE buffers. No functional change from an end user point of view, except skipping a few dummy operations on the first call, for a FILE pointer, to fread(3).
2019-09-07Document historysevan
2019-09-02putc & putw were in v1sevan
https://www.bell-labs.com/usr/dmr/www/man31.pdf putchar was in v4 https://minie.tuhs.org/cgi-bin/utree.pl?file=V4/man/man3/putchr.3
2019-09-02Start documenting historysevan
https://www.bell-labs.com/usr/dmr/www/man31.pdf
2019-09-01Refer to "w+" as "mode" as that's what fopen(3) calls it.uwe
2019-03-21Minor markup and wording fixes.uwe
2019-01-23remove diag assert - the compiler demands fp is non NULL now.mrg
2018-12-14Don't leave a subordinate clause out in the cold.uwe
2018-12-14Fix typo in the function comment.uwe
2018-07-04Indent.msaitoh
2018-02-22Remove extra "an"pgoyette
Thanks to J. Lewis Muir
2018-02-20Markup "stdin".uwe
2018-02-20Make the list of STDBUF values and the list of mode values congruentuwe
in formatting and spelling.
2018-02-20Use semantic markup.uwe
2018-02-20Remove ineffective macros and arguments.wiz
2018-02-20Improve the setbuf(3) man-pagekamil
Move historical lines to newly added HISTORY section. Additional historical notes obtained from OpenBSD.
2018-02-04fixes for GCC 6:mrg
- -Wstrict-prototypes is not available for C++, so don't try to ignore it for C++. - remove many _DIAGASSERT() checks against not NULL for functions with arguments with nonnull attributes. in two cases, leave code behind that should set defaults to "(null)". - use -Wno-error=frame-address for i386 mcount, as it seems valid to assume the caller will have a frame.fair
2018-01-17Revert to commits as they broke few rump testskamil
"Include namespace.h in a few of libc source files [...] This change finishes elimination of usage of the global name of the following symbols: - close -> _close - execve -> _execve - fcntl -> _fcntl - setcontext -> _setcontext - wait6 -> _wait6 - write -> _write - writev -> _writev" "Register more syscalls in namespace.h (of libc) Add weak symbols for: - fcntl - close - execve - setcontext - wait6 - write - writev" These changes broke: fs/nfs/t_rquotad:get_nfs_be_1_both fs/nfs/t_rquotad:get_nfs_be_1_group fs/nfs/t_rquotad:get_nfs_be_1_user fs/nfs/t_rquotad:get_nfs_le_1_both fs/nfs/t_rquotad:get_nfs_le_1_group fs/nfs/t_rquotad:get_nfs_le_1_user lib/librumphijack/t_config:fdoff lib/librumphijack/t_tcpip:http lib/librumphijack/t_tcpip:nfs lib/librumphijack/t_vfs:cpcopy lib/librumphijack/t_vfs:mv_x lib/librumphijack/t_vfs:paxcopy net/net/t_forwarding:ipforwarding_fastforward_v4 net/net/t_forwarding:ipforwarding_fastforward_v6 net/net/t_forwarding:ipforwarding_fragment_v4 net/net/t_forwarding:ipforwarding_misc net/net/t_mtudisc6:mtudisc6_basic This revert fixes the failures, except lib/librumphijack/t_vfs. The original changes were added in order to facilitate a usage of sanitizers against programs linked with NetBSD's libc. It is no longer needed, so abandon these changes. Sponsored by <The NetBSD Foundation>
2018-01-05Include namespace.h in a few of libc source fileskamil
The NetBSD Standard C Library uses internally some of its functions with a mangled symbol name, usually "_symbol". The internal functions shall not use the global (public) symbols. This change finishes elimination of usage of the global name of the following symbols: - close -> _close - execve -> _execve - fcntl -> _fcntl - setcontext -> _setcontext - wait6 -> _wait6 - write -> _write - writev -> _writev Sponsored by <The NetBSD Foundation>
2017-12-31Fix plurals.dholland
2017-11-09Add O_REGULAR to enforce opening of only regular fileschristos
(like we have O_DIRECTORY for directories). This is better than open(, O_NONBLOCK), fstat()+S_ISREG() because opening devices can have side effects.
2017-11-04Be more consistent with how we refer to fopen() - pointed out by wiz@kre
2017-11-04Some (mostly minor) wording improvements (IMO)kre
2017-11-04Fix xref. Remove Tn.wiz
2017-11-04Avoid losing a fd (ie: close it) in the (ever so likely) case that thekre
fd exceeds the limits of what can be stored in a FILE (65535).