summaryrefslogtreecommitdiff
path: root/libc/stdio/stdio_ext.cpp
AgeCommit message (Collapse)Author
2018-08-02Modernize codebase by replacing NULL with nullptrYi Kong
Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
2018-02-14Add __fseterr.Elliott Hughes
Trivial, obvious counterpart to the standard ferror(3) and clearerr(3), and lets us build bison out of the box. Bug: http://b/64273806 Test: ran tests Change-Id: I20affabddb71210051165c41e86adfe5ae04f77f
2017-08-01Finish <stdio_ext.h>.Elliott Hughes
Implement __freading and __fwriting, and clarify the documentation that was the cause of these not being implemented for years. Bug: http://b/17157253 Test: ran tests Change-Id: I89542c8131b13889e2585417a024050ecf2abcb7
2017-05-03Move libc_log code into libasync_safe.Christopher Ferris
This library is used by a number of different libraries in the system. Make it easy for platform libraries to use this library and create an actual exported include file. Change the names of the functions to reflect the new name of the library. Run clang_format on the async_safe_log.cpp file since the formatting is all over the place. Bug: 31919199 Test: Compiled for angler/bullhead, and booted. Test: Ran bionic unit tests. Test: Ran the malloc debug tests. Change-Id: I8071bf690c17b0ea3bc8dc5749cdd5b6ad58478a
2016-07-29More stdio cleanup.Elliott Hughes
Time to get back to cleaning up stdio, so start with a bunch of easy one-liners... Change-Id: I8df5fdc72500a89b977bfaa6c64c3639198d4e3e
2016-01-19Make FILE*s less usable after fclose(3).Elliott Hughes
BSD doesn't invalidate the fd stored in struct FILE, which can make it possible (via fileno(3), for example), to perform operations on an fd you didn't intend to (rather than just failing with EBADF). Fixing this makes the code slightly simpler anyway, and might help catch bad code before it ships. Bug: http://stackoverflow.com/questions/10816837/fclose-works-differently-on-android-and-linux Change-Id: I9db74584038229499197a2695c70b58ed0372a87
2015-11-20Change _stdio_handles_locking into _caller_handles_locking.Yabin Cui
It is reported by tsan that funlockfile() can unlock an unlocked mutex. It happens when printf() is called before fopen() or other stdio stuff. As FLOCKFILE(fp) is called before __sinit(), _stdio_handles_locking is false, and _FLOCK(fp) will not be locked. But then cantwrite(fp) in __vfprintf() calls__sinit(), which makes _stdio_handles_locking become true, and FUNLOCKFILE(fp) unlocks _FLOCK(fp). Change _stdio_handles_locking into _caller_handles_locking, so __sinit() won't change its value. Add test due to my previous fault. Bug: 25392375 Change-Id: I483e3c3cdb28da65e62f1fd9615bf58c5403b4dd
2015-11-06Add fileno_unlocked to support thread sanitizer.Yabin Cui
Bug: 25392375 Change-Id: If3f92a0e08a53f4b59e01397e8efa307d8572349
2015-01-21Implement __fsetlocking.Elliott Hughes
The old __isthreaded hack was never very useful on Android because all user code runs in a VM where there are lots of threads running. But __fsetlocking lets a caller say "I'll worry about the locking for this FILE*", which is useful for the normal case where you don't share a FILE* between threads so you don't need any locking. Bug: 17154740 Bug: 18593728 Change-Id: I2a8dddc29d3edff39a3d7d793387f2253608a68d
2014-08-20Add <stdio_ext.h> for elfutils.Elliott Hughes
Bug: 17139679 Change-Id: I1605ac382dbb6f23b2d874dbb9769f3cde4a6a99