Up to [DragonFly] / src / lib / libc / stdio
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
- Ansify function definitions. - Fix some warnings. - In function definitions, move the type on a line of its own. - Remove (void) casts for discarded return values. - Use va_copy() where appropriate. In-collaboration-with: Alexey Slynko <email@example.com>
First step to cleaning up stdio. This breaks the libc ABI, all programs have to be recompiled. Make FILE an opaque type for normal operation (anything outside libc). This means programs have to use the exported interface, they can neither make static instances on the heap or access fields of their own. Introduce a new type __FILE_public, which contains the fields accessed by the various macros. It is placed first in the real FILE and the macros cast the given FILE * to __FILE_public for access. To allow better argument checks, all macros have been converted to inline functions instead. Merge the various stdio helper headers into a single priv_stdio.h. The license from the original files has been kept, the third clause is gone as part of the UCB copyright addendum. They haven't been changed in FreeBSD at all. Add two new helper functions, fcookie and __fpending to read parts of the hidden state. The former is handy for funopen users, the latter exists on other systems as well. Cleanup some minor warnings on the way and hide some local functions with static. Adept libftpio and CVS to the chanced API.
Remove _THREAD_SAFE depenendancies. Create weakly associated stubs for posix threading calls used by libc and weak associations for procedures that a threading library would otherwise have to override. This allows a program to be linked with libc, or linked with libc + a threading library. libc_r will be deprecated over time. Traditionally libc_r had to be linked against a threading library rather then libc. Linux, FreeBSD, and other UNIXes have moved either t oa thread-safe libc or a thread-capable libc. The threading capability is accomplished by making the appropriate thread locking calls and providing weakly referenced dummy stub functions for the case where a threading library is not linked in. Certain third party software, namely XFree/XOrg, also assume threading stubs in libc. This is precursor work to a port of David Xu's 1:1 threading library and is also intended as a basis to allow DragonFly to support multiple threading libraries. Ported-by: David Rhodus <firstname.lastname@example.org> Primarily-ported-from: FreeBSD Testing and bug fixes by David Xu and Matt Dillon
C99 update: freopen(3) with NULL 'path' argument so that it opens the same file with a different mode. At the moment, we just recycle the old file descriptor instead of storing it somewhere and using that to reopen the file, as the standard seems to require. Strictly conforming C99 applications would probably not be able to tell the difference but POSIX ones can. While I am there, update the manual page about the new functionality and correct nearby mdoc(7) markup errors. Original-work-by: Tim J. Robbins <email@example.com> Additional-work-by: Hiten Pandya <firstname.lastname@example.org>
Use ANSI C prototypes and remove the !__STDC__ varargs compatibility junk. Add a missing '$DragonFly$' tag in stdio/setbuf.c file.
Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most ids have been removed from !lint sections and moved into comment sections.
import from FreeBSD RELENG_4 184.108.40.206