mmap on AIX 7.1

Russ Allbery eagle at
Mon Sep 22 18:34:16 UTC 2014

Julien ÉLIE <julien at> writes:

> 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,
>                  from dbz.c:72:
> /usr/include/sys/mman.h:87:0: note: this is the location of the previous definition
>  #define mmap  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))
> +#ifndef mmap
> +# define mmap(s, l, p, f, d, o)       (void *) mmap((void *)(s), (l), (p), (f), (d), (o))
> +#endif
>  #define munmap(p, l)            munmap((void *)(p), (l))

I suggest just deleting that code.  Solaris 8 is pretty rare these days,
and the only downside is (harmless) compiler warnings.  Any modern
platform should have the right prototype.  This is the sort of fix that,
as soon as it starts causing actual problems, should probably just be
dropped in favor of living with the warnings on (now rare) platforms.

Russ Allbery (eagle at              <>

    Please send questions to the list rather than mailing me directly.
     <> explains why.

More information about the inn-workers mailing list