freebsd-dev/lib/libc/stdio
Nate Williams 692a99c012 Date: Wed, 26 Oct 1994 15:44:49 -0600
From: Chris Torek <torek@bsdi.com>
Here is a semi-official patch (apply to /usr/src/lib/libc/stdio/fseek.c,
rebuild libc, install).  The current code fails when the seek:

  - is optimized, and
  - is to just past the end of the block currently in the buffer, and
  - is followed by another seek with no intervening read operation, and
  - the destination of subsequent seek is within the block left in the
    buffer (seeking to the beginning of a block does not force a read,
    so the buffer still contains the previous block)

so it is indeed rather obscure.

I may have a different `final' fix, as this one `loses' the buffer
contents on a seek that goes just past the end of the current block.

[Footnote: seeks are optimized only on read-only opens of regular
files that are buffered by the file's optimal I/O size.  This is
what you get with fopen(path, "r") and no call to setvbuf().]

Obtained from: [ BSDI mailing list ]
1994-11-05 18:49:34 +00:00
..
clrerr.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fclose.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fclose.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fdopen.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
feof.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
ferror.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
ferror.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fflush.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fflush.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fgetc.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fgetln.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fgetln.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fgetpos.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fgets.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fgets.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fileno.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
findfp.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
flags.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
floatio.h BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fopen.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fopen.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fprintf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fpurge.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fputc.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fputs.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fputs.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fread.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fread.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
freopen.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fscanf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fseek.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fseek.c Date: Wed, 26 Oct 1994 15:44:49 -0600 1994-11-05 18:49:34 +00:00
fsetpos.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
ftell.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
funopen.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
funopen.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fvwrite.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fvwrite.h BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fwalk.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
fwrite.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
getc.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
getc.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
getchar.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
gets.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
getw.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
glue.h BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
local.h BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
makebuf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
Makefile.inc First crack at making libc work with the new make macros. It compiles on 1994-08-05 01:19:12 +00:00
mktemp.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
mktemp.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
perror.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
printf.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
printf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
putc.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
putc.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
putchar.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
puts.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
putw.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
refill.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
remove.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
remove.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
rewind.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
rget.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
scanf.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
scanf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
setbuf.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
setbuf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
setbuffer.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
setvbuf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
snprintf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
sprintf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
sscanf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
stdio.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
stdio.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
tempnam.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
tmpfile.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
tmpnam.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
tmpnam.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
ungetc.3 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
ungetc.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
vfprintf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
vfscanf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
vprintf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
vscanf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
vsnprintf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
vsprintf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
vsscanf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
wbuf.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00
wsetup.c BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00