This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: posix_fadvise fallback to fadvise64_64 if fadvise64 is not present?
- From: Carlos O'Donell <carlos at baldric dot uwo dot ca>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: libc-alpha <libc-alpha at sources dot redhat dot com>
- Date: Sun, 26 Sep 2004 22:52:46 -0400
- Subject: Re: posix_fadvise fallback to fadvise64_64 if fadvise64 is not present?
- References: <20040924145255.GV27033@baldric.uwo.ca> <41544EEB.5030008@redhat.com>
On Fri, Sep 24, 2004 at 09:44:27AM -0700, Ulrich Drepper wrote:
> > If fadvise64_64 is present, but fadvise64 is not, should posix-fadvise
> > fallback onto fadvise64_64 before returning ENOSYS?
>
> Yes.
Before I test, is this check for fadvise64_64 acceptable?
Cheers,
Carlos.
2004-09-26 Carlos O'Donell <carlos@baldric.uwo.ca>
* sysdeps/unix/sysv/linux/posix_fadvise.c (posix_fadvise):
Use fadvise64_64 if fadvise64 is not present.
Index: posix_fadvise.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/posix_fadvise.c,v
retrieving revision 1.3
diff -u -p -r1.3 posix_fadvise.c
--- posix_fadvise.c 17 Aug 2003 00:36:22 -0000 1.3
+++ posix_fadvise.c 27 Sep 2004 02:28:17 -0000
@@ -35,6 +35,19 @@ posix_fadvise (int fd, off_t offset, off
return INTERNAL_SYSCALL_ERRNO (ret, err);
return 0;
#else
+# ifdef __NR_fadvise64_64
+ INTERNAL_SYSCALL_DECL (err);
+ 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);
+ if (INTERNAL_SYSCALL_ERROR_P (ret, err))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+# else
return ENOSYS;
+# endif
#endif
}