]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Sat, 16 Aug 2003 06:21:46 +0000 (06:21 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 16 Aug 2003 06:21:46 +0000 (06:21 +0000)
2003-08-15  Ulrich Drepper  <drepper@redhat.com>

* io/Versions [GLIBC_2.3.3]: Add posix_fadvise64.
* io/fcntl.h (posix_fadvise64): Change type of third parameter to
off_t.
* sysdeps/unix/sysv/linux/posix_fadvise.c: Adjust definition.
* sysdeps/unix/make-syscalls.sh: Recognize V prefix to the parameter
description indicating the error value is returned, not -1.
* sysdeps/unix/sysv/linux/Makefile [subdir=io] (subdir_routines): Add
posix_fadvise64_64.
* sysdeps/unix/sysv/linux/kernel-features.h: Add definition of
__ASSUME_FADVISE64_64_SYSCALL.
* sysdeps/unix/sysv/linux/syscalls.list: Don't define madvise and
posix_madvise in one file.  Have posix_madvise defined with error
value returned.
Define posix_fadvise64_64 entry.  Add version info to posix_fadvise64
entry.
* sysdeps/unix/sysv/linux/alpha/syscalls.list: Define
posix_fadvise64_64 entry.  Add version info to posix_fadvise64 entry.
* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/i386/posix_fadvise.S: New file.
* sysdeps/unix/sysv/linux/i386/sysdep.h: Define PSEUDO_ERRVAL,
PSEUDO_END_ERRVAL, and ret_ERRVAL.
* sysdeps/unix/sysv/linux/ia64/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.

* posix/Makefile (routines): Add posix_madvise.
* sysdeps/generic/madvise.c: Don't define posix_madvise.
* sysdeps/generic/posix_madvise.c: New file.
* sysdeps/unix/sysv/aix/posix_madvise.c: New file.

19 files changed:
ChangeLog
io/Versions
io/fcntl.h
posix/Makefile
sysdeps/generic/madvise.c
sysdeps/generic/posix_madvise.c [new file with mode: 0644]
sysdeps/unix/make-syscalls.sh
sysdeps/unix/sysv/aix/posix_madvise.c [new file with mode: 0644]
sysdeps/unix/sysv/linux/Makefile
sysdeps/unix/sysv/linux/alpha/syscalls.list
sysdeps/unix/sysv/linux/i386/posix_fadvise64_64.S [new file with mode: 0644]
sysdeps/unix/sysv/linux/i386/sysdep.h
sysdeps/unix/sysv/linux/ia64/syscalls.list
sysdeps/unix/sysv/linux/ia64/sysdep.h
sysdeps/unix/sysv/linux/kernel-features.h
sysdeps/unix/sysv/linux/posix_fadvise.c
sysdeps/unix/sysv/linux/syscalls.list
sysdeps/unix/sysv/linux/x86_64/syscalls.list
sysdeps/unix/sysv/linux/x86_64/sysdep.h

index 416eceb1068c433edd86e06f5c68da346e0dd2f9..8450b63c2fd119004e426068be1dfa9e7502e739 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2003-08-15  Ulrich Drepper  <drepper@redhat.com>
+
+       * io/Versions [GLIBC_2.3.3]: Add posix_fadvise64.
+       * io/fcntl.h (posix_fadvise64): Change type of third parameter to
+       off_t.
+       * sysdeps/unix/sysv/linux/posix_fadvise.c: Adjust definition.
+       * sysdeps/unix/make-syscalls.sh: Recognize V prefix to the parameter
+       description indicating the error value is returned, not -1.
+       * sysdeps/unix/sysv/linux/Makefile [subdir=io] (subdir_routines): Add
+       posix_fadvise64_64.
+       * sysdeps/unix/sysv/linux/kernel-features.h: Add definition of
+       __ASSUME_FADVISE64_64_SYSCALL.
+       * sysdeps/unix/sysv/linux/syscalls.list: Don't define madvise and
+       posix_madvise in one file.  Have posix_madvise defined with error
+       value returned.
+       Define posix_fadvise64_64 entry.  Add version info to posix_fadvise64
+       entry.
+       * sysdeps/unix/sysv/linux/alpha/syscalls.list: Define
+       posix_fadvise64_64 entry.  Add version info to posix_fadvise64 entry.
+       * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
+       * sysdeps/unix/sysv/linux/i386/posix_fadvise.S: New file.
+       * sysdeps/unix/sysv/linux/i386/sysdep.h: Define PSEUDO_ERRVAL,
+       PSEUDO_END_ERRVAL, and ret_ERRVAL.
+       * sysdeps/unix/sysv/linux/ia64/sysdep.h: Likewise.
+       * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
+
+       * posix/Makefile (routines): Add posix_madvise.
+       * sysdeps/generic/madvise.c: Don't define posix_madvise.
+       * sysdeps/generic/posix_madvise.c: New file.
+       * sysdeps/unix/sysv/aix/posix_madvise.c: New file.
+
 2003-08-15  Jakub Jelinek  <jakub@redhat.com>
 
        * assert/assert.h (assert_perror): Use __builtin_expect for gcc >=
index 88f3a9ac04920e7bef01024d280f4b50ed929d4a..9e035aecc7514f752bc9ffbc23649b8a9a88cf6c 100644 (file)
@@ -93,6 +93,9 @@ libc {
     # l*
     lchmod;
   }
+  GLIBC_2.3.3 {
+    posix_fadvise64;
+  }
   GLIBC_PRIVATE {
     # functions which have an additional interface since they are
     # cancelable.
index 5dbde77bf4b78a27c9ee4382e714c6eeee7bd787..77f002b66badece669d1e6bbec5f65338882aa58 100644 (file)
@@ -134,19 +134,19 @@ extern int lockf64 (int __fd, int __cmd, __off64_t __len) __THROW;
 /* Advice the system about the expected behaviour of the application with
    respect to the file associated with FD.  */
 # ifndef __USE_FILE_OFFSET64
-extern int posix_fadvise (int __fd, __off_t __offset, size_t __len,
+extern int posix_fadvise (int __fd, __off_t __offset, off_t __len,
                          int __advise) __THROW;
 # else
 # ifdef __REDIRECT
 extern int __REDIRECT (posix_fadvise, (int __fd, __off64_t __offset,
-                                      size_t __len, int __advise) __THROW,
+                                      off64_t __len, int __advise) __THROW,
                       posix_fadvise64);
 # else
 #  define posix_fadvise posix_fadvise64
 # endif
 # endif
 # ifdef __USE_LARGEFILE64
-extern int posix_fadvise64 (int __fd, __off64_t __offset, size_t __len,
+extern int posix_fadvise64 (int __fd, __off64_t __offset, off64_t __len,
                            int __advise) __THROW;
 # endif
 
index d3e77129eeffac41e2b3bea125bb48f260798bff..d8516c2ec303d712abd1fc9bec75e2215a57d959 100644 (file)
@@ -63,7 +63,8 @@ routines :=                                                                 \
        spawnattr_getflags spawnattr_setflags                                 \
        spawnattr_getpgroup spawnattr_setpgroup spawn spawnp spawni           \
        spawnattr_getsigmask spawnattr_getschedpolicy spawnattr_getschedparam \
-       spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam
+       spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam \
+       posix_madvise
 
 include ../Makeconfig
 
index 05ea8a9d89ebea3195d8ab34f4638044f52b4103..dbef959dd85b1a333e74110e57df57315cd529e4 100644 (file)
    for the region starting at ADDR and extending LEN bytes.  */
 
 int
-posix_madvise (__ptr_t addr, size_t len, int advice)
+madvise (__ptr_t addr, size_t len, int advice)
 {
   __set_errno (ENOSYS);
   return -1;
 }
-weak_alias (posix_madvise, madvise)
 stub_warning (madvise)
 #include <stub-tag.h>
diff --git a/sysdeps/generic/posix_madvise.c b/sysdeps/generic/posix_madvise.c
new file mode 100644 (file)
index 0000000..6f8d60f
--- /dev/null
@@ -0,0 +1,32 @@
+/* Copyright (C) 1994, 1995, 1996, 1997, 2000 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+/* Advise the system about particular usage patterns the program follows
+   for the region starting at ADDR and extending LEN bytes.  */
+
+int
+posix_madvise (__ptr_t addr, size_t len, int advice)
+{
+  return ENOSYS;
+}
+stub_warning (posix_madvise)
+#include <stub-tag.h>
index 4fea51adef59192f82a683e4aea61bdae4cd1fc8..0ec8b28fd21f8ac6c4e3bde45e5127a2735ec613 100644 (file)
@@ -88,6 +88,7 @@ while read file srcfile caller syscall args strong weak; do
   case $args in
   C*) cancellable=-cancel; args=`echo $args | sed 's/C:\?//'`;;
   E*) noerrno=_NOERRNO; args=`echo $args | sed 's/E:\?//'`;;
+  V*) noerrno=_ERRVAL; args=`echo $args | sed 's/V:\?//'`;;
   esac
 
   # Derive the number of arguments from the argument signature
