From 9bd646022380b5eef343c61f8a8274135540db09 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 30 May 2002 23:35:59 +0000 Subject: Update. 2002-05-30 Ulrich Drepper * sysdeps/unix/sysv/linux/Makefile [$(subdir)==misc] (sysdep_routines): Add readahead. * sysdeps/unix/sysv/linux/readahead.c: New file. * sysdeps/unix/sysv/linux/syscalls.list: Add sendfile64 syscall. * sysdeps/unix/sysv/linux/Versions: Export readahead and sendfile64. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Add readahead syscall. Add sendfile64 alias to sendfile syscall. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Add s_readahead syscall. * sysdeps/unix/sysv/linux/i386/sysdep.h: Use __i686.get_pc_thunk.XX special section for PIC register loading. * sysdeps/unix/sysv/linux/i386/i686/sysdep.h: Likewise. * config.h.in: Define HAVE_HIDDEN. * configure.in: Also define HAVE_HIDDEN if HAVE_PROTECTED is defined. * elf/elf.h: Correct Alpha TLS relocations according to last spec. --- sysdeps/unix/sysv/linux/Makefile | 3 +- sysdeps/unix/sysv/linux/Versions | 6 +++ sysdeps/unix/sysv/linux/alpha/syscalls.list | 2 + sysdeps/unix/sysv/linux/i386/i686/sysdep.h | 52 +++++++++++++++++++--- sysdeps/unix/sysv/linux/i386/sysdep.h | 42 +++++++++++++++-- sysdeps/unix/sysv/linux/ia64/syscalls.list | 2 + sysdeps/unix/sysv/linux/powerpc/syscalls.list | 1 + sysdeps/unix/sysv/linux/readahead.c | 51 +++++++++++++++++++++ .../unix/sysv/linux/sparc/sparc64/syscalls.list | 2 + sysdeps/unix/sysv/linux/syscalls.list | 1 + sysdeps/unix/sysv/linux/x86_64/syscalls.list | 2 + 11 files changed, 152 insertions(+), 12 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/readahead.c (limited to 'sysdeps/unix') diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 8f4c562c32..99950086e7 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -11,7 +11,8 @@ CFLAGS-malloc.c = -DMORECORE_CLEARS=2 endif ifeq ($(subdir),misc) -sysdep_routines += sysctl clone llseek getresuid getresgid umount umount2 +sysdep_routines += sysctl clone llseek getresuid getresgid umount umount2 \ + readahead sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \ sys/klog.h sys/kdaemon.h \ diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions index 7965e11b85..2a90387f82 100644 --- a/sysdeps/unix/sysv/linux/Versions +++ b/sysdeps/unix/sysv/linux/Versions @@ -90,6 +90,12 @@ libc { # p* pivot_root; } + GLIBC_2.3 { + # r* + readahead; + # s* + sendfile64; + } GLIBC_PRIVATE { # needed by libpthread. __libc_sigaction; diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index 3dc07341e3..28c60bb876 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -28,6 +28,8 @@ getrlimit - getrlimit 2 __getrlimit getrlimit getrlimit64 setrlimit - setrlimit 2 __setrlimit setrlimit64 setrlimit ftruncate - ftruncate 2 __ftruncate ftruncate __ftruncate64 ftruncate64 truncate - truncate 2 truncate truncate64 +readahead EXTRA readahead 3 __readahead readahead +sendfile EXTRA sendfile i:iipi sendfile sendfile64 # these are actually common with the x86: sys_ustat ustat ustat 2 __syscall_ustat diff --git a/sysdeps/unix/sysv/linux/i386/i686/sysdep.h b/sysdeps/unix/sysv/linux/i386/i686/sysdep.h index 8e7e5e0420..6b54a81d32 100644 --- a/sysdeps/unix/sysv/linux/i386/i686/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/i686/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, , 1998. @@ -32,11 +32,30 @@ /* Store (- %eax) into errno through the GOT. */ # ifdef _LIBC_REENTRANT -# define SYSCALL_ERROR_HANDLER \ -1:movl (%esp),%ebx; \ + +# ifndef HAVE_HIDDEN +# define SETUP_PIC_REG \ + call 1f; \ + .subsection 1; \ +1:movl (%esp), %ebx; \ + ret; \ + .previous +# else +# define SETUP_PIC_REG \ + .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits; \ + .globl __i686.get_pc_thunk.bx; \ + .hidden __i686.get_pc_thunk.bx; \ + .type __i686.get_pc_thunk.bx,@function; \ +__i686.get_pc_thunk.bx: \ + movl (%esp), %ebx; \ ret; \ + .previous; \ + call __i686.get_pc_thunk.bx +# endif + +# define SYSCALL_ERROR_HANDLER \ 0:pushl %ebx; \ - call 1b; \ + SETUP_PIC_REG; \ addl $_GLOBAL_OFFSET_TABLE_, %ebx; \ xorl %edx, %edx; \ subl %eax, %edx; \ @@ -52,10 +71,29 @@ /* A quick note: it is assumed that the call to `__errno_location' does not modify the stack! */ # else -# define SYSCALL_ERROR_HANDLER \ -1:movl (%esp),%ecx; \ + +# ifndef HAVE_HIDDEN +# define SETUP_PIC_REG \ + call 1f; \ + .subsection 1; \ +1:movl (%esp), %ecx; \ + ret; \ + .previous +# else +# define SETUP_PIC_REG \ + .section .gnu.linkonce.t.__i686.get_pc_thunk.cx,"ax",@progbits; \ + .globl __i686.get_pc_thunk.cx; \ + .hidden __i686.get_pc_thunk.cx; \ + .type __i686.get_pc_thunk.cx,@function; \ +__i686.get_pc_thunk.cx: \ + movl (%esp), %ecx; \ ret; \ -0:call 1b; \ + .previous; \ + call __i686.get_pc_thunk.cx +# endif + +# define SYSCALL_ERROR_HANDLER \ +0:SETUP_PIC_REG; \ addl $_GLOBAL_OFFSET_TABLE_, %ecx; \ xorl %edx, %edx; \ subl %eax, %edx; \ diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 2cc39d69cd..730c4dfdf9 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -76,13 +76,30 @@ #else /* Store (- %eax) into errno through the GOT. */ #ifdef _LIBC_REENTRANT -#define SYSCALL_ERROR_HANDLER \ -0:pushl %ebx; \ + +# ifndef HAVE_HIDDEN +# define SETUP_PIC_REG \ call 1f; \ .subsection 1; \ 1:movl (%esp), %ebx; \ + ret; \ + .previous +# else +# define SETUP_PIC_REG \ + .section .gnu.linkonce.t.__i686.get_pc_thunk.bx,"ax",@progbits; \ + .globl __i686.get_pc_thunk.bx; \ + .hidden __i686.get_pc_thunk.bx; \ + .type __i686.get_pc_thunk.bx,@function; \ +__i686.get_pc_thunk.bx: \ + movl (%esp), %ebx; \ ret; \ .previous; \ + call __i686.get_pc_thunk.bx +# endif + +#define SYSCALL_ERROR_HANDLER \ +0:pushl %ebx; \ + SETUP_PIC_REG; \ addl $_GLOBAL_OFFSET_TABLE_, %ebx; \ xorl %edx, %edx; \ subl %eax, %edx; \ @@ -98,12 +115,29 @@ /* A quick note: it is assumed that the call to `__errno_location' does not modify the stack! */ #else -#define SYSCALL_ERROR_HANDLER \ -0:call 1f; \ + +# ifndef HAVE_HIDDEN +# define SETUP_PIC_REG \ + call 1f; \ .subsection 1; \ 1:movl (%esp), %ecx; \ + ret; \ + .previous +# else +# define SETUP_PIC_REG \ + .section .gnu.linkonce.t.__i686.get_pc_thunk.cx,"ax",@progbits; \ + .globl __i686.get_pc_thunk.cx; \ + .hidden __i686.get_pc_thunk.cx; \ + .type __i686.get_pc_thunk.cx,@function; \ +__i686.get_pc_thunk.cx: \ + movl (%esp), %ecx; \ ret; \ .previous; \ + call __i686.get_pc_thunk.cx +# endif + +#define SYSCALL_ERROR_HANDLER \ +0:define SETUP_PIC_REG; \ addl $_GLOBAL_OFFSET_TABLE_, %ecx; \ xorl %edx, %edx; \ subl %eax, %edx; \ diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list index 15a93df618..6463a6ffaa 100644 --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list @@ -15,6 +15,8 @@ ftruncate - ftruncate 2 __ftruncate ftruncate ftruncate64 __ftruncate64 truncate - truncate 2 truncate truncate64 getrlimit - getrlimit 2 __getrlimit getrlimit getrlimit64 setrlimit - setrlimit 2 __setrlimit setrlimit setrlimit64 +readahead EXTRA readahead 3 __readahead readahead +sendfile EXTRA sendfile i:iipi sendfile sendfile64 # semaphore and shm system calls msgctl - msgctl i:iip __msgctl msgctl diff --git a/sysdeps/unix/sysv/linux/powerpc/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/syscalls.list index 7532b9c8fe..434a9a1f7a 100644 --- a/sysdeps/unix/sysv/linux/powerpc/syscalls.list +++ b/sysdeps/unix/sysv/linux/powerpc/syscalls.list @@ -4,6 +4,7 @@ s_ioctl ioctl ioctl i:iiI __syscall_ioctl s_ipc msgget ipc i:iiiip __syscall_ipc s_llseek llseek _llseek i:iiipi __syscall__llseek +s_readahead readahead readahead i:iiii __syscall_readahead s_chown chown chown i:sii __syscall_chown s_execve execve execve i:spp __syscall_execve rt_sigaction - rt_sigaction i:ippi __syscall_rt_sigaction diff --git a/sysdeps/unix/sysv/linux/readahead.c b/sysdeps/unix/sysv/linux/readahead.c new file mode 100644 index 0000000000..33ea7315d5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/readahead.c @@ -0,0 +1,51 @@ +/* Provide kernel hint to read ahead. + Copyright (C) 2002 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 +#include + +#include +#include + + +#ifdef __NR_readahead + +extern int __syscall_readahead (int fd, off_t offset_hi, off_t offset_lo, + size_t count); + + +ssize_t +__readahead (int fd, loff_t offset, size_t count) +{ + return INLINE_SYSCALL (readahead, 4, fd, (off_t) (offset >> 32), + (off_t) (offset & 0xffffffff), count); +} +#else +ssize_t +__readahead (int fd, loff_t offset, size_t count) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (readahead) + +# include +#endif + +weak_alias (__readahead, readahead) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list index ab93d2fce3..6521c25120 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list @@ -11,6 +11,8 @@ setrlimit - setrlimit 2 __setrlimit setrlimit64 setrlimit ftruncate - ftruncate 2 __ftruncate ftruncate __ftruncate64 ftruncate64 truncate - truncate 2 truncate truncate64 mmap - mmap 6 __mmap mmap __mmap64 mmap64 +readahead EXTRA readahead 3 __readahead readahead +sendfile EXTRA sendfile i:iipi sendfile sendfile64 # Override select.S in parent directory: select - select 5 __select select diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 205699d94d..c3388b28bd 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -49,6 +49,7 @@ sched_sets - sched_setscheduler i:iip __sched_setscheduler sched_setscheduler sched_yield - sched_yield i: __sched_yield sched_yield select - _newselect i:iPPPP __select select sendfile EXTRA sendfile i:iipi sendfile +sendfile64 EXTRA sendfile64 i:iipi sendfile64 setfsgid EXTRA setfsgid i:i setfsgid setfsuid EXTRA setfsuid i:i setfsuid setpgid - setpgid i:ii __setpgid setpgid diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list index dcb1a090d7..294226726f 100644 --- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list +++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list @@ -14,6 +14,8 @@ getrlimit - getrlimit i:ip __getrlimit getrlimit getrlimit64 setrlimit - setrlimit i:ip __setrlimit setrlimit64 setrlimit ftruncate - ftruncate i:ii __ftruncate ftruncate ftruncate64 __ftruncate64 truncate - truncate i:si truncate truncate64 +readahead EXTRA readahead i:iipi __readahead readahead +sendfile EXTRA sendfile i:iip sendfile sendfile64 # semaphore and shm system calls msgctl - msgctl i:iip __msgctl msgctl -- cgit 1.4.1