mmap on AIX 7.1
julien at trigofacile.com
Mon Sep 22 17:27:24 UTC 2014
When building INN on AIX 7.1 with large files support, the following error occurs:
../include/portable/mmap.h:27:0: warning: "mmap" redefined
#define mmap(s, l, p, f, d, o) (void *) mmap((s), (l), (p), (f), (d), (o))
In file included from ../include/portable/mmap.h:14:0,
/usr/include/sys/mman.h:87:0: note: this is the location of the previous definition
#define mmap mmap64
According to AIX documentation:
"The mmap64 subroutine is identical to the mmap subroutine except that the starting
offset for the file mapping is specified as a 64-bit value. This permits file
mappings which start beyond OFF_MAX.
In the large file enabled programming environment, mmap is redefined to be mmap64."
What would the best way be to fix that?
--- include/portable/mmap.h (révision 9705)
+++ include/portable/mmap.h (copie de travail)
@@ -24,7 +24,9 @@
/* Solaris 8 (at least) prototypes munmap, msync, and madvise as taking char *
(actually a caddr_t, which is a typedef for a char *) instead of void * as
is required by the standard. These macros add casts that silences compiler
warnings on Solaris 8 without adversely affecting other platforms. (ISO C
allows macro definitions of this sort; this macro is not recursive.) */
-#define mmap(s, l, p, f, d, o) (void *) mmap((s), (l), (p), (f), (d), (o))
+# define mmap(s, l, p, f, d, o) (void *) mmap((void *)(s), (l), (p), (f), (d), (o))
#define munmap(p, l) munmap((void *)(p), (l))
Shouldn't (void *) also be for (s) in mmap? (as suggested in the change)
Is the "#ifndef mmap" check enough? At least, it works fine on AIX and
also my Debian but I wonder whether it is the right fix.
« Pour Rome, la direction importe peu, car tous les chemins y
mènent. » (Astérix)
More information about the inn-workers