diff --git a/sysdeps/unix/sysv/aix/posix_madvise.c b/sysdeps/unix/sysv/aix/posix_madvise.c
new file mode 100644 (file)
index 0000000..7ab4bed
--- /dev/null
@@ -0,0 +1,8 @@
+#include <errno.h>
+#include <sys/mman.h>
+
+int
+posix_madvise (void *addr, size_t len, int advise)
+{
+  return madvise (addr, len, advise) ? errno : 0;
+}
index f292931fb9124b6a9574f0eba831021b9cf0a51c..2d98aa58ac35c2213829f6aba9549db1aa09ba8e 100644 (file)
@@ -135,7 +135,7 @@ CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1
 endif
 
 ifeq ($(subdir),io)
-sysdep_routines += xstatconv
+sysdep_routines += xstatconv posix_fadvise64_64
 endif
 
 ifeq ($(subdir),elf)
index 60235d012f3beae95cc97e090c2466df565b3187..78feb7a57ab1aba5d3342d03fd169fc1406d5931 100644 (file)
@@ -21,7 +21,8 @@ getpriority   -       getpriority     i:ii    __getpriority   getpriority
 mmap           -       mmap            b:aniiii __mmap         mmap __mmap64 mmap64
 llseek         EXTRA   lseek           C:3     __libc_lseek    __lseek lseek __libc_lseek64 __llseek llseek __lseek64 lseek64
 lseek          llseek  -
