about summary refs log tree commit diff
path: root/ChangeLog
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2014-03-04 12:23:27 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2014-03-04 12:23:28 +0530
commitfa3cd24827d34a49e0a3a5cac56abbf8df74d8ac (patch)
tree67c2695a5d5b2a603d586339df17519a24fd17ee /ChangeLog
parent000232b9bcbf194f1e5fd0ff380000f341505405 (diff)
downloadglibc-fa3cd24827d34a49e0a3a5cac56abbf8df74d8ac.tar.gz
glibc-fa3cd24827d34a49e0a3a5cac56abbf8df74d8ac.tar.xz
glibc-fa3cd24827d34a49e0a3a5cac56abbf8df74d8ac.zip
Use cached offset in ftell when reliable
The cached offset is reliable to use in ftell when the stream handle
is active.  We can consider a stream as being active when there is
unflushed data.  However, even in this case, we can use the cached
offset only when the stream is not being written to in a+ mode,
because this case may have unflushed data and a stale offset; the
previous read could have sent it off somewhere other than the end of
the file.

There were a couple of adjustments necessary to get this to work.
Firstly, fdopen now ceases to use _IO_attach_fd because it sets the
offset cache to the current file position.  This is not correct
because there could be changes to the file descriptor before the
stream handle is activated, which would not get reflected.

A similar offset caching action is done in _IO_fwide, claiming that
wide streams have 'problems' with the file offsets.  There don't seem
to be any obvious problems with not having the offset cache available,
other than that it will have to be queried in a subsequent
read/write/seek.  I have removed this as well.

The testsuite passes successfully with these changes on x86_64.
Diffstat (limited to 'ChangeLog')
-rw-r--r--ChangeLog7
1 files changed, 7 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d8d87d7856..b1ccca4101 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2014-03-04  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
+	* libio/fileops.c (do_ftell): Use cached offset when
+	available.
+	* libio/iofwide.c (do_ftell_wide): Likewise.
+	* libio/iofdopen.c (_IO_new_fdopen): Don't use
+	_IO_file_attach.
+	* libio/wfileops.c (_IO_fwide): Don't cache offset.
+
 	[BZ #16532]
 	* libio/libioP.h (get_file_offset): New function.
 	* libio/fileops.c (get_file_offset): Likewise.