summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-09-19 10:31:02 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-09-19 10:31:02 +0000
commitdfd1f080f49437b390809bbfaac3cd7127f97a3d (patch)
tree55a480cdf42d68ed423ead873362ed0c6dd63581 /libc/sysdeps/linux
parent4d5405f71510d4e583467451881b045fd41616bb (diff)
- take LFS into account and add fallback via fadvise64
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/i386/posix_fadvise64.S38
1 files changed, 34 insertions, 4 deletions
diff --git a/libc/sysdeps/linux/i386/posix_fadvise64.S b/libc/sysdeps/linux/i386/posix_fadvise64.S
index 27cf7dd68..da3f36394 100644
--- a/libc/sysdeps/linux/i386/posix_fadvise64.S
+++ b/libc/sysdeps/linux/i386/posix_fadvise64.S
@@ -26,15 +26,14 @@
.global posix_fadvise64
.type posix_fadvise64,%function
posix_fadvise64:
-#ifdef __NR_posix_fadvise64_64
-
+#if defined __NR_fadvise64_64 && defined __UCLIBC_HAS_LFS__
/* Save regs */
pushl %ebp
pushl %ebx
pushl %esi
pushl %edi
- movl $__NR_posix_fadvise64_64, %eax /* Syscall number in %eax. */
+ movl $__NR_fadvise64_64, %eax /* Syscall number in %eax. */
movl 24(%esp), %ebx
movl 28(%esp), %ecx
@@ -55,7 +54,38 @@ posix_fadvise64:
/* If 0 > %eax > -4096 there was an error. */
cmpl $-4096, %eax
ja __syscall_error
-#else
+#elif defined __NR_fadvise64
+ /* Save regs */
+ pushl %ebx
+ pushl %esi
+ pushl %edi
+
+ /* does len overflow long? */
+ cmpl $0, 40(%esp)
+ movl $-EOVERFLOW, %eax
+ ja overflow
+
+ 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
+
+ /* Do the system call trap. */
+ int $0x80
+overflow:
+ /* Restore regs */
+ popl %edi
+ popl %esi
+ popl %ebx
+
+ /* If 0 > %eax > -4096 there was an error. */
+ cmpl $-4096, %eax
+ ja __syscall_error
+
+#elif defined __UCLIBC_HAS_STUBS__
movl $-ENOSYS, %eax
jmp __syscall_error
#endif