mmap with __USE_FILE_OFFSET64

Andreas Jaeger aj@suse.de
Mon Nov 15 08:36:00 GMT 1999


Looking at the usage of __USE_FILE_OFFSET64, I noticed a problem with
the mmap system call.

We should use __off64_t instead of just off_t and also use __REDIRECT
--- as we do in all other usages of __USE_FILE_OFFSET64.

I'm appending a patch for inclusion in glibc 2.2 and 2.1.3.

Andreas

1999-11-15  Andreas Jaeger  <aj@suse.de>

	* misc/sys/mman.h: Use __REDIRECT for mmap, correct prototype to
	use __off64_t.


============================================================
Index: misc/sys/mman.h
--- misc/sys/mman.h	1999/10/09 21:21:58	1.3
+++ misc/sys/mman.h	1999/11/15 16:23:45
@@ -44,9 +44,14 @@
 extern void *mmap (void *__addr, size_t __len, int __prot,
 		   int __flags, int __fd, __off_t __offset) __THROW;
 #else
-extern void *mmap (void *__addr, size_t __len, int __prot,
-		   int __flags, int __fd, __off_t __offset) __THROW
-     __asm__ ("mmap64");
+# ifdef __REDIRECT
+extern void * __REDIRECT (mmap,
+			  (void *__addr, size_t __len, int __prot,
+			   int __flags, int __fd, __off64_t __offset) __THROW,
+			  mmap64);
+# else
+#  define mmap mmap64
+# endif
 #endif
 #ifdef __USE_LARGEFILE64
 extern void *mmap64 (void *__addr, size_t __len, int __prot,

-- 
 Andreas Jaeger   
  SuSE Labs aj@suse.de	
   private aj@arthur.rhein-neckar.de


More information about the Libc-hacker mailing list