This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: posix_fadvise fallback to fadvise64_64 if fadvise64 is not present?


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
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]