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.
This commit is contained in:
Ulrich Drepper 2003-08-16 06:21:46 +00:00
parent 20d9b98f8a
commit bfef926466
19 changed files with 254 additions and 12 deletions

View File

@ -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 >=

View 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.

View 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

View 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

View File

@ -24,11 +24,10 @@
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>

View File

@ -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>

View 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

View File

@ -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;
}

View 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)

View 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

View File

@ -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))

View File

@ -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

View 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

View File

@ -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) ; \

View File

@ -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

View 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,

View 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

View 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

View File

@ -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