#define MADV_NORMAL different in kernel and glibc

rwhron@earthlink.net
Sun, 28 Oct 2001 09:23:14 -0500


Not a bug, just an inconsistency:

#defines for MADV_* are different between glibc-2.2.4 and recent linux kernels.

Most src/linux/include/asm*/mman.h define MADV_* in hex.
asm-alpha and asm-parisc in Linus and Alan trees use decimal.

/usr/include/bits comes from glibc.

hrandoz@rushmore:/$ grep " MADV_" /usr/include/bits/mman.h
# define MADV_NORMAL 0 /* No further special treatment. */
# define MADV_RANDOM 1 /* Expect random page references. */
# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
# define MADV_WILLNEED 3 /* Will need these pages. */
# define MADV_DONTNEED 4 /* Don't need these pages. */

/usr/include/asm comes from src/linux/include/asm.

hrandoz@rushmore:/$ grep " MADV_" /usr/include/asm/mman.h
#define MADV_NORMAL 0x0 /* default page-in behavior */
#define MADV_RANDOM 0x1 /* page-in minimum required */
#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
#define MADV_WILLNEED 0x3 /* pre-fault pages */
#define MADV_DONTNEED 0x4 /* discard these pages */

Programs like mremap04.c from the Linux Test Project that include mman.h
give a warning like:

cc -o mremap04 mremap04.c -I../../../../include -L../../../../lib -lltp
In file included from /usr/include/linux/mman.h:4,
from mremap04.c:71:
/usr/include/asm/mman.h:28: warning: `MADV_NORMAL' redefined
/usr/include/bits/mman.h:79: warning: this is the location of the previous definition
/usr/include/asm/mman.h:29: warning: `MADV_RANDOM' redefined
/usr/include/bits/mman.h:80: warning: this is the location of the previous definition
/usr/include/asm/mman.h:30: warning: `MADV_SEQUENTIAL' redefined
/usr/include/bits/mman.h:81: warning: this is the location of the previous definition
/usr/include/asm/mman.h:31: warning: `MADV_WILLNEED' redefined
/usr/include/bits/mman.h:82: warning: this is the location of the previous definition
/usr/include/asm/mman.h:32: warning: `MADV_DONTNEED' redefined
/usr/include/bits/mman.h:83: warning: this is the location of the previous definition


Gnu C 2.95.3

-- 
Randy Hron

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/