summaryrefslogtreecommitdiff
path: root/src/stdio
AgeCommit message (Collapse)AuthorFilesLines
2011-04-05fix overflow in printf %N$ argument handlingRich Felker1-2/+2
2011-04-05fix various floating point rounding and formatting errors in *printfRich Felker1-17/+25
2011-04-04simplify vdprintf implementation greatly based on recent vfprintf changesRich Felker1-5/+2
since vfprintf will provide a temporary buffer in the case where the target FILE has a zero buffer size, don't bother setting up a real buffer for vdprintf. this also allows us to skip the call to fflush since we know everything will be written out before vfprintf returns.
2011-04-04use a local temp buffer for unbuffered streams in vfprintfRich Felker2-0/+14
this change makes it so most calls to fprintf(stderr, ...) will result in a single writev syscall, as opposed to roughly 2*N syscalls (and possibly more) where N is the number of format specifiers. in principle we could use a much larger buffer, but it's best not to increase the stack requirements too much. most messages are under 80 chars.
2011-04-02don't disable seeking after first seek failureRich Felker1-8/+0
this could cause problems if the application uses dup2(fd,fileno(f)) to redirect, and the old fd was not seekable but the new fd is.
2011-04-02apparently fseek should not set the error flag on failed seekRich Felker1-4/+1
2011-03-29fix tempnam name generation, and a small bug in tmpnam on retry limitRich Felker2-21/+20
2011-03-29make tmpfile fail after exceeding max tries.Rich Felker1-2/+6
2011-03-29fix tmpnam to generate better names, not depend on non-ISO-C symbolsRich Felker1-25/+17
2011-03-29fix messed-up errno if remove fails for a non-EISDIR reasonRich Felker1-2/+2
2011-03-29learned something new - remove is supposed to support directories on POSIXRich Felker1-1/+3
2011-03-28revert some more spin optimizations that turned out to be pessimizationsRich Felker1-1/+1
2011-03-28fix getc - the classic error of trying to store EOF+0-255 in a char type..Rich Felker1-3/+3
2011-03-28major stdio overhaul, using readv/writev, plus other changesRich Felker35-268/+235
the biggest change in this commit is that stdio now uses readv to fill the caller's buffer and the FILE buffer with a single syscall, and likewise writev to flush the FILE buffer and write out the caller's buffer in a single syscall. making this change required fundamental architectural changes to stdio, so i also made a number of other improvements in the process: - the implementation no longer assumes that further io will fail following errors, and no longer blocks io when the error flag is set (though the latter could easily be changed back if desired) - unbuffered mode is no longer implemented as a one-byte buffer. as a consequence, scanf unreading has to use ungetc, to the unget buffer has been enlarged to hold at least 2 wide characters. - the FILE structure has been rearranged to maintain the locations of the fields that might be used in glibc getc/putc type macros, while shrinking the structure to save some space. - error cases for fflush, fseek, etc. should be more correct. - library-internal macros are used for getc_unlocked and putc_unlocked now, eliminating some ugly code duplication. __uflow and __overflow are no longer used anywhere but these macros. switch to read or write mode is also separated so the code can be better shared, e.g. with ungetc. - lots of other small things.
2011-03-25fix all implicit conversion between signed/unsigned pointersRich Felker6-8/+8
sadly the C language does not specify any such implicit conversion, so this is not a matter of just fixing warnings (as gcc treats it) but actual errors. i would like to revisit a number of these changes and possibly revise the types used to reduce the number of casts required.
2011-03-24simplify and optimize FILE lock handlingRich Felker4-11/+12
2011-03-24fix non-atomicity of putsRich Felker1-1/+5
2011-03-20global cleanup to use the new syscall interfaceRich Felker12-19/+19
2011-03-18implement [v]swprintfRich Felker2-0/+60
2011-03-17implement wprintf family of functionsRich Felker4-0/+387
this implementation is extremely ugly and inefficient, but it avoids a good deal of code duplication and bloat. it may be cleaned up later to eliminate the remaining code duplication and some of the warts, but i don't really care about its performance. note that swprintf is not yet implemented.
2011-03-16optimize file locking: avoid cache-polluting writes to global storageRich Felker2-3/+5
2011-03-14partially-written draft of fmemopen, still in #if 0Rich Felker1-3/+48
2011-03-12implement flockfile api, rework stdio lockingRich Felker6-3/+54
2011-02-22rewind must clear the error indicator in addition to seekingRich Felker1-2/+5
2011-02-20avoid referencing address of extern function from vdprintfRich Felker1-1/+6
this change is in preparation for upcoming PIC/shared library support. the intent is to avoid going through the GOT, mainly so that dprintf is operable immediately, prior to processing of relocations. having dprintf accessible from the dynamic linker will make writing and debugging the dynamic linker much easier.
2011-02-20cleanup asprintf stuffRich Felker2-2/+2
2011-02-20fix %n specifier, again. this time it was storing the wrong value.Rich Felker1-7/+7
2011-02-16fix printf %n specifier - missing breaks had it clobbering memoryRich Felker1-7/+7
2011-02-14fix some pointer signedness issues (this was invalid C)Rich Felker2-3/+3
2011-02-13cleaning up syscalls in preparation for x86_64 portRich Felker1-1/+7
- hide all the legacy xxxxxx32 name cruft in syscall.h so the actual source files can be clean and uniform across all archs. - cleanup llseek/lseek and mmap2/mmap handling for 32/64 bit systems - alternate implementation for nice if the target lacks nice syscall
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker96-0/+2857