public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* posix_fadvise change
@ 2003-08-16  6:25 Ulrich Drepper
  2003-08-16  9:17 ` Andreas Jaeger
  2003-08-16 12:49 ` Jakub Jelinek
  0 siblings, 2 replies; 5+ messages in thread
From: Ulrich Drepper @ 2003-08-16  6:25 UTC (permalink / raw)
  To: Glibc hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've checked in some change which change the interface of posix_fadvise.
 It's a reaction to the problem with the posix_fadvise Andrew Morton
discovered a few days ago.  The changes are now in the Linux kernel and
even in POSIX (well, they'll be in the next draft).

The compatibilty code was nasty, but on x86 we also hit the 6 argument
limit so I had to write the code in asm.  hammer and ia64 should work,
too, maybe alpha too.  I haven't done work on any other arch.

While doing this I found another problem: the posix_madvise function is
supposed to return the error value, not -1 on failure.  So it is split
from the madvise code.  And I had to introduce a new magic prefix for
the syscalls.list list.  V indicates the error value has to be returned.
 Again, no work done for platforms other than x86, hammer, ia64.  And I
haven't even checked the latter two yet.

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/Pc5A2ijCOnn/RHQRAhZ1AJ4hucozmqDg94S7I5x1gRdUYeCXzwCfdtWX
+G8o+DaopzUtKwAgTO1VqcM=
=ahcO
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: posix_fadvise change
  2003-08-16  6:25 posix_fadvise change Ulrich Drepper
@ 2003-08-16  9:17 ` Andreas Jaeger
  2003-08-16 12:51   ` Jakub Jelinek
  2003-08-16 12:49 ` Jakub Jelinek
  1 sibling, 1 reply; 5+ messages in thread
From: Andreas Jaeger @ 2003-08-16  9:17 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

[-- Attachment #1: Type: text/plain, Size: 1994 bytes --]


You missed at least the following two changes.  I'll commmit them
now.  Tested on x86_64-linux-gnu.

Andreas

2003-08-16  Andreas Jaeger  <aj@suse.de>

	* sysdeps/generic/posix_fadvise.c (posix_fadvise): Adjust prototype.
	* sysdeps/generic/posix_fadvise64.c (posix_fadvise64): Likewise.

============================================================
Index: sysdeps/generic/posix_fadvise.c
--- sysdeps/generic/posix_fadvise.c	6 Jul 2001 04:55:49 -0000	1.2
+++ sysdeps/generic/posix_fadvise.c	16 Aug 2003 09:15:29 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 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
@@ -23,7 +23,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)
 {
   __set_errno (ENOSYS);
   return -1;
============================================================
Index: sysdeps/generic/posix_fadvise64.c
--- sysdeps/generic/posix_fadvise64.c	6 Jul 2001 04:55:49 -0000	1.2
+++ sysdeps/generic/posix_fadvise64.c	16 Aug 2003 09:15:29 -0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 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
@@ -23,7 +23,7 @@
    respect to the file associated with FD.  */
 
 int
-posix_fadvise64 (int fd, __off64_t offset, size_t len, int advise)
+posix_fadvise64 (int fd, __off64_t offset, __off64_t len, int advise)
 {
   __set_errno (ENOSYS);
   return -1;

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: posix_fadvise change
  2003-08-16  6:25 posix_fadvise change Ulrich Drepper
  2003-08-16  9:17 ` Andreas Jaeger
@ 2003-08-16 12:49 ` Jakub Jelinek
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Jelinek @ 2003-08-16 12:49 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

On Fri, Aug 15, 2003 at 11:25:04PM -0700, Ulrich Drepper wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I've checked in some change which change the interface of posix_fadvise.
>  It's a reaction to the problem with the posix_fadvise Andrew Morton
> discovered a few days ago.  The changes are now in the Linux kernel and
> even in POSIX (well, they'll be in the next draft).
> 
> The compatibilty code was nasty, but on x86 we also hit the 6 argument
> limit so I had to write the code in asm.  hammer and ia64 should work,
> too, maybe alpha too.  I haven't done work on any other arch.
> 
> While doing this I found another problem: the posix_madvise function is
> supposed to return the error value, not -1 on failure.  So it is split
> from the madvise code.  And I had to introduce a new magic prefix for
> the syscalls.list list.  V indicates the error value has to be returned.
>  Again, no work done for platforms other than x86, hammer, ia64.  And I
> haven't even checked the latter two yet.

The following patch adds magic for various other arches.
Furthermore, fixes a few problems I discovered.
One is, even on non-i386 32-bit arches we need both
posix_fadvise64@@GLIBC_2.3.3 and posix_fadvise64@GLIBC_2.2
always, no matter whether __NR_posix_fadvise64 and/or
__NR_posix_fadvise64_64 are defined in kernel headers (so we cannot use
syscalls.list for that, otherwise if kernel headers don't define them,
we would end up using sysdeps/generic versions, but that one doesn't have
symbol versioning stuff for @GLIBC_2.2/@@GLIBC_2.3.3).

2003-08-16  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/powerpc/powerpc32/sysdep.h (PSEUDO_ERRVAL,
	PSEUDO_RET_ERRVAL, ret_ERRVAL, PSEUDO_END_ERRVAL): Define.
	* sysdeps/powerpc/powerpc64/sysdep.h (PSEUDO_ERRVAL,
	PSEUDO_RET_ERRVAL, ret_ERRVAL, PSEUDO_END_ERRVAL): Define.
	* sysdeps/unix/alpha/sysdep.h (PSEUDO_ERRVAL,
	ret_ERRVAL, PSEUDO_END_ERRVAL): Define.
	* sysdeps/unix/mips/sysdep.h (PSEUDO_ERRVAL,
	ret_ERRVAL, PSEUDO_END_ERRVAL): Define.
	* sysdeps/unix/sparc/sysdep.h (PSEUDO_ERRVAL,
	ret_ERRVAL): Define.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (PSEUDO_ERRVAL,
	PSEUDO_END_ERRVAL, ret_ERRVAL): Define.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (PSEUDO_ERRVAL,
	PSEUDO_END_ERRVAL, ret_ERRVAL): Define.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h (PSEUDO_ERRVAL):
	Define.
	* sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h (PSEUDO_ERRVAL,
	PSEUDO_END_ERRVAL, ret_ERRVAL): Define.
	* sysdeps/unix/sysdep.h (PSEUDO_END_ERRVAL): Define.

	* sysdeps/unix/sysv/linux/syscalls.list (posix_fadvise64,
	posix_fadvise64_64): Remove.
	* sysdeps/unix/sysv/linux/alpha/syscalls.list (posix_fadvise64): Add
	V flag.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list (posix_fadvise64):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list
	(posix_fadvise64): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
	(posix_fadvise64): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
	(posix_fadvise64): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/syscalls.list (posix_fadvise64):
	Likewise.
	* sysdeps/unix/sysv/linux/i386/posix_fadvise64_64.S: Moved to...
	* sysdeps/unix/sysv/linux/i386/posix_fadvise64.S: ...here.
	(__posix_fadvise64_l64): Fix a typo in fadvise64 syscall invocation.
	(__posix_fadvise64_l32): New function.
	* sysdeps/unix/sysv/linux/i386/Makefile: Revert last change.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions (libc): Export
	posix_fadvise64@@GLIBC_2.3.3.
	* sysdeps/unix/sysv/linux/s390/s390-32/Versions (libc): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/Versions (libc): Likewise.
	* sysdeps/unix/sysv/linux/posix_fadvise.c (posix_fadvise): Return
	error value.
	* sysdeps/unix/sysv/linux/posix_fadvise64.c: New file.

--- libc/sysdeps/powerpc/powerpc32/sysdep.h.jj	2003-03-23 14:42:22.000000000 -0500
+++ libc/sysdeps/powerpc/powerpc32/sysdep.h	2003-08-16 06:07:52.000000000 -0400
@@ -144,6 +144,19 @@
 #define	PSEUDO_END_NOERRNO(name)					      \
   END (name)
 
+#define PSEUDO_ERRVAL(name, syscall_name, args)				      \
+  .section ".text";							      \
+  ENTRY (name)								      \
+    DO_CALL (SYS_ify (syscall_name));
+
+#define PSEUDO_RET_ERRVAL						      \
+    blr
+#define ret_ERRVAL PSEUDO_RET_ERRVAL
+
+#undef	PSEUDO_END_ERRVAL
+#define	PSEUDO_END_ERRVAL(name)						      \
+  END (name)
+
 /* Local labels stripped out by the linker.  */
 #undef L
 #define L(x) .L##x
--- libc/sysdeps/powerpc/powerpc64/sysdep.h.jj	2003-06-12 18:29:25.000000000 -0400
+++ libc/sysdeps/powerpc/powerpc64/sysdep.h	2003-08-16 06:09:06.000000000 -0400
@@ -249,6 +249,20 @@ LT_LABELSUFFIX(name,_name_end): ; \
 #define	PSEUDO_END_NOERRNO(name) \
   END (name)
 
+#define PSEUDO_ERRVAL(name, syscall_name, args) \
+  .section ".text";	\
+  ENTRY (name) \
+  DO_CALL (SYS_ify (syscall_name));
+
+#define PSEUDO_RET_ERRVAL \
+    blr
+
+#define ret_ERRVAL PSEUDO_RET_ERRVAL
+
+#undef	PSEUDO_END_ERRVAL
+#define	PSEUDO_END_ERRVAL(name) \
+  END (name)
+
 /* Label in text section.  */
 /* ppc64 function descriptors which requires . notation */
 #define C_TEXT(name) .##name
--- libc/sysdeps/unix/alpha/sysdep.h.jj	2003-06-20 12:24:35.000000000 -0400
+++ libc/sysdeps/unix/alpha/sysdep.h	2003-08-16 06:11:08.000000000 -0400
@@ -134,6 +134,21 @@ __LABEL(name)						\
 
 #define ret_NOERRNO ret
 
+#define PSEUDO_ERRVAL(name, syscall_name, args)	\
+	.globl name;					\
+	.align 4;					\
+	.ent name,0;					\
+__LABEL(name)						\
+	PSEUDO_PROLOGUE;				\
+	PSEUDO_PREPARE_ARGS				\
+	lda	v0, SYS_ify(syscall_name);		\
+	call_pal PAL_callsys;
+
+#undef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(sym)  END(sym)
+
+#define ret_ERRVAL ret
+
 #define r0	v0
 #define r1	a4
 
--- libc/sysdeps/unix/mips/sysdep.h.jj	2003-03-29 03:15:28.000000000 -0500
+++ libc/sysdeps/unix/mips/sysdep.h	2003-08-16 06:13:20.000000000 -0400
@@ -51,6 +51,18 @@
 
 #define ret_NOERRNO ret
 
+#define PSEUDO_ERRVAL(name, syscall_name, args)	\
+  .align 2;						\
+  ENTRY(name)						\
+  .set noreorder;					\
+  li v0, SYS_ify(syscall_name);				\
+  syscall
+
+#undef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(sym) .end sym; .size sym,.-sym
+
+#define ret_ERRVAL ret
+
 #define r0	v0
 #define r1	v1
 /* The mips move insn is d,s.  */
--- libc/sysdeps/unix/sparc/sysdep.h.jj	2003-03-23 14:42:22.000000000 -0500
+++ libc/sysdeps/unix/sparc/sysdep.h	2003-08-16 04:09:50.000000000 -0400
@@ -58,8 +58,15 @@
   mov SYS_ify(syscall_name), %g1;		\
   ta 0
 
+#define	PSEUDO_ERRVAL(name, syscall_name, args) \
+  .global syscall_error;			\
+  ENTRY (name)					\
+  mov SYS_ify(syscall_name), %g1;		\
+  ta 0
+
 #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
--- libc/sysdeps/unix/sysv/linux/alpha/syscalls.list.jj	2003-08-16 06:22:34.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/alpha/syscalls.list	2003-08-16 07:04:59.000000000 -0400
@@ -21,7 +21,7 @@ getpriority	-	getpriority	i:ii	__getprio
 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
--- libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S.jj	2003-08-16 07:48:11.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64.S	2003-08-16 07:54:24.000000000 -0400
@@ -0,0 +1,132 @@
+/* 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), %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
+
+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)
--- libc/sysdeps/unix/sysv/linux/i386/Makefile.jj	2003-08-16 06:22:35.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/i386/Makefile	2003-08-16 07:54:42.000000000 -0400
@@ -12,7 +12,3 @@ endif
 ifeq ($(subdir),resource)
 sysdep_routines += oldgetrlimit64
 endif
-
-ifeq ($(subdir),io)
-sysdep_routines += posix_fadvise64_64
-endif
--- libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64_64.S.jj	2003-08-16 06:22:35.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/i386/posix_fadvise64_64.S	2003-08-16 07:48:08.000000000 -0400
@@ -1,120 +0,0 @@
-/* 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))
-
-default_symbol_version (__posix_fadvise64_l64, posix_fadvise64, GLIBC_2.3.3)
--- libc/sysdeps/unix/sysv/linux/ia64/syscalls.list.jj	2003-08-16 06:22:35.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/ia64/syscalls.list	2003-08-16 07:06:38.000000000 -0400
@@ -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
--- libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions.jj	2002-09-05 06:12:15.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions	2003-08-16 07:09:34.000000000 -0400
@@ -20,4 +20,7 @@ libc {
     # s*
     scandir64;
   }
+  GLIBC_2.3.3 {
+    posix_fadvise64;
+  }
 }
--- libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list.jj	2003-02-05 18:29:25.000000000 -0500
+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list	2003-08-16 07:07:10.000000000 -0400
@@ -25,7 +25,7 @@ s_getrlimit	getrlimit getrlimit	i:ip	__s
 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
--- libc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h.jj	2003-03-26 13:04:22.000000000 -0500
+++ libc/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h	2003-08-16 04:15:54.000000000 -0400
@@ -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
--- libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions.jj	2002-08-23 05:29:14.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions	2003-08-16 07:13:05.000000000 -0400
@@ -23,5 +23,8 @@ libc {
     # v*
     versionsort64;
   }
+  GLIBC_2.3.3 {
+    posix_fadvise64;
+  }
 }
 
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h.jj	2003-05-05 14:23:10.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h	2003-08-16 06:19:45.000000000 -0400
@@ -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
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list.jj	2003-03-10 14:21:15.000000000 -0500
+++ libc/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list	2003-08-16 07:07:40.000000000 -0400
@@ -10,7 +10,7 @@ getpeername	-	getpeername	i:ipp	__getpee
 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
 
--- libc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h.jj	2003-03-23 14:42:23.000000000 -0500
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h	2003-08-16 04:07:31.000000000 -0400
@@ -36,6 +36,7 @@
 /* Linux/SPARC uses a different trap number */
 #undef PSEUDO
 #undef PSEUDO_NOERRNO
+#undef PSEUDO_ERRVAL
 #undef ENTRY
 #undef END
 #undef LOC
@@ -115,6 +116,12 @@ SYSCALL_ERROR_HANDLER_ENTRY(__syscall_er
 	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						\
--- libc/sysdeps/unix/sysv/linux/sparc/sparc32/Versions.jj	2002-08-23 05:29:15.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/Versions	2003-08-16 07:15:41.000000000 -0400
@@ -17,4 +17,7 @@ libc {
     # s*
     scandir64;
   }
+  GLIBC_2.3.3 {
+    posix_fadvise64;
+  }
 }
--- libc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h.jj	2003-04-14 12:48:29.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h	2003-08-16 04:10:57.000000000 -0400
@@ -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_er
 	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_er
 #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_er
 /* 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
--- libc/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list.jj	2003-02-05 18:29:26.000000000 -0500
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list	2003-08-16 07:08:03.000000000 -0400
@@ -13,7 +13,7 @@ truncate	-	truncate	2	truncate	truncate6
 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
--- libc/sysdeps/unix/sysv/linux/x86_64/syscalls.list.jj	2003-08-16 06:22:36.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/x86_64/syscalls.list	2003-08-16 07:08:33.000000000 -0400
@@ -4,7 +4,7 @@ arch_prctl	EXTRA	arch_prctl	i:ii	__arch_
 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
--- libc/sysdeps/unix/sysv/linux/syscalls.list.jj	2003-08-16 03:52:40.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/syscalls.list	2003-08-16 07:46:09.000000000 -0400
@@ -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
--- libc/sysdeps/unix/sysv/linux/posix_fadvise.c.jj	2003-08-16 03:52:40.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/posix_fadvise.c	2003-08-16 06:47:29.000000000 -0400
@@ -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
 }
--- libc/sysdeps/unix/sysv/linux/posix_fadvise64.c.jj	2003-08-16 06:37:08.000000000 -0400
+++ libc/sysdeps/unix/sysv/linux/posix_fadvise64.c	2003-08-16 07:45:02.000000000 -0400
@@ -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
--- libc/sysdeps/unix/sysdep.h.jj	2003-03-26 13:07:28.000000000 -0500
+++ libc/sysdeps/unix/sysdep.h	2003-08-16 06:12:21.000000000 -0400
@@ -50,6 +50,9 @@
 #ifndef PSEUDO_END_NOERRNO
 #define PSEUDO_END_NOERRNO(sym)	PSEUDO_END(sym)
 #endif
+#ifndef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(sym)	PSEUDO_END(sym)
+#endif
 
 /* Wrappers around system calls should normally inline the system call code.
    But sometimes it is not possible or implemented and we use this code.  */


	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: posix_fadvise change
  2003-08-16  9:17 ` Andreas Jaeger
@ 2003-08-16 12:51   ` Jakub Jelinek
  2003-08-16 16:11     ` Andreas Jaeger
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2003-08-16 12:51 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: Ulrich Drepper, Glibc hackers

On Sat, Aug 16, 2003 at 11:17:45AM +0200, Andreas Jaeger wrote:
> 
> You missed at least the following two changes.  I'll commmit them
> now.  Tested on x86_64-linux-gnu.
> 
> Andreas
> 
> 2003-08-16  Andreas Jaeger  <aj@suse.de>
> 
> 	* sysdeps/generic/posix_fadvise.c (posix_fadvise): Adjust prototype.
> 	* sysdeps/generic/posix_fadvise64.c (posix_fadvise64): Likewise.

Well, not only that, it should be changed to
  return ENOSYS;
instead of
  __set_errno (ENOSYS);
  return -1;
as well.
Forgot to put that into my patch.

	Jakub

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: posix_fadvise change
  2003-08-16 12:51   ` Jakub Jelinek
@ 2003-08-16 16:11     ` Andreas Jaeger
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Jaeger @ 2003-08-16 16:11 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers

[-- Attachment #1: Type: text/plain, Size: 2038 bytes --]

Jakub Jelinek <jakub@redhat.com> writes:

> On Sat, Aug 16, 2003 at 11:17:45AM +0200, Andreas Jaeger wrote:
>> 
>> You missed at least the following two changes.  I'll commmit them
>> now.  Tested on x86_64-linux-gnu.
>> 
>> Andreas
>> 
>> 2003-08-16  Andreas Jaeger  <aj@suse.de>
>> 
>> 	* sysdeps/generic/posix_fadvise.c (posix_fadvise): Adjust prototype.
>> 	* sysdeps/generic/posix_fadvise64.c (posix_fadvise64): Likewise.
>
> Well, not only that, it should be changed to
>   return ENOSYS;
> instead of
>   __set_errno (ENOSYS);
>   return -1;
> as well.
> Forgot to put that into my patch.

Yeah, you're right.  I'll commit the patch below now,

Andreas

2003-08-16  Jakub Jelinek <jakub@redhat.com>, Andreas Jaeger  <aj@suse.de>

	* sysdeps/generic/posix_fadvise.c (posix_fadvise): Return ENOSYS
	instead of setting errno.
	* sysdeps/generic/posix_fadvise64.c (posix_fadvise64): Likewise.

============================================================
Index: sysdeps/generic/posix_fadvise.c
--- sysdeps/generic/posix_fadvise.c	16 Aug 2003 09:17:57 -0000	1.3
+++ sysdeps/generic/posix_fadvise.c	16 Aug 2003 16:10:10 -0000
@@ -25,8 +25,7 @@
 int
 posix_fadvise (int fd, __off_t offset, __off_t len, int advise)
 {
-  __set_errno (ENOSYS);
-  return -1;
+  return ENOSYS;
 }
 stub_warning (posix_fadvise)
 #include <stub-tag.h>
============================================================
Index: sysdeps/generic/posix_fadvise64.c
--- sysdeps/generic/posix_fadvise64.c	16 Aug 2003 09:17:57 -0000	1.3
+++ sysdeps/generic/posix_fadvise64.c	16 Aug 2003 16:10:10 -0000
@@ -25,8 +25,7 @@
 int
 posix_fadvise64 (int fd, __off64_t offset, __off64_t len, int advise)
 {
-  __set_errno (ENOSYS);
-  return -1;
+  return ENOSYS;
 }
 stub_warning (posix_fadvise64)
 #include <stub-tag.h>

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-08-16 16:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-16  6:25 posix_fadvise change Ulrich Drepper
2003-08-16  9:17 ` Andreas Jaeger
2003-08-16 12:51   ` Jakub Jelinek
2003-08-16 16:11     ` Andreas Jaeger
2003-08-16 12:49 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).