diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-08-16 06:21:46 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-08-16 06:21:46 +0000 |
commit | bfef9264665ff93866882402a71c116cd0757de1 (patch) | |
tree | f36c804cadea320ac8637774c7b4a6f30ae7cdc8 /sysdeps/unix/sysv/linux | |
parent | 20d9b98f8a33c85b855e4aa5366acadd979de4d4 (diff) | |
download | glibc-bfef9264665ff93866882402a71c116cd0757de1.tar glibc-bfef9264665ff93866882402a71c116cd0757de1.tar.gz glibc-bfef9264665ff93866882402a71c116cd0757de1.tar.bz2 glibc-bfef9264665ff93866882402a71c116cd0757de1.zip |
Update.
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.
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r-- | sysdeps/unix/sysv/linux/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/syscalls.list | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/posix_fadvise64_64.S | 118 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/sysdep.h | 14 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/syscalls.list | 3 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ia64/sysdep.h | 11 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/kernel-features.h | 6 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/posix_fadvise.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/syscalls.list | 6 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/syscalls.list | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/x86_64/sysdep.h | 11 |
11 files changed, 172 insertions, 6 deletions
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index f292931fb9..2d98aa58ac 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -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) diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index 60235d012f..78feb7a57a 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -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 index 0000000000..e132c3b9a2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/posix_fadvise64_64.S @@ -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)) diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 95124797e9..79ad72abff 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -90,6 +90,20 @@ #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 diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list index c2027b670f..a368226b91 100644 --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list @@ -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 diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h index 0f729a3c3e..2fc32efd47 100644 --- a/sysdeps/unix/sysv/linux/ia64/sysdep.h +++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h @@ -110,6 +110,17 @@ #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) ; \ diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 26043af047..457ce665d2 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -367,3 +367,9 @@ #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 diff --git a/sysdeps/unix/sysv/linux/posix_fadvise.c b/sysdeps/unix/sysv/linux/posix_fadvise.c index fb1e59b2d3..808fc865ed 100644 --- a/sysdeps/unix/sysv/linux/posix_fadvise.c +++ b/sysdeps/unix/sysv/linux/posix_fadvise.c @@ -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, diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index ef77deb389..cf1a121b20 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -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 diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list index 7d050c7815..063f9ba5df 100644 --- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list +++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list @@ -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 diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index 430ec86a5d..d92869a32c 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -98,6 +98,17 @@ #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 |