diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux')
18 files changed, 205 insertions, 18 deletions
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index 60235d012f..d30a9b6b55 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -21,7 +21,7 @@ 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 Vi:iiii posix_fadvise64 posix_fadvise 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/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile index 6aa5ce30ad..1ae69407ff 100644 --- a/sysdeps/unix/sysv/linux/i386/Makefile +++ b/sysdeps/unix/sysv/linux/i386/Makefile @@ -12,7 +12,3 @@ endif ifeq ($(subdir),resource) sysdep_routines += oldgetrlimit64 endif - -ifeq ($(subdir),io) -sysdep_routines += posix_fadvise64_64 -endif diff --git a/sysdeps/unix/sysv/linux/i386/posix_fadvise64_64.S b/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S index c1ee9b99dd..8d7219f12b 100644 --- a/sysdeps/unix/sysv/linux/i386/posix_fadvise64_64.S +++ b/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S @@ -93,7 +93,7 @@ ENTRY (BP_SYM (__posix_fadvise64_l64)) movl LENLO(%esp), %esi movl FLAGS(%esp), %edi - movl $SYS_ify(fadvise64_64), %eax + movl $SYS_ify(fadvise64), %eax ENTER_KERNEL /* Restore registers. */ @@ -115,6 +115,18 @@ L(overflow): ret #endif -PSEUDO_END_NOERRNO (BP_SYM (__posix_fadvise64_l64)) +END (BP_SYM (__posix_fadvise64_l64)) + +#ifdef __NR_fadvise64 +PSEUDO_ERRVAL (__posix_fadvise64_l32, posix_fadvise64, 5) + ret +PSEUDO_END_ERRVAL (__posix_fadvise64_l32) +#else +ENTRY (BP_SYM (__posix_fadvise64_l32)) + movl $ENOSYS, %eax + ret +END (BP_SYM (__posix_fadvise64_l32)) +#endif default_symbol_version (__posix_fadvise64_l64, posix_fadvise64, GLIBC_2.3.3) +symbol_version (__posix_fadvise64_l32, posix_fadvise64, GLIBC_2.2) diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list index c2027b670f..5d83df7a6e 100644 --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list @@ -5,7 +5,7 @@ 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 Vi:iiii posix_fadvise64 posix_fadvise 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/posix_fadvise.c b/sysdeps/unix/sysv/linux/posix_fadvise.c index 808fc865ed..30a6d9e5be 100644 --- a/sysdeps/unix/sysv/linux/posix_fadvise.c +++ b/sysdeps/unix/sysv/linux/posix_fadvise.c @@ -27,10 +27,14 @@ int posix_fadvise (int fd, off_t offset, off_t len, int advise) { #ifdef __NR_fadvise64 - return INLINE_SYSCALL (fadvise64, 5, fd, - __LONG_LONG_PAIR (offset >> 31, offset), len, advise); + INTERNAL_SYSCALL_DECL (err); + int ret = INTERNAL_SYSCALL (fadvise64, err, 5, fd, + __LONG_LONG_PAIR (offset >> 31, offset), len, + advise); + if (INTERNAL_SYSCALL_ERROR_P (ret, err)) + return INTERNAL_SYSCALL_ERRNO (ret, err); + return 0; #else - __set_errno (ENOSYS); - return -1; + return ENOSYS; #endif } diff --git a/sysdeps/unix/sysv/linux/posix_fadvise64.c b/sysdeps/unix/sysv/linux/posix_fadvise64.c new file mode 100644 index 0000000000..89dfd8cdc3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/posix_fadvise64.c @@ -0,0 +1,78 @@ +/* Copyright (C) 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 <errno.h> +#include <fcntl.h> +#include <sysdep.h> +#include <kernel-features.h> + +int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise); +int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise); + +/* Advice the system about the expected behaviour of the application with + respect to the file associated with FD. */ + +int +__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise) +{ +#ifdef __NR_fadvise64_64 + INTERNAL_SYSCALL_DECL (err); + int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, + __LONG_LONG_PAIR (offset >> 32, offset), + __LONG_LONG_PAIR (len >> 32, len), + advise); + if (!INTERNAL_SYSCALL_ERROR_P (ret, err)) + return 0; +# ifndef __ASSUME_FADVISE64_64_SYSCALL + if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS) +# endif + return INTERNAL_SYSCALL_ERRNO (ret, err); +#endif +#ifndef __ASSUME_FADVISE64_64_SYSCALL +# ifdef __NR_fadvise64 + if (len != (off_t) len) + return EOVERFLOW; + + INTERNAL_SYSCALL_DECL (err2); + int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 5, fd, + __LONG_LONG_PAIR (offset >> 32, offset), + (off_t) len, advise); + if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2)) + return 0; + return INTERNAL_SYSCALL_ERRNO (ret2, err2); +# else + return ENOSYS; +# endif +#endif +} + +#include <shlib-compat.h> + +#if SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3) + +int +__posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise) +{ + return __posix_fadvise64_l64 (fd, offset, len, advise); +} + +versioned_symbol (libc, __posix_fadvise64_l64, posix_fadvise64, GLIBC_2_3_3); +compat_symbol (libc, __posix_fadvise64_l32, posix_fadvise64, GLIBC_2_2); +#else +strong_alias (__posix_fadvise64_l64, posix_fadvise64); +#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions index d0bf4a89c0..6d0795817f 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions @@ -20,4 +20,7 @@ libc { # s* scandir64; } + GLIBC_2.3.3 { + posix_fadvise64; + } } diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list index 9dbe0ed29e..7f7c7e8e1d 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list @@ -25,7 +25,7 @@ s_getrlimit getrlimit getrlimit i:ip __syscall_getrlimit s_lstat64 lxstat64 lstat64 i:sp __syscall_lstat64 s_mmap2 mmap64 mmap2 b:aniiii __syscall_mmap2 s_poll poll poll i:pii __syscall_poll -posix_fadvise64 - fadvise64 4 posix_fadvise64 posix_fadvise +posix_fadvise64 - fadvise64 Vi:iiii posix_fadvise64 posix_fadvise s_ptrace ptrace ptrace i:iipp __syscall_ptrace s_putpmsg putpmsg putpmsg i:ippii __syscall_putpmsg s_reboot reboot reboot i:iii __syscall_reboot diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Versions b/sysdeps/unix/sysv/linux/s390/s390-32/Versions index 3c45a30778..da461a57a0 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/Versions +++ b/sysdeps/unix/sysv/linux/s390/s390-32/Versions @@ -23,5 +23,8 @@ libc { # v* versionsort64; } + GLIBC_2.3.3 { + posix_fadvise64; + } } diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index 95cfd21857..d759e4a664 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -69,6 +69,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); \ + lcr %r2,%r2 + +#undef PSEUDO_END_ERRVAL +#define PSEUDO_END_ERRVAL(name) \ + END (name) + #ifndef PIC # define SYSCALL_ERROR_LABEL 0f # define SYSCALL_ERROR_HANDLER \ @@ -156,6 +167,9 @@ #define ret_NOERRNO \ br 14 +#define ret_ERRVAL \ + br 14 + #endif /* __ASSEMBLER__ */ #undef INLINE_SYSCALL diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list index c2bf5c3307..e114994c0d 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list +++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list @@ -10,7 +10,7 @@ getpeername - getpeername i:ipp __getpeername getpeername ftruncate - ftruncate 2 __ftruncate ftruncate ftruncate64 __ftruncate64 truncate - truncate 2 truncate truncate64 getrlimit - getrlimit 2 __getrlimit getrlimit getrlimit64 -posix_fadvise64 - fadvise64 4 posix_fadvise64 posix_fadvise +posix_fadvise64 - fadvise64 Vi:iiii posix_fadvise64 posix_fadvise setrlimit - setrlimit 2 __setrlimit setrlimit setrlimit64 vfork - vfork 0 __vfork vfork diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 9abc06e229..2fb6e7a0cf 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -83,6 +83,18 @@ SYSCALL_ERROR_HANDLER; \ END (name) +#undef PSEUDO_ERRVAL +#define PSEUDO_ERRVAL(name, syscall_name, args) \ + .text; \ + ENTRY (name) \ + DO_CALL (syscall_name, args); \ + lcgr %r2,%r2 + +#undef PSEUDO_END_ERRVAL +#define PSEUDO_END_ERRVAL(name) \ + SYSCALL_ERROR_HANDLER; \ + END (name) + #ifndef PIC # define SYSCALL_ERROR_LABEL syscall_error # define SYSCALL_ERROR_HANDLER @@ -158,6 +170,9 @@ #define ret_NOERRNO \ br 14 +#define ret_ERRVAL \ + br 14 + #endif /* __ASSEMBLER__ */ #undef INLINE_SYSCALL diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Versions b/sysdeps/unix/sysv/linux/sparc/sparc32/Versions index 4529e7fe6f..e6903728f3 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/Versions +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Versions @@ -17,4 +17,7 @@ libc { # s* scandir64; } + GLIBC_2.3.3 { + posix_fadvise64; + } } diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h index bc54b107c4..6dcf0cd57f 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h @@ -25,6 +25,7 @@ #ifdef IS_IN_rtld # include <dl-sysdep.h> /* Defines RTLD_PRIVATE_ERRNO. */ #endif +#include <tls.h> #undef SYS_ify #define SYS_ify(syscall_name) __NR_##syscall_name @@ -36,6 +37,7 @@ /* Linux/SPARC uses a different trap number */ #undef PSEUDO #undef PSEUDO_NOERRNO +#undef PSEUDO_ERRVAL #undef ENTRY #undef END #undef LOC @@ -86,6 +88,47 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \ jmpl %i7+8, %g0; \ restore %g0, -1, %o0; \ .previous; +#elif USE___THREAD +# ifndef NOT_IN_libc +# define SYSCALL_ERROR_ERRNO __libc_errno +# else +# define SYSCALL_ERROR_ERRNO errno +# endif +# ifdef SHARED +# define SYSCALL_ERROR_HANDLER \ + .section .gnu.linkonce.t.__sparc.get_pic.l7,"ax",@progbits; \ + .globl __sparc.get_pic.l7; \ + .hidden __sparc.get_pic.l7; \ + .type __sparc.get_pic.l7,@function; \ +__sparc.get_pic.l7: \ + retl; \ + add %o7, %l7, %l7; \ + .previous; \ +SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \ + save %sp,-96,%sp; \ + sethi %tie_hi22(SYSCALL_ERROR_ERRNO), %l1; \ + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7; \ + call __sparc.get_pic.l7; \ + add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7; \ + add %l1, %tie_lo10(SYSCALL_ERROR_ERRNO), %l1; \ + ld [%l7 + %l1], %l1, %tie_ld(SYSCALL_ERROR_ERRNO); \ + st %i0, [%g7 + %l1], %tie_add(SYSCALL_ERROR_ERRNO); \ + jmpl %i7+8, %g0; \ + restore %g0, -1, %o0; \ + .previous; +# else +# define SYSCALL_ERROR_HANDLER \ +SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \ + sethi %tie_hi22(SYSCALL_ERROR_ERRNO), %g1; \ + sethi %hi(_GLOBAL_OFFSET_TABLE_), %g2; \ + add %g1, %tie_lo10(SYSCALL_ERROR_ERRNO), %g1; \ + add %g2, %lo(_GLOBAL_OFFSET_TABLE_), %g2; \ + ld [%g2 + %g1], %g1, %tie_ld(SYSCALL_ERROR_ERRNO); \ + st %o0, [%g7 + %g1], %tie_add(SYSCALL_ERROR_ERRNO); \ + jmpl %o7+8, %g0; \ + mov -1, %o0; \ + .previous; +# endif #else # define SYSCALL_ERROR_HANDLER \ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \ @@ -115,6 +158,12 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \ LOADSYSCALL(syscall_name); \ ta 0x10 +#define PSEUDO_ERRVAL(name, syscall_name, args) \ + .text; \ + ENTRY(name); \ + LOADSYSCALL(syscall_name); \ + ta 0x10 + #else /* __ASSEMBLER__ */ #define __SYSCALL_STRING \ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list index ac0610feda..d480d25c38 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list @@ -13,7 +13,7 @@ truncate - truncate 2 truncate truncate64 mmap - mmap 6 __mmap mmap __mmap64 mmap64 readahead - readahead 3 __readahead readahead sendfile - sendfile i:iipi sendfile sendfile64 -posix_fadvise64 - fadvise64 4 posix_fadvise64 posix_fadvise +posix_fadvise64 - fadvise64 Vi:iiii posix_fadvise64 posix_fadvise # Override select.S in parent directory: select - select C:5 __select select diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h index c16e8ff673..5340fca9d1 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h @@ -36,6 +36,7 @@ /* Linux/SPARC uses a different trap number */ #undef PSEUDO #undef PSEUDO_NOERRNO +#undef PSEUDO_ERRVAL #undef ENTRY #define ENTRY(name) \ @@ -108,6 +109,12 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \ LOADSYSCALL(syscall_name); \ ta 0x6d +#define PSEUDO_ERRVAL(name, syscall_name, args) \ + .text; \ + ENTRY(name); \ + LOADSYSCALL(syscall_name); \ + ta 0x6d + #undef PSEUDO_END #define PSEUDO_END(name) \ .size name,.-name @@ -116,6 +123,10 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \ #define PSEUDO_END_NOERRNO(name) \ .size name,.-name +#undef PSEUDO_END_ERRVAL +#define PSEUDO_END_ERRVAL(name) \ + .size name,.-name + #undef END #define END(name) \ .size name,.-name @@ -123,6 +134,7 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_error_handler) \ /* Careful here! This "ret" define can interfere; use jmpl if unsure. */ #define ret retl; nop #define ret_NOERRNO retl; nop +#define ret_ERRVAL retl; nop #define r0 %o0 #define r1 %o1 #define MOVE(x,y) mov x, y diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index cf1a121b20..188401bab7 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -44,8 +44,6 @@ 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 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 26f2b07250..9fea709edb 100644 --- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list +++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list @@ -4,7 +4,7 @@ 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 +posix_fadvise64 - fadvise64 Vi:iiii posix_fadvise64 posix_fadvise 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 |