diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-04-08 07:13:42 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-04-08 07:13:42 +0000 |
commit | 279eb600d98131197c732147621e96c2d019bc52 (patch) | |
tree | 3baa23d794f7b13cc777448588187b5a183c2daf | |
parent | 3c720987c599927e9a8764b9362e4751c00ec1b1 (diff) | |
download | glibc-279eb600d98131197c732147621e96c2d019bc52.tar.gz glibc-279eb600d98131197c732147621e96c2d019bc52.tar.xz glibc-279eb600d98131197c732147621e96c2d019bc52.zip |
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.
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | libio/fileops.c | 20 | ||||
-rw-r--r-- | posix/unistd.h | 1 | ||||
-rw-r--r-- | sysdeps/generic/lseek64.c | 5 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/_G_config.h | 8 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/syscalls.list | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/llseek.c | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list | 2 |
8 files changed, 48 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog index 82d417a812..1a3e5b8dca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +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. + 1998-04-07 20:32 Ulrich Drepper <drepper@cygnus.com> * wcsmbs/btowc.c: Fix dozends of bugs in untested code. diff --git a/libio/fileops.c b/libio/fileops.c index 0a6d009229..7e60f7c8df 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) diff --git a/posix/unistd.h b/posix/unistd.h index 632f24d018..1555f07317 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -270,6 +270,7 @@ extern int euidaccess __P ((__const char *__name, int __type)); or the end of the file (if WHENCE is SEEK_END). Return the new file position. */ extern __off_t __lseek __P ((int __fd, __off_t __offset, int __whence)); +extern __off64_t __lseek64 __P ((int __fd, __off64_t __offset, int __whence)); #ifndef __USE_FILE_OFFSET64 extern __off_t lseek __P ((int __fd, __off_t __offset, int __whence)); #else diff --git a/sysdeps/generic/lseek64.c b/sysdeps/generic/lseek64.c index a2ffe2e0bd..91ef7f3dcc 100644 --- a/sysdeps/generic/lseek64.c +++ b/sysdeps/generic/lseek64.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,7 +22,7 @@ /* Seek to OFFSET on FD, starting from WHENCE. */ off64_t -lseek64 (fd, offset, whence) +__lseek64 (fd, offset, whence) int fd; off64_t offset; int whence; @@ -46,5 +46,6 @@ lseek64 (fd, offset, whence) __set_errno (ENOSYS); return -1; } +weak_alias (__lseek64, lseek64) stub_warning (lseek64) #include <stub-tag.h> diff --git a/sysdeps/unix/sysv/linux/_G_config.h b/sysdeps/unix/sysv/linux/_G_config.h index f96d4e9422..e829a73106 100644 --- a/sysdeps/unix/sysv/linux/_G_config.h +++ b/sysdeps/unix/sysv/linux/_G_config.h @@ -30,7 +30,7 @@ typedef unsigned int wint_t; #define _G_uid_t __uid_t #define _G_wchar_t wchar_t #define _G_wint_t wint_t -#define _G_stat64 stat +#define _G_stat64 stat64 typedef int _G_int16_t __attribute__ ((__mode__ (__HI__))); typedef int _G_int32_t __attribute__ ((__mode__ (__SI__))); @@ -55,9 +55,9 @@ typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__))); #define _G_IO_IO_FILE_VERSION 0x20001 -#define _G_OPEN64 open64 -#define _G_LSEEK64 lseek64 -#define _G_FSTAT64 fstat64 +#define _G_OPEN64 __open64 +#define _G_LSEEK64 __lseek64 +#define _G_FSTAT64(fd,buf) __fxstat64 (_STAT_VER, fd, buf) /* This is defined by <bits/stat.h> if `st_blksize' exists. */ #define _G_HAVE_ST_BLKSIZE defined (_STATBUF_ST_BLKSIZE) diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index b380996865..71cfbaabc4 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -20,7 +20,7 @@ osf_sigprocmask - osf_sigprocmask 2 __osf_sigprocmask getpeername - getpeername 3 __getpeername getpeername getpriority - getpriority 2 __getpriority getpriority mmap - mmap 6 __mmap mmap __mmap64 mmap64 -llseek EXTRA lseek 3 __llseek llseek lseek64 +llseek EXTRA lseek 3 __llseek llseek __lseek64 lseek64 pread EXTRA pread 4 __pread pread __pread64 pread64 pwrite EXTRA pwrite 4 __pwrite pwrite __pwrite64 pwrite64 fstatfs - fstatfs 2 __fstatfs fstatfs fstatfs64 diff --git a/sysdeps/unix/sysv/linux/llseek.c b/sysdeps/unix/sysv/linux/llseek.c index 31dd86f232..62fc6ca20b 100644 --- a/sysdeps/unix/sysv/linux/llseek.c +++ b/sysdeps/unix/sysv/linux/llseek.c @@ -1,5 +1,5 @@ /* Long-long seek operation. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,4 +34,5 @@ __llseek (int fd, loff_t offset, int whence) &result, whence) ?: result); } weak_alias (__llseek, llseek) +weak_alias (__llseek, __lseek64) weak_alias (__llseek, lseek64) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list index 5da202541f..b2b0740375 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list @@ -1,7 +1,7 @@ # File name Caller Syscall name # args Strong name Weak names # Whee! 64-bit systems naturally implement llseek. -llseek EXTRA lseek 3 __llseek llseek lseek64 +llseek EXTRA lseek 3 __llseek llseek __lseek64 lseek64 pread EXTRA pread 4 __pread pread __pread64 pread64 pwrite EXTRA pwrite 4 __pwrite pwrite __pwrite64 pwrite64 fstatfs - fstatfs 2 __fstatfs fstatfs fstatfs64 |