aboutsummaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-08 07:13:42 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-08 07:13:42 +0000
commit279eb600d98131197c732147621e96c2d019bc52 (patch)
tree3baa23d794f7b13cc777448588187b5a183c2daf /libio
parent3c720987c599927e9a8764b9362e4751c00ec1b1 (diff)
downloadglibc-279eb600d98131197c732147621e96c2d019bc52.zip
glibc-279eb600d98131197c732147621e96c2d019bc52.tar.gz
glibc-279eb600d98131197c732147621e96c2d019bc52.tar.bz2
Update.
1998-04-07 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/unix/sysv/linux/_G_config.h (_G_stat64): Define to stat64. (_G_OPEN64, _G_LSEEK64, _G_FSTAT64): Use namespace clean functions. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Add __lseek64 alias for __llseek. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/llseek.c: Likewise. * sysdeps/generic/lseek64.c (lseek64): Rename to __lseek64, and make it a weak alias. * posix/unistd.h: Declare __lseek64. * libio/fileops.c (fstat) [_LIBC]: Use namespace clean function. (_IO_file_stat): Fix typo. (_IO_file_xsgetn): Update fd->_offset. Read a multiple of the block size from the file. Use __mempcpy if _LIBC.
Diffstat (limited to 'libio')
-rw-r--r--libio/fileops.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index 0a6d009..7e60f7c 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -48,6 +48,7 @@ extern int errno;
# define lseek(FD, Offset, Whence) __lseek (FD, Offset, Whence)
# define read(FD, Buf, NBytes) __read (FD, Buf, NBytes)
# define write(FD, Buf, NBytes) __write (FD, Buf, NBytes)
+# define fstat(FD, Buf) __fxstat (_STAT_VER, FD, Buf)
#endif
/* An fstream can be in at most one of put mode, get mode, or putback mode.
@@ -650,7 +651,7 @@ _IO_file_stat (fp, st)
_IO_FILE *fp;
void *st;
{
-#ifdef _G_STAT64
+#ifdef _G_FSTAT64
return _G_FSTAT64 (fp->_fileno, (struct _G_stat64 *) st);
#else
return fstat (fp->_fileno, (struct _G_stat64 *) st);
@@ -800,9 +801,13 @@ _IO_file_xsgetn (fp, data, n)
{
if (have > 0)
{
+#ifdef _LIBC
+ s = __mempcpy (s, fp->_IO_read_ptr, have);
+#else
memcpy (s, fp->_IO_read_ptr, have);
- want -= have;
s += have;
+#endif
+ want -= have;
fp->_IO_read_ptr += have;
}
@@ -829,7 +834,16 @@ _IO_file_xsgetn (fp, data, n)
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
- count = _IO_SYSREAD (fp, s, want);
+ /* Try to maintain alignment: read a whole number of blocks. */
+ count = want;
+ if (fp->_IO_buf_base)
+ {
+ _IO_size_t block_size = fp->_IO_buf_end - fp->_IO_buf_base;
+ if (block_size >= 128)
+ count -= want % block_size;
+ }
+
+ count = _IO_SYSREAD (fp, s, count);
if (count <= 0)
{
if (count == 0)