summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/stdio.c
Commit message (Collapse)AuthorAgeFilesLines
* Retire the __fgetcookie(), __fgetpendout(), and __fsetfileno() accessorsjhb2008-05-051-21/+0
| | | | as we aren't hiding FILE's internals anymore.
* Unbreak build: gnu sort has been configured to grope inside structmarcel2008-05-031-0/+7
| | | | | | | __sFILE. It's opaque now, so add a function that returns the pending output bytes. Pointy hat: jhb
* Unbreak build: libftpio gropes inside struct __sFILE. Implementmarcel2008-05-031-0/+14
| | | | | | | | accessor functions for its benefit now thaat FILE is opaque. I'm sure there's a better way. I leave that for people to work on in a src tree that isn't broken. Pointy hat: jhb
* Per Regents of the University of Calfornia letter, remove advertisingimp2007-01-091-4/+0
| | | | | | clause. # If I've done so improperly on a file, please let me know.
* #include <stdlib.h> for free()'s prototype.tjr2003-01-071-0/+1
|
* Fix the style of the SCM ID's.obrien2002-03-221-4/+2
| | | | I believe have made all of libc .c's as consistent as possible.
* Remove 'register' keyword.obrien2002-03-211-3/+3
|
* Help to recover from bad seek (i.e. negative or too big) happens beyondache2001-10-241-0/+7
| | | | | our pre-check control. Do the same way as refill.c does when it set __SERR, i.e. clear read and ungetc buffers. Clear EOF flag too.
* Back out read buffer invalidating via __SMOD.ache2001-10-231-5/+0
| | | | | It was correct, but not needed because internal buffer cleared on each seek outside of it.
* Disallow fseek() optimization in internal read buffer, if pointer is moved byache2001-10-231-0/+5
| | | | | seek. It means that beginning of read buffer becomes not the same as current file position.
* 1) If __SAPP stream is not seekable, remove __SAPP flag on first call insteadache2001-09-071-3/+10
| | | | | | | | | of repeating unsuccessful lseek call on each write (original stdio bug). 2) Save errno accross _sseek call in _swrite to not touch it in case write success (original stdio bug). 3) Add _sseek error checking back, but only for __SOPT mode now.
* For now just back out seek error checking in __SAPP case, it cause problemsache2001-09-071-2/+2
| | | | | | with non-seekable streams. Now here is what here was originally, but it is ugly, producing unneded seek syscall on each non-seekable stream write. I'll think about proper solution later.
* Re-arrange my funopen(3) fix to minimize differences with original stdio code,ache2001-09-031-0/+83
| | | | | | no functional changes. Add fp->_offset optimization in _SAPP+_SOPT case
* Move all stdio internal flags processing and setting out of __sread(),ache2001-09-021-47/+2
| | | | | | | | | | __swrite() and __sseek() to higher level. According to funopen(3) they all are just wrappers to something like standard read(2), write(2) and lseek(2), i.e. must not touch stdio internals because they are replaceable with any other functions knows nothing about stdio internals. See example of funopen(3) usage in sendmail sources f.e. NOTE: this is original stdio bug, not result of my range checkin added.
* If lseek to wrong value sucessfully happens despite all pre-checks, set __SERRache2001-09-011-1/+3
| | | | to indicate that stream becomes inconsistent.
* Detect fp->_offset overflow on readache2001-08-311-9/+23
| | | | Use errno to catch negative seek with -1 offset
* Remove extra check, already done in upper level caller, i.e. inache2001-08-171-5/+1
| | | | _fseeko()
* 1) Disallow negative seek as POSIX require for fseek{o} (but not for lseek):ache2001-08-151-2/+17
| | | | | | | | | | | | "[EINVAL] ... The resulting file-position indicator would be set to a negative value." Moreover, in real life negative seek in stdio cause EOF indicator cleared and not set again forever even if EOF returned. 2) Catch few possible off_t overflows. Reviewed by: arch discussion
* Remove _THREAD_SAFE and make libc thread-safe by default bydeischen2001-01-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch
* Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),jasone2000-01-271-3/+3
| | | | | | | | | | | | | | | | | just use _foo() <-- foo(). In the case of a libpthread that doesn't do call conversion (such as linuxthreads and our upcoming libpthread), this is adequate. In the case of libc_r, we still need three names, which are now _thread_sys_foo() <-- _foo() <-- foo(). Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(), nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo(). Remove all internal libc usage of: creat(), pause(), sleep(), system(), tcdrain(), wait(), and waitpid(). Make thread cancellation fully POSIX-compliant. Suggested by: deischen
* Add three-tier symbol naming in support of POSIX thread cancellationjasone2000-01-121-3/+3
| | | | | | points. For library functions, the pattern is __sleep() <-- _libc_sleep() <-- sleep(). The arrows represent weak aliases. For system calls, the pattern is _read() <-- _libc_read() <-- read().
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Suggested by: Bruce Evans, Jeffrey Hsu, Gary Palmerjraynard1996-06-221-6/+13
| | | | | | | | | | | | | | | | | | | | | Added $Id$'s to files that were lacking them (gpalmer), made some cosmetic changes to conform to style guidelines (bde) and checked against NetBSD and Lite2 to remove unnecessary divergences (hsu, bde) One last code cleanup:- Removed spurious casts in fseek.c and stdio.c. Added missing function argument in fwalk.c. Added missing header include in flags.c and rget.c. Put in casts where int's were being passed as size_t's. Put in missing prototypes for static functions. Changed second args of __sflags() inflags.c and writehook() in vasprintf.c from char * to const char * to conform to prototypes. This directory now compiles with no warnings with -Wall under gcc-2.6.3 and with considerably less warnings than before with the ultra-pedantic script I used for testing. (Most of the remaining ones are due to const poisoning).
* Code cleanup:-jraynard1996-06-121-3/+3
| | | | | | | The usual stuff, adding missing function prototypes, argument types, return values, etc. This directory now compiles with no warnings with -Wall on gcc2.6.3!
* Remove trailing whitespace.rgrimes1995-05-301-2/+2
|
* BSD 4.4 Lite Lib Sourcesrgrimes1994-05-271-0/+104
OpenPOWER on IntegriCloud