[PATCH] linux: posix_fadvise: support __NR_fadvise64_64

Andreas Jaeger aj@suse.com
Thu Dec 6 20:44:00 GMT 2012


On 12/06/2012 09:06 PM, Mike Frysinger wrote:
> From: Carlos O'Donell <carlos_odonell@mentor.com>
>
> Some arches do not have a __NR_fadvise64 but do have __NR_fadvise64_64.
> If the former is unavailable, fallback to the latter.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Before you commit, please remember to update the Copyright year.

The change is fine,

thanks,
Andreas

> 2012-12-06  Carlos O'Donell  <carlos_odonell@mentor.com>
> 	    Mike Frysinger  <vapier@gentoo.org>
>
> 	* sysdeps/unix/sysv/linux/posix_fadvise.c (posix_fadvise): Also
> 	check for __NR_fadvise64_64.
> ---
>   sysdeps/unix/sysv/linux/posix_fadvise.c | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/sysdeps/unix/sysv/linux/posix_fadvise.c b/sysdeps/unix/sysv/linux/posix_fadvise.c
> index cf28faf..0440816 100644
> --- a/sysdeps/unix/sysv/linux/posix_fadvise.c
> +++ b/sysdeps/unix/sysv/linux/posix_fadvise.c
> @@ -25,11 +25,20 @@
>   int
>   posix_fadvise (int fd, off_t offset, off_t len, int advise)
>   {
> -#ifdef __NR_fadvise64
> +#if defined(__NR_fadvise64) || defined(__NR_fadvise64_64)
>     INTERNAL_SYSCALL_DECL (err);
> +# ifdef __NR_fadvise64
>     int ret = INTERNAL_SYSCALL (fadvise64, err, 5, fd,
>   			      __LONG_LONG_PAIR (offset >> 31, offset), len,
>   			      advise);
> +# else
> +  int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd,
> +			      __LONG_LONG_PAIR ((long) (offset >> 31),
> +						(long) offset),
> +			      __LONG_LONG_PAIR ((long) (len >> 31),
> +						(long) len),
> +			      advise);
> +# endif
>     if (INTERNAL_SYSCALL_ERROR_P (ret, err))
>       return INTERNAL_SYSCALL_ERRNO (ret, err);
>     return 0;
>


-- 
  Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
   SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
    GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
     GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126



More information about the Libc-alpha mailing list