From 7cabffadf48b4d2d5c2265cdc2615ad7d7888c2d Mon Sep 17 00:00:00 2001
From: Peter S. Mazinger <ps.m@gmx.net>
Date: Wed, 6 Apr 2011 15:57:24 +0200
Subject: [PATCH 231/396] stubs.c: provide stubs for posix_fadvise[64]

Add a new macro to return ENOSYS.
Despite it's name, __NR_fadvise64 is not LFS related, do not undefine it.

Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
---
 libc/sysdeps/linux/common/stubs.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c
index bc64c1f..8ac5b9e 100644
--- a/libc/sysdeps/linux/common/stubs.c
+++ b/libc/sysdeps/linux/common/stubs.c
@@ -19,16 +19,37 @@ static int enosys_stub(void)
 	return -1;
 }
 
+static int ret_enosys_stub(void)
+{
+	return ENOSYS;
+}
+
 #define make_stub(stub) \
 	link_warning(stub, #stub ": this function is not implemented") \
 	strong_alias(enosys_stub, stub)
 
+#define make_ret_stub(stub) \
+	link_warning(stub, #stub ": this function is not implemented") \
+	strong_alias(ret_enosys_stub, stub)
+
 #ifndef __ARCH_USE_MMU__
 # undef __NR_fork
 #endif
 
+#ifdef __arm__
+# define __NR_fadvise64_64 __NR_arm_fadvise64_64
+# define __NR_fadvise64 __NR_arm_fadvise64_64
+#endif
+
+#ifdef __mips__
+# define __NR_fadvise64_64 __NR_fadvise64
+#endif
+
+#ifdef __xtensa__
+# define __NR_fadvise64 __NR_fadvise64_64
+#endif
+
 #ifndef __UCLIBC_HAS_LFS__
-# undef __NR_fadvise64
 # undef __NR_fadvise64_64
 # undef __NR_readahead
 # undef __NR_sync_file_range
@@ -416,4 +437,12 @@ make_stub(vhangup)
 make_stub(vmsplice)
 #endif
 
+#ifndef __NR_fadvise64
+make_ret_stub(posix_fadvise)
+#endif
+
+#ifndef __NR_fadvise64_64
+make_ret_stub(posix_fadvise64)
+#endif
+
 #endif
-- 
1.7.0.4