-posix_fadvise64        -       fadvise64       4       posix_fadvise64 posix_fadvise
+posix_fadvise64        -       fadvise64       4       posix_fadvise64 posix_fadvise@GLIBC_2.2
+posix_fadvise64_64 -   fadvise64       4       posix_fadvise64 posix_fadvise@GLIBC_2.3.3
 pread          -       pread64         C:4     __libc_pread    __libc_pread64 __pread pread __pread64 pread64
 pwrite         -       pwrite64                C:4     __libc_pwrite   __libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
 fstatfs                -       fstatfs         i:ip    __fstatfs       fstatfs __fstatfs64 fstatfs64
diff --git a/sysdeps/unix/sysv/linux/i386/posix_fadvise64_64.S b/sysdeps/unix/sysv/linux/i386/posix_fadvise64_64.S
new file mode 100644 (file)
index 0000000..e132c3b
--- /dev/null
@@ -0,0 +1,118 @@
+/* Copyright (C) 1995,96,97,98,99,2000,2002,2003 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep.h>
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+#include "kernel-features.h"
+
+#define EINVAL 22
+#define ENOSYS 38
+#define EOVERFLOW 75
+
+#define SVRSP  16              /* saved register space */
+#define PARMS  LINKAGE+SVRSP   /* space for 4 saved regs */
+#define FD     PARMS
+#define OFFLO  FD+4
+#define OFFHI  OFFLO+4
+#define LENLO  OFFHI+4
+#define LENHI  LENLO+4
+#define FLAGS  LENHI+4
+
+       .text
+ENTRY (BP_SYM (__posix_fadvise64_l64))
+
+#ifdef __NR_fadvise64_64
+
+       /* Save registers.  */
+       pushl   %ebp
+       pushl   %ebx
+       pushl   %esi
+       pushl   %edi
+
+       movl    FD(%esp), %ebx
+       movl    OFFLO(%esp), %ecx
+       movl    OFFHI(%esp), %edx
+       movl    LENLO(%esp), %esi
+       movl    LENHI(%esp), %edi
+       movl    FLAGS(%esp), %ebp
+
+       movl    $SYS_ify(fadvise64_64), %eax
+       ENTER_KERNEL
+
+       /* Restore registers.  */
+       popl    %edi
+       popl    %esi
+       popl    %ebx
+       popl    %ebp
+
+#ifndef __ASSUME_FADVISE64_64_SYSCALL
+       cmpl    $-ENOSYS, %eax
+       je      1f
+#endif
+
+       /* The function returns zero, or the error number.  So all we
+          have to do is negate the value passed back from the kernel.  */
+       /* If 0 > %eax > -4096 there was an error.  */
+       negl    %eax
+
+       /* Successful; return the syscall's value.  */
+       ret
+#endif
+
+#if defined __NR_fadvise64 \
+    && (!defined __ASSUME_FADVISE64_64_SYSCALL || !defined __NR_fadvise64_64)
+1:     /* Save registers.  */
+       pushl   %ebx
+       pushl   %esi
+       pushl   %edi
+
+       /* Overflow check.  */
+       cmpl    $0, LENHI(%esp)
+       jne     L(overflow)
+
+       movl    FD(%esp), %ebx
+       movl    OFFLO(%esp), %ecx
+       movl    OFFHI(%esp), %edx
+       movl    LENLO(%esp), %esi
+       movl    FLAGS(%esp), %edi
+
+       movl    $SYS_ify(fadvise64_64), %eax
+       ENTER_KERNEL
+
+       /* Restore registers.  */
+       popl    %edi
+       popl    %esi
+       popl    %ebx
+
+       /* If 0 > %eax > -4096 there was an error.  */
+       negl    %eax
+
+       /* Successful; return the syscall's value.  */
+       ret
+
+L(overflow):
+       movl    $EOVERFLOW, %eax
+       ret
+#elif
+       movl    $ENOSYS, %eax
+       ret
+#endif
+
+PSEUDO_END_NOERRNO (BP_SYM (__posix_fadvise64_l64))
index 95124797e9fbc1db5ac108eecfdc248ae945c7c9..79ad72abff371b87e71e178f174b50298b902781 100644 (file)
 
 #define ret_NOERRNO ret
 
