summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio
Commit message (Collapse)AuthorAgeFilesLines
* Add _flags2 per jhb@ suggestion since no room left in _flags.ache2015-10-286-10/+7
| | | | | | Rewrite O_APPEND flag checking using new __S2OAP flag. MFC after: 3 weeks
* According to POSIX, a write operation shall start at the current size ofache2015-10-251-0/+3
| | | | | | the stream (if mode had 'a' as the first character). MFC after: 1 week
* Since no room left in the _flags, reuse __SALC for O_APPEND.ache2015-10-245-19/+31
| | | | | | | It helps to remove _fcntl() call from _ftello() and optimize seek position calculation in _swrite(). MFC after: 3 weeks
* Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.rodrigc2015-09-203-8/+6
|
* Remove names from some prototypesrodrigc2015-09-201-1/+1
|
* Remove names from some prototypesrodrigc2015-09-201-2/+2
|
* Add declarations to eliminate -Wmissing-prototypes warningsrodrigc2015-09-203-0/+6
|
* Switch libc from using _sig{procmask,action,suspend} symbols, whichkib2015-08-291-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | are aliases for the syscall stubs and are plt-interposed, to the libc-private aliases of internally interposed sigprocmask() etc. Since e.g. _sigaction is not interposed by libthr, calling signal() removes thr_sighandler() from the handler slot etc. The result was breaking signal semantic and rtld locking. The added __libc_sigprocmask and other symbols are hidden, they are not exported and cannot be called through PLT. The setjmp/longjmp functions for x86 were changed to use direct calls, and since PIC_PROLOGUE only needed for functional PLT indirection on i386, it is removed as well. The PowerPC bug of calling the syscall directly in the setjmp/longjmp implementation is kept as is. Reported by: Pete French <petefrench@ingresso.co.uk> Tested by: Michiel Boland <boland37@xs4all.nl> Reviewed by: jilles (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Fix a couple of markup typos.jhb2015-08-021-3/+3
| | | | MFC after: 2 weeks
* Add fdclose(3) function.oshogbo2015-07-043-27/+134
| | | | | | | | | | This function is equivalent to fclose(3) function except that it does not close the underlying file descriptor. fdclose(3) is step forward to make FILE structure private. Reviewed by: wblock, jilles, jhb, pjd Approved by: pjd (mentor) Differential Revision: https://reviews.freebsd.org/D2697
* Reassign copyright statements on several files from Advancedjhb2015-04-233-3/+3
| | | | | | | Computing Technologies LLC to Hudson River Trading LLC. Approved by: Hudson River Trading LLC (who owns ACT LLC) MFC after: 1 week
* Support file verification in MAC.rodrigc2015-04-221-0/+4
| | | | | | | | | | | | | | * Add VCREAT flag to indicate when a new file is being created * Add VVERIFY to indicate verification is required * Both VCREAT and VVERIFY are only passed on the MAC method vnode_check_open and are removed from the accmode after * Add O_VERIFY flag to rtld open of objects * Add 'v' flag to __sflags to set O_VERIFY flag. Submitted by: Steve Kiernan <stevek@juniper.net> Obtained from: Juniper Networks, Inc. GitHub Pull Request: https://github.com/freebsd/freebsd/pull/27 Relnotes: yes
* libc: clean some set-but-not-used errors.pfg2015-02-181-3/+0
| | | | | | | These were found by gcc 5.0 on Dragonfly BSD, however I made no attempt to silence the false positives. Obtained from: DragonFly (cf515c3a6f3a8964ad592e524442bc628f8ed63b)
* In r268924 __fflush was modified so that when write(2) was not successful,delphij2014-12-101-4/+6
| | | | | | | | | | | | _p and _w are adjusted to account for the partial write (if any). However, _p and _w should not be unconditionally adjusted and should only be changed when we actually wrote some bytes, or the accumulated accounting error will eventually result in a heap buffer overflow. Reported by: adrian and alfred (Norse Corporation) Security: FreeBSD-SA-14:27.stdio Security: CVE-2014-8611
* Fix prototypes.kevlo2014-10-281-3/+3
|
* Fix the example: free the memory that was allocated by getline().n_hibma2014-07-311-0/+1
|
* In the "Too many open files" edge cases don't try to preserve oldache2014-07-261-0/+8
| | | | | | | number for non-std* descriptors, but close old file and retry. Obtained from: inspired by Apple's change from pfg@ MFC after: 2 weeks
* Avoid possible cast degradation.pfg2014-07-222-2/+2
| | | | | | | | | | | For consistency with r268985 for fputs.c, assign iov_len first, avoiding the cast to uio_resid (int in stdio) from degrading the value. We currently don't support lengths higher than INT_MAX so this change is little more than cosmetic. MFC after: 3 days
* For "a"-mode files and rewind/fseek + fwrite combination return meaningfulache2014-07-221-0/+18
| | | | | value now, like Apple does, but avoid their __sflush physical write performance degradation as much as possible.
* Back the whole change out until I figure out how to obtain O_APPEND,ache2014-07-221-6/+0
| | | | it can't be used in this field at all.
* Checking for __SAPP alone is not enough because it is emulated O_APPENDache2014-07-221-1/+2
| | | | only, so works for only special fdopen() case. Add real O_APPEND too.
* Revert r268984:pfg2014-07-221-2/+5
| | | | | | | | Check for __SAPP flag before calling sflush. This avoids performance degradation compared to the previous approach. Submitted by: ache MFC after: 2 weeks
* Mostly cosmetic cleanups.pfg2014-07-222-3/+3
| | | | | | In fputs() avoid implcit casting on iov.iov_len. MFC after: 3 days
* ftello: return 1 when seeking offset on an append stream.pfg2014-07-221-0/+2
| | | | | | Obtained from: Apple Inc. (Libc 997.90.3) Phabric: D442 MFC after: 2 weeks
* rewind: always clear error indicator.pfg2014-07-221-3/+2
| | | | | | | | Required by POSIX: http://pubs.opengroup.org/onlinepubs/009695399/functions/rewind.html Obtained from: Apple Inc. (Libc 997.90.3) MFC after: 1 week
* Adjust errno on failed prepwrite.pfg2014-07-203-3/+10
| | | | | | Obtained from: Apple Inc. (Libc 997.90.3) Phabric: D442 MFC after: 1 week
* Const-ify a character string.pfg2014-07-201-1/+1
| | | | | Obtained from: Apple Inc. (Libc 997.90.3) MFC after: 3 days
* Use a correct errno in freopen.pfg2014-07-201-1/+1
| | | | | | | | | Use EBADF instead of EINVAL when working around incorrect O_ACCMODE. Phabric: D442 Obtained from: Apple Inc. (Libc 997.90.3) Reviewed by: jilles MFC after: 1 week
* Update fflush(3) to return success on a read-only stream.pfg2014-07-201-9/+16
| | | | | | | | | | This has small changes to what Apple uses for compliance with SUSv3. The changes cause no secondary effects in the gnulib tests (we pass them). Obtained from: Apple Inc. (Libc 997.90.3 with changes) Reviewed by: bde Phabric: D440
* use .Mt to mark up email addresses consistently (part4)bapt2014-06-231-2/+2
| | | | | PR: 191174 Submitted by: Franco Fichtner <franco at lastsummer.de>
* - Return NULL and set errno to EINVAL if size is 0 (as required by POSIX).gahr2014-06-022-8/+18
| | | | | | | | | | Update the manpage to reflect this change. - Always set the current position to the first null-byte when opening in append mode. This makes the implementation compatible with glibc's. Update the test suite. Reported by: pho Approved by: cognet
* libc/stdio: Fail fdopen() on an execute-only fd.jilles2014-04-212-3/+5
| | | | | | | | | An execute-only fd (opened with O_EXEC) allows neither read() nor write() and is therefore incompatible with all stdio modes. Therefore, the [EINVAL] error applies. Also adjust the similar check in freopen() with a NULL path, even though this checks an fd which is already from a FILE.
* libc man pages: Remove reference to non-existent FreeBSD Securityeadler2014-03-071-2/+0
| | | | | | Architecture MFC After: 3 days
* Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}marcel2014-03-041-2/+2
| | | | | | | | | | | if not already defined. This allows building libc from outside of lib/libc using a reach-over makefile. A typical use-case is to build a standard ILP32 version and a COMPAT32 version in a single iteration by building the COMPAT32 version using a reach-over makefile. Obtained from: Juniper Networks, Inc.
* Add missing include files for the printf_l and scanf_l man pages.eadler2013-11-172-0/+2
| | | | Reported by: swildner@dragonflybsd.org
* libc/stdio: Allow fopen/freopen modes in any order (except initial r/w/a).jilles2013-09-061-27/+28
| | | | | | | | | | Austin Group issue #411 requires 'e' to be accepted before and after 'x', and encourages accepting the characters in any order, except the initial 'r', 'w' or 'a'. Given that glibc accepts the characters after r/w/a in any order and that diagnosing this problem may be hard, change our libc to behave that way as well.
* libc: Always use our own copy of sys_errlist and sys_nerr (.so only).jilles2013-08-311-1/+2
| | | | | | | | | | | | | | | This ensures strerror() and friends continue to work correctly even if a (non-PIE) executable linked against an older libc imports sys_errlist (which causes sys_errlist to refer to the executable's copy with a size fixed when that executable was linked). The executable's use of sys_errlist remains broken because it uses the current value of sys_nerr and may access past the bounds of the array. Different from the message "Using sys_errlist from executables is not ABI-stable" on freebsd-arch, this change does not affect the static library. There seems no reason to prevent overriding the error messages in the static library.
* Add mkostemp() and mkostemps().jilles2013-08-094-21/+106
| | | | | These are like mkstemp() and mkstemps() but allow passing open(2) flags like O_CLOEXEC.
* Typo corrected.schweikh2013-07-121-1/+1
|
* mktemp(3): Add standards section. Prefer standard header.jilles2013-07-051-4/+29
| | | | | | mktemp(), mkstemp() and mkdtemp() are available in standard <stdlib.h> and also in <unistd.h>. Encourage use of the former by listing it in the synopsis.
* Convert libc/stdio from K&R to ANSI Cemaste2013-04-2334-151/+53
| | | | And add '__restrict' where it appeared in the header prototypes
* Renumber clauses to reduce diffs to other versionsemaste2013-04-2370-70/+70
| | | | | | | NetBSD, OpenBSD, and Android's Bionic all number the clauses 1 through 3, so follow suit to make comparison easier. Acked-by: imp@
* Spelling correctionemaste2013-04-111-1/+1
|
* Remove unused atomic headeremaste2013-04-111-1/+0
|
* mdoc: add missing El.joel2013-02-271-0/+1
|
* Add an implementation of open_memstream() and open_wmemstream(). Thesejhb2013-02-275-1/+639
| | | | | | | | | routines provide write-only stdio FILE objects that store their data in a dynamically allocated buffer. They are a string builder interface somewhat akin to a completely dynamic sbuf. Reviewed by: bde, jilles (earlier versions) MFC after: 1 month
* setbuf(3): Restore a BUGS section about setbuf().jilles2013-02-181-1/+4
| | | | | | | The brokenness of setbuf() is not specific to 4.2BSD and 4.3BSD but inherent in the API definition. Reported by: bde
* setbuf(3): Remove bugs section about ancient versions of BSD.jilles2013-02-151-17/+1
|
* mdoc: Remove EOL whitespace.joel2013-02-091-1/+1
|
* - Fix more style(9)-related issues (copyright header, spaces after functiongahr2013-02-011-56/+55
| | | | | | | | | names, unnecessary casts) - Change type of boolean variable from char to bool Suggested by: jhb, zont, jmallett Reviewed by: cognet Approved by: cognet
OpenPOWER on IntegriCloud