Browse Source

- now passes all LTP tests

Bernhard Reutner-Fischer 15 years ago
parent
commit
0e4d33b939

+ 1 - 6
libc/sysdeps/linux/i386/Makefile.arch

@@ -9,11 +9,6 @@ CSRC := brk.c sigaction.c __syscall_error.c
 
 SSRC := \
 	__longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S bsd-_setjmp.S \
-	sync_file_range.S syscall.S mmap.S mmap64.S
-
-ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
-SSRC += posix_fadvise64.S
-CSRC += posix_fadvise.c
-endif
+	sync_file_range.S syscall.S mmap.S mmap64.S posix_fadvise64.S
 
 include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch

+ 0 - 36
libc/sysdeps/linux/i386/posix_fadvise.c

@@ -1,36 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * posix_fadvise() for uClibc
- *
- * Copyright (C) 2008 Bernhard Reutner-Fischer <uclibc@uclibc.org>
- *
- * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
- */
-
-#include <sys/syscall.h>
-#if defined __USE_GNU
-#include <fcntl.h>
-
-
-#if defined __NR_fadvise64_64 || defined __NR_fadvise64
-extern int __libc_posix_fadvise64 (int, __off64_t, __off64_t, int ) __THROW;
-
-libc_hidden_proto(__libc_posix_fadvise64)
-libc_hidden_proto(posix_fadvise)
-int posix_fadvise(int fd, off_t offset, off_t len, int advice)
-{
-	if (__libc_posix_fadvise64(fd, offset, len, advice) != 0)
-		return errno;
-	return 0;
-}
-libc_hidden_def(posix_fadvise)
-#elif defined __UCLIBC_HAS_STUBS__
-libc_hidden_proto(posix_fadvise)
-int posix_fadvise(int fd attribute_unused, off_t offset attribute_unused,
-				  off_t len attribute_unused, int advice attribute_unused)
-{
-	return ENOSYS;
-}
-libc_hidden_def(posix_fadvise)
-#endif
-#endif

+ 22 - 23
libc/sysdeps/linux/i386/posix_fadvise64.S

@@ -26,7 +26,7 @@
 .global __libc_posix_fadvise64
 .type   __libc_posix_fadvise64,%function
 __libc_posix_fadvise64:
-#if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__
+#if defined __NR_fadvise64_64
 	/* Save regs  */
 	pushl	%ebp
 	pushl	%ebx
@@ -35,12 +35,12 @@ __libc_posix_fadvise64:
 
 	movl $__NR_fadvise64_64, %eax	/* Syscall number in %eax.  */
 
-	movl	24(%esp), %ebx
-	movl	28(%esp), %ecx
-	movl	32(%esp), %edx
-	movl	36(%esp), %esi
-	movl	40(%esp), %edi
-	movl	44(%esp), %ebp
+	movl	20(%esp), %ebx
+	movl	24(%esp), %ecx
+	movl	28(%esp), %edx
+	movl	32(%esp), %esi
+	movl	36(%esp), %edi
+	movl	40(%esp), %ebp
 
 	/* Do the system call trap.  */
 	int $0x80
@@ -51,27 +51,27 @@ __libc_posix_fadvise64:
 	popl	%ebx
 	popl	%ebp
 
-	/* If 0 > %eax > -4096 there was an error.  */
-	cmpl $-4096, %eax
-	ja __syscall_error
+	/* Returns 0 on success, else an error code.  */
+	negl	%eax
+
 #elif defined __NR_fadvise64
 	/* Save regs  */
 	pushl	%ebx
 	pushl	%esi
 	pushl	%edi
-
+#if 0
 	/* does len overflow long?  */
-	cmpl	$0, 40(%esp)
+	cmpl	$0, 28(%esp)
 	movl	$-EOVERFLOW, %eax
-	ja	overflow
-
+	jne	overflow
+#endif
 	movl $__NR_fadvise64, %eax	/* Syscall number in %eax.  */
 
-	movl	24(%esp), %ebx
-	movl	28(%esp), %ecx
-	movl	32(%esp), %edx
-	movl	36(%esp), %esi
-	movl	44(%esp), %edi
+	movl	16(%esp), %ebx
+	movl	20(%esp), %ecx
+	movl	24(%esp), %edx
+	movl	28(%esp), %esi
+	movl	32(%esp), %edi
 
 	/* Do the system call trap.  */
 	int $0x80
@@ -81,9 +81,8 @@ overflow:
 	popl	%esi
 	popl	%ebx
 
-	/* If 0 > %eax > -4096 there was an error.  */
-	cmpl $-4096, %eax
-	ja __syscall_error
+	/* Returns 0 on success, else an error code.  */
+	negl	%eax
 
 #elif defined __UCLIBC_HAS_STUBS__
 	movl	$-ENOSYS, %eax
@@ -95,7 +94,7 @@ overflow:
 .size __libc_posix_fadvise64,.-__libc_posix_fadvise64
 
 libc_hidden_def(__libc_posix_fadvise64)
-#if defined __UCLIBC_HAS_LFS__
+#if defined __UCLIBC_HAS_LFS__ && defined __UCLIBC_HAS_ADVANCED_REALTIME__
 weak_alias(__libc_posix_fadvise64,posix_fadvise64)
 #endif