+/* The function has to return the error code.  */
+#undef PSEUDO_ERRVAL
+#define        PSEUDO_ERRVAL(name, syscall_name, args) \
+  .text;                                                                     \
+  ENTRY (name)                                                               \
+    DO_CALL (syscall_name, args);                                            \
+    negl %eax
+
+#undef PSEUDO_END_ERRVAL
+#define        PSEUDO_END_ERRVAL(name) \
+  END (name)
+
+#define ret_ERRVAL ret
+
 #ifndef PIC
 # define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used.  */
 #else
index c2027b670ffb7e792caee6b2dbd036d8d3a825e5..a368226b91795a484f8da294fba24c35c41b3c36 100644 (file)
@@ -5,7 +5,8 @@ umount2         -       umount          2       __umount2       umount2
 # Whee! 64-bit systems naturally implement llseek.
 llseek         EXTRA   lseek           C:3     __libc_lseek    __lseek lseek __libc_lseek64 __llseek llseek __lseek64 lseek64
 lseek          llseek  -
-posix_fadvise64        -       fadvise64       4       posix_fadvise64 posix_fadvise
+posix_fadvise64        -       fadvise64       4       posix_fadvise64 posix_fadvise@GLIBC_2.2
+posix_fadvise64_64 -   fadvise64       4       posix_fadvise64 posix_fadvise@GLIBC_2.3.3
 pread          -       pread           C:4     __libc_pread    __libc_pread64 __pread pread __pread64 pread64
 pwrite         -       pwrite          C:4     __libc_pwrite   __libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
 fstatfs                -       fstatfs         i:ip    __fstatfs       fstatfs fstatfs64 __fstatfs64
index 0f729a3c3ef9587ed5405aa3752ea3f0a6334428..2fc32efd474a9fd35035d20ff6c449f0bf69ecd5 100644 (file)
 #undef PSEUDO_END_NOERRNO
 #define PSEUDO_END_NOERRNO(name)       .endp C_SYMBOL_NAME(name);
 
+#undef PSEUDO_ERRVAL
+#define        PSEUDO_ERRVAL(name, syscall_name, args) \
+  ENTRY(name)                                          \
+    DO_CALL (SYS_ify(syscall_name));           \
+       cmp.eq p6,p0=-1,r10;                    \
+(p6)   mov r10=r8;
+
+
+#undef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(name)        .endp C_SYMBOL_NAME(name);
+
 #undef END
 #define END(name)                                              \
        .size   C_SYMBOL_NAME(name), . - C_SYMBOL_NAME(name) ;  \
index 26043af04741819819971537bf103c21b0ffe84b..457ce665d2a06633600c61f9b69b8a21c9c801fb 100644 (file)
 #if __LINUX_KERNEL_VERSION >= 132609
 # define __ASSUME_CLONE_STOPPED        1
 #endif
