summaryrefslogtreecommitdiff
path: root/libc/stdio/_WRITE.c
AgeCommit message (Collapse)Author
2016-06-12Fix return value of fwrite when a 'hard' error occursJan Vangorp
When a 'hard' error occurs, fwrite reports that all data was written or buffered even if that is not the case. It should report how much data was actually written and buffered. Signed-off-by: Jan Vangorp <jan.vangorp_ext@softathome.com>
2016-06-01remove MJN only debug messagesWaldemar Brodkorb
2015-12-17libc/stdio: Rework custom streams interface similar to glibc.Waldemar Brodkorb
Save 20 bytes per FILE structure, avoid indirect call for read/write/seek/close operations for normal streams. Additionally, custom streams has fileno = -2 now, like in glibc. bloat-o-meter report (UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y): function old new delta fopencookie 69 131 +62 ftello64 233 260 +27 fseeko64 298 319 +21 fclose 423 442 +19 .rodata 16696 16708 +12 fileno_unlocked 53 45 -8 __ns_name_pack 859 851 -8 vswscanf 184 144 -40 vdprintf 231 187 -44 vsscanf 210 151 -59 vswprintf 269 201 -68 vsnprintf 249 181 -68 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/7 up/down: 141/-295) Total: -154 bytes Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com> Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2012-03-25stdio: prevent retries on fclose/fflush after write errorsDenys Vlasenko
Some test results: The longer patch posted at Sun 14:46:24 +0100 made my target system unbootable. I did not attempt to troubleshoot it, as we are focusing our efforts on the shorter patch now. The shorter patch posted at Mon 01:50:27 +0100 is a good start, but it didn't completely fix the problem for me. I am posting an updated version with a few changes at the end of this message; the patched uClibc 0.9.32.1 tree passes both of my test cases. My changes: 1) Need to break out of the loop on "hard" errors. Otherwise the library call never returns: open("/dev/null", O_RDONLY) = 4 dup2(4, 1) = 1 write(1, "hello world\n", 12) = -1 EBADF (Bad file descriptor) write(1, "hello world\n", 12) = -1 EBADF (Bad file descriptor) write(1, "hello world\n", 12) = -1 EBADF (Bad file descriptor) write(1, "hello world\n", 12) = -1 EBADF (Bad file descriptor) ... 2) Move all of the error handling logic back into the "else" clause. In particular, I believe we do not want to be checking errno unless __WRITE() had indicated a failure, since the value may be undefined: if (errno == EINTR || errno == EAGAIN /* do we have other "soft" errors? */ ) { 3) Whitespace/indentation consistency. -- 8< -- From: Denys Vlasenko <vda.linux@googlemail.com> Currently, uclibc retains buffered data on stdio write errors, and subsequent fclose and fflush will try to write it out again (in most cases, in vain). Which results in something like this: On Wednesday 26 January 2011 13:21, Baruch Siach wrote: > Hi busybox list, > > I'm running the following command under strace (thanks Rob): > > echo 56 > /sys/class/gpio/export > > and I see the following output: > > write(1, "56\n", 3) = -1 EBUSY (Device or resource busy) > write(1, "5", 1) = 1 > > The first EBUSY is OK, since GPIO 56 is already requested. But the second > write() attempt seems strange, and leads to an unwanted outcome. GPIO 5 gets > exported. This patch prevents that. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-03-11__stdio_WRITE: make code more readable. No code changesDenys Vlasenko
Pulled assignments out of ifs. do {...} while (1); is a weird method of writing "loop forever", thus rewrote it. No code changes: objdump output is the same. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-18trim Experimentally off and uncommented hiddenBernhard Reutner-Fischer
sed -i -e '/Experimentally off - /d' $(grep -rl "Experimentally off - " *) sed -i -e '/^\/\*[[:space:]]*libc_hidden_proto(/d' $(grep -rl "libc_hidden_proto" *) should be a nop Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2008-11-20next portion of libc_hidden_proto removalDenis Vlasenko
2006-12-06stdio update from mjn3Eric Andersen
2006-01-14other failures w/ different optionsPeter S. Mazinger
2006-01-06use hidden read/write symbolsMike Frysinger
2005-11-15Hide more of stdio,getdents, use internal __raisePeter S. Mazinger
2004-02-11New stdio core. Should be more maintainable. Fixes a couple of bugs.Manuel Novoa III
Codepaths streamlined. Improved performance for nonthreaded apps when linked with a thread-enabled libc. Minor iconv bug and some locale/thread related startup issues fixed. These showed up in getting a gcj-compiled java helloworld app running. Removed some old extension functions... _stdio_fdout and _stdio_fsfopen.