diff mbox

linux: posix_fadvise: restore implementation for xtensa

Message ID 201401021410.15637.vapier@gentoo.org
State New
Headers show

Commit Message

Mike Frysinger Jan. 2, 2014, 7:10 p.m. UTC
On Thursday 02 January 2014 05:16:14 Baruch Siach wrote:
> Commit ee84b8b400 (linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT)
> removed posix_fadvise implementation for xtensa, since xtensa does not
> define __NR_fadvise64. Redefine __NR_fadvise64 as __NR_fadvise64_64 to
> restore posix_fadvise.

try this instead (i haven't compiled it, so might have errors :P)
-mike

 # endif
 #endif

Comments

Baruch Siach Jan. 2, 2014, 7:35 p.m. UTC | #1
Hi Mike,

On Thu, Jan 02, 2014 at 02:10:14PM -0500, Mike Frysinger wrote:
> On Thursday 02 January 2014 05:16:14 Baruch Siach wrote:
> > Commit ee84b8b400 (linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT)
> > removed posix_fadvise implementation for xtensa, since xtensa does not
> > define __NR_fadvise64. Redefine __NR_fadvise64 as __NR_fadvise64_64 to
> > restore posix_fadvise.
> 
> try this instead (i haven't compiled it, so might have errors :P)
> -mike
> 
> diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c
> index e102ce7..c84c387 100644
> --- a/libc/sysdeps/linux/common/posix_fadvise.c
> +++ b/libc/sysdeps/linux/common/posix_fadvise.c
> @@ -10,18 +10,25 @@
>  
>  #include <sys/syscall.h>
>  
> -#if defined(__NR_fadvise64) || defined(__NR_arm_fadvise64_64)
> +#ifdef __NR_arm_fadvise64_64
> +/* We handle the 64bit alignment issue which is why the arm guys renamed their
> + * syscall in the first place.  So rename it back.
> + */
> +# define __NR_fadvise64_64 __NR_arm_fadvise64_64
> +#endif
> +
> +#if defined(__NR_fadvise64) || defined(__NR_fadvise64_64)
>  # include <fcntl.h>
>  # include <endian.h>
>  # include <bits/wordsize.h>
>  
> -# ifdef __NR_arm_fadvise64_64
> +# ifdef __NR_fadvise64_64
>  int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice);
>  # endif
>  
>  int posix_fadvise(int fd, off_t offset, off_t len, int advice)
>  {
> -# ifdef __NR_arm_fadvise64_64
> +# ifdef __NR_fadvise64_64
>  	return posix_fadvise64(fd, offset, len, advice);
>  # else
>  	int ret;
> @@ -41,7 +48,7 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice)
>  	return 0;
>  #  endif
>  }
> -# if defined __UCLIBC_HAS_LFS__ && ((!defined __NR_fadvise64_64 && !defined __NR_arm_fadvise64_64) || __WORDSIZE == 64)
> +# if defined __UCLIBC_HAS_LFS__ && ((!defined __NR_fadvise64_64 && !defined __NR_fadvise64_64) || __WORDSIZE == 64)

Redundant !defined check here.

Other than that this patch seems to do the job. Thanks.

baruch

>  strong_alias(posix_fadvise,posix_fadvise64)
>  # endif
>  #endif
diff mbox

Patch

diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c
index e102ce7..c84c387 100644
--- a/libc/sysdeps/linux/common/posix_fadvise.c
+++ b/libc/sysdeps/linux/common/posix_fadvise.c
@@ -10,18 +10,25 @@ 
 
 #include <sys/syscall.h>
 
-#if defined(__NR_fadvise64) || defined(__NR_arm_fadvise64_64)
+#ifdef __NR_arm_fadvise64_64
+/* We handle the 64bit alignment issue which is why the arm guys renamed their
+ * syscall in the first place.  So rename it back.
+ */
+# define __NR_fadvise64_64 __NR_arm_fadvise64_64
+#endif
+
+#if defined(__NR_fadvise64) || defined(__NR_fadvise64_64)
 # include <fcntl.h>
 # include <endian.h>
 # include <bits/wordsize.h>
 
-# ifdef __NR_arm_fadvise64_64
+# ifdef __NR_fadvise64_64
 int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice);
 # endif
 
 int posix_fadvise(int fd, off_t offset, off_t len, int advice)
 {
-# ifdef __NR_arm_fadvise64_64
+# ifdef __NR_fadvise64_64
 	return posix_fadvise64(fd, offset, len, advice);
 # else
 	int ret;
@@ -41,7 +48,7 @@  int posix_fadvise(int fd, off_t offset, off_t len, int advice)
 	return 0;
 #  endif
 }
-# if defined __UCLIBC_HAS_LFS__ && ((!defined __NR_fadvise64_64 && !defined __NR_arm_fadvise64_64) || 
__WORDSIZE == 64)
+# if defined __UCLIBC_HAS_LFS__ && ((!defined __NR_fadvise64_64 && !defined __NR_fadvise64_64) || 
__WORDSIZE == 64)
 strong_alias(posix_fadvise,posix_fadvise64)