+
+/* The fixed version of the posix_fadvise64 syscall appeared in
+   2.6.0-test3.  At least for x86.  */
+#if __LINUX_KERNEL_VERSION >= 132609 && defined __i386__
+# define __ASSUME_FADVISE64_64_SYSCALL 1
+#endif
index fb1e59b2d348bca267addc3e671b985df678da50..808fc865ed460ecf5ff40038a41133dfc4e82425 100644 (file)
@@ -24,7 +24,7 @@
    respect to the file associated with FD.  */
 
 int
-posix_fadvise (int fd, __off_t offset, size_t len, int advise)
+posix_fadvise (int fd, off_t offset, off_t len, int advise)
 {
 #ifdef __NR_fadvise64
   return INLINE_SYSCALL (fadvise64, 5, fd,
index ef77deb38969d847c6bdcca002ad45750964c0b5..cf1a121b20ce80be5881c42e5582c973c8a88afb 100644 (file)
@@ -28,7 +28,8 @@ ioperm                -       ioperm          i:iii   ioperm
 iopl           -       iopl            i:i     iopl
 klogctl                EXTRA   syslog          i:isi   klogctl
 lchown         -       lchown          i:sii   __lchown        lchown
-madvise                -       madvise         i:pii   posix_madvise   madvise
+posix_madvise  -       madvise         Vi:pii  posix_madvise
+madvise                -       madvise         i:pii   madvise
 mincore                -       mincore         i:anV   mincore
 mlock          -       mlock           i:bn    mlock
 mlockall       -       mlockall        i:i     mlockall
@@ -43,7 +44,8 @@ pause         -       pause           Ci:     __libc_pause    pause
 personality    init-first personality  i:i     __personality   personality
 pipe           -       pipe            i:f     __pipe          pipe
 pivot_root     EXTRA   pivot_root      i:ss    pivot_root
-posix_fadvise64        -       fadvise64       i:iiiii posix_fadvise64
+posix_fadvise64 -      fadvise64       Vi:iiiii        __posix_fadvise64_l32   posix_fadvise64@GLIBC_2.2
+posix_fadvise64_64 -   fadvise64_64    Vi:iiiiii __posix_fadvise64_l64 posix_fadvise64@GLIBC_2.3.3
 prctl          EXTRA   prctl           i:iiiii __prctl         prctl
 putpmsg                -       putpmsg         i:ippii putpmsg
 query_module   EXTRA   query_module    i:sipip query_module
index 7d050c7815e508a2b0db693dae6fee60bef6ec08..063f9ba5df78603ed1a03b708ddee575c5dbd9f8 100644 (file)
@@ -4,6 +4,8 @@ arch_prctl      EXTRA   arch_prctl      i:ii    __arch_prctl    arch_prctl
 mmap           -       mmap            b:aniiii __mmap         mmap __mmap64 mmap64
 modify_ldt     EXTRA   modify_ldt      i:ipi   __modify_ldt    modify_ldt
 llseek         EXTRA   lseek           Ci:iii  __libc_lseek64  __llseek llseek __lseek64 lseek64
+posix_fadvise64        -       fadvise64       i:iiii  posix_fadvise64 posix_fadvise@GLIBC_2.2.5
+posix_fadvise64_64 -   fadvise64_64    i:iiii  posix_fadvise64 posix_fadvise@GLIBC_2.3.3
 pread          -       pread           Ci:ibni __libc_pread    __libc_pread64 __pread pread __pread64 pread64
 pwrite         -       pwrite          Ci:ibni __libc_pwrite   __libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
 fstatfs                -       fstatfs         i:ip    __fstatfs       fstatfs __fstatfs64 fstatfs64
index 430ec86a5dd3d680c0f5fa0ad47434fbcf01594f..d92869a32c51e5306e72fb7a51fe32751d8d636f 100644 (file)
 #define        PSEUDO_END_NOERRNO(name) \
   END (name)
 
+#undef PSEUDO_ERRVAL
+#define        PSEUDO_ERRVAL(name, syscall_name, args) \
+  .text;                                                                     \
+  ENTRY (name)                                                               \
+    DO_CALL (syscall_name, args);                                            \
+    negl %rax
+
+#undef PSEUDO_END_ERRVAL
+#define        PSEUDO_END_ERRVAL(name) \
+  END (name)
+
 #define ret_NOERRNO ret
 
 #ifndef PIC
This page took 0.076917 seconds and 5 git commands to generate.