summaryrefslogtreecommitdiff
path: root/libc/stdio/_stdio.h
AgeCommit message (Collapse)Author
2016-06-12Fix infinite loop when fopencookie custom write returns 0 on errorJan Vangorp
The man page for fopencookie prescribes that custom write functions should return 0 on error (and should definitely not return a negative value) [1]. However, the uClibc implementation expects a negative return value in case of an error (libc/stdio/_WRITE.c). If the write function returns 0 on error, we drop into an infinite loop if the error persists. This patch wraps the user supplied write function such that a 0 return value is converted to -1. errno is first set to EAGAIN such that if the custom write function does not set errno in case of error, this is treated as a "soft" error. Custom write functions that cater towards uClibc and _do_ return a negative value are not affected. If no custom write function is supplied, set errno to EINVAL such that this condition is treated as a "hard" error. Previously the behaviour depended on whether the last error before the write happened to be a "hard" or a "soft" error. [1] http://git.kernel.org/cgit/docs/man-pages/man-pages.git/tree/man3/fopencookie.3?id=6c0d0ef0c7a9c4bcf805c6f9e9bc1ef1c3865ea0#n164 Signed-off-by: Jan Vangorp <jan.vangorp_ext@softathome.com>
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-06-15_stdio.h: move _load_inttype.h and _store_inttype.h prototypes herePeter S. Mazinger
Use one common prototype for consistency. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-06-15uClibc_stdio.h: move internal to _stdio.h and make them hiddenPeter S. Mazinger
Move __stdio_mutex_init,_stdio_openlist_{use,del}_count to _stdio.h. Make _stdio_validate_FILE hidden. Make _stdio_openlist_{add,del}_lock hidden for non-NPTL. Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2011-11-17stdio: hide _stdio_validate_FILEBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-10-17rework internal uClibc mutexes to support futex locking, and nptlAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2008-11-22fix some unneeded PLT referencesDenis Vlasenko
2008-04-10remove "register" from _vf[w]printf_internal declarations tooDenis Vlasenko
2008-04-09Factor out the core of vprintf() into separate functionDenis Vlasenko
vprintf_internal, so that: * vprintf() does locking and __STDIO_STREAM_TRANS_TO_WRITE thing, then calls vprintf_internal * vsnprintf, vdprintf.c, vasprintf.c use vprintf_internal directly This makes sprintf faster (since it doesn't do any locking) and stops it from pulling in fseek in static compile.
2006-12-12Fix/disable locking when pthreads is disabledEric Andersen
2006-12-08Fill in a few more of the missing pieces...Eric Andersen
2006-12-06stdio update from mjn3Eric Andersen
2006-03-10Remove all non-constant libc_hidden_data_def(), it is too unreliable, sorry, ↵Peter S. Mazinger
most of global data relocations are back
2006-02-13Remove unused prototypesPeter S. Mazinger
2006-02-01global data uses libc_hidden_data_def, convert all -I hope- and add some newPeter S. Mazinger
2006-01-22Enable _GNU_SOURCE build wide, trying to get consistent interfaces, else IMA ↵Peter S. Mazinger
is a useless attempt
2006-01-16Last relocs jump and global data, (even locales) that I could remove are ↵Peter S. Mazinger
gone from libc. The remaining are left as exercise for others ;-)
2006-01-14hidden_def/hidden_proto: convert all users (I hope) termios split, add some ↵Peter S. Mazinger
missing headers, other jump relocs removed
2005-12-16Get rid of warnings, use internals, create new hidden versionsPeter S. Mazinger
2005-12-09Implement hidden listen, use the hidden listen/acceptPeter S. Mazinger
2005-12-09Guard wchar dependent stuff properly, thx vapierPeter S. Mazinger
2005-12-09Implement hidden *scanfPeter S. Mazinger
2005-12-09Implement all needed hidden *printf and correct vasprintf, thx blindvtPeter S. Mazinger
2005-12-04More hiding, 300 leftPeter S. Mazinger
2005-12-03Rename newly created __libc_x (reserved for libpthread overwrites) w/ ↵Peter S. Mazinger
x_internal, do not use cascading aliases
2005-11-27Hide some of mem* and str*Peter S. Mazinger
2005-11-26Adapt to renamed internal __f{ge.pu}tc_unlockedPeter S. Mazinger
2005-11-21Hide somePeter S. Mazinger
2005-11-19make sure we pull in features.hMike Frysinger
2005-11-15Hide more of stdio,getdents, use internal __raisePeter S. Mazinger
2005-11-15Update copyright noticePeter S. Mazinger
2005-11-15Hide some internally used functionsPeter S. Mazinger
2004-05-07Fix a couple of issues in configurations I hadn't tested.Manuel Novoa III
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.