summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/ftell.c
Commit message (Collapse)AuthorAgeFilesLines
* Move all stdio internal flags processing and setting out of __sread(),Andrey A. Chernov2001-09-021-1/+1
| | | | | | | | | | | | | __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. Notes: svn path=/head/; revision=82807
* Strict in the POSIX sence, if file position is unspecified after ungetc() atAndrey A. Chernov2001-09-011-6/+4
| | | | | | | | | | 0, return that we can't specify it, i.e. error with ESPIPE. (hint from: "Peter S. Housel" <housel@acm.org>) Back out sinit() addition, not needed after various code simplifications. Notes: svn path=/head/; revision=82736
* If position is underflowed, don't try to hide that fact by recovery, justAndrey A. Chernov2001-09-011-17/+7
| | | | | | | return EIO and set __SERR to mark stream as inconsistent. Notes: svn path=/head/; revision=82734
* Back out disabling ungetc() at 0, use different solution:Andrey A. Chernov2001-09-011-14/+26
| | | | | | | | keep negative offset internally, but return 0 externally in ftell*() I.e. use 0 now as 'unspecified value' per POSIX ungetc() description. Notes: svn path=/head/; revision=82709
* Add originally missing __sinit() call.Andrey A. Chernov2001-08-311-0/+4
| | | | Notes: svn path=/head/; revision=82684
* Simplify offset underflow checks even moreAndrey A. Chernov2001-08-311-12/+2
| | | | Notes: svn path=/head/; revision=82683
* Disallow ungetc at offset 0 (to prevent negative offset happens), so simplifyAndrey A. Chernov2001-08-311-22/+11
| | | | | | | checks in ftell. Notes: svn path=/head/; revision=82673
* Drop buffer first, _then_ ask for real positionAndrey A. Chernov2001-08-311-4/+4
| | | | Notes: svn path=/head/; revision=82670
* The same big piece of ftell code repeated in 3 places. Simplify things movingAndrey A. Chernov2001-08-311-10/+22
| | | | | | | | it into one subfunction instead. Try to use real offset in strange cases. Notes: svn path=/head/; revision=82668
* If file offset is smaller than internal buffer character left count, just dropAndrey A. Chernov2001-08-311-7/+9
| | | | | | | internal buffer and trust offset, not return error. Notes: svn path=/head/; revision=82659
* Try to discard some ungetc data in saved internal buffer checks too,Andrey A. Chernov2001-08-301-3/+9
| | | | | | | if offset tends to be negative. Notes: svn path=/head/; revision=82591
* Add more EOVERFLOW checks.Andrey A. Chernov2001-08-301-7/+33
| | | | | | | | | | | | | | | When file offset tends to be negative due to internal and ungetc buffers additions counted, try to discard some ungetc data first, then return EBADF. Later one can happens if lseek(fileno(fd),...) called f.e. POSIX says that ungetc beyond beginning of the file results are undefined, so we can just discard some of ungetc data in that case. Don't rely on gcc cast when checking for overflow, use OFF_MAX. Cosmetique. Notes: svn path=/head/; revision=82588
* Remove _THREAD_SAFE and make libc thread-safe by default byDaniel Eischen2001-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 Notes: svn path=/head/; revision=71579
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50476
* Added functions fseeko() and ftello() (from susv2).Dmitrij Tejblum1999-02-081-2/+19
| | | | | | | | | | Fixed fgetpos() and fsetpos() for offsets > 2GB. PR: 8637 Submitted by: Dan Nelson <dnelson@emsphone.com> (adjusted by me a little) Notes: svn path=/head/; revision=43782
* Add FILE locking stubs for libc.John Birrell1998-04-111-14/+5
| | | | | | | | | | | Change the FILE locking to support kernel threads when linked with libpthread (which you haven't see yet). This requires that libc become thread-safe and thread-aware, testing __isthreaded before attempting to do lock/unlock calls. The impact on non-threaded programs is minor. This change works with libc_r, so it's the best compromise. Notes: svn path=/head/; revision=35129
* Merge from Lite2Peter Wemm1997-03-111-2/+2
| | | | Notes: svn path=/head/; revision=23663
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-221-1/+1
| | | | Notes: svn path=/head/; revision=22993
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-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. Notes: svn path=/head/; revision=21673
* Suggested by: Bruce Evans, Jeffrey Hsu, Gary PalmerJames Raynard1996-06-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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). Notes: svn path=/head/; revision=16586
* Removed now-bogus casts that were to hide the inconsistency between theBruce Evans1996-03-271-4/+4
| | | | | | | | | | nonstandard normal version and the standard threaded version. Removed a bogus L in a constant. fpos_t's aren't longs, and casting to fpos_t would be verbose. Notes: svn path=/head/; revision=14840
* Fix incorrect parameter types.Paul Richards1996-03-241-1/+1
| | | | Notes: svn path=/head/; revision=14790
* Reviewed by: julian and (hsu?)Julian Elischer1996-01-221-1/+15
| | | | | | | | | Submitted by: John Birrel(L?) changes for threadsafe operations Notes: svn path=/head/; revision=13545
* BSD 4.4 Lite Lib SourcesRodney W. Grimes1994-05-271-0/+88
Notes: svn path=/cvs2svn/branches/unlabeled-1.1.1/; revision=1573