[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conflict between glibc and Mach headers

From: Roland McGrath
Subject: Re: Conflict between glibc and Mach headers
Date: Mon, 2 Jul 2001 18:33:46 -0400 (EDT)

> Glibc has a header which goes into /usr/include/mach_init.h
> and Mach has a header which goes into /usr/include/mach/vm_param.h.
> Both of them define the macros `round_page' and `trunc_page'. The
> former in terms of the variable `__vm_page_size' and the latter
> in terms of the constant macro `PAGE_SIZE'.
> Was it intended for these headers not to be used together?

This whole situation hasn't changed since the original Mach code (except
for adding the __ prefix).  So there isn't much point in trying to explain
what we have now and why, just what it makes sense to have from now on.

> And why is there a variable for the page size, is it not a
> constant which can be known at compile time?

The Mach kernel interface is that the kernel is free to choose the page
size (within whatever underlying constraints there are in the hardware
architecture) and it might vary from kernel to kernel or situation to
situation (i.e. different hardware or more memory or whatever--it can never
change after the kernel has booted).  In practice, the kernel we have
always uses a constant page size.  The situation is the same for BSD
kernels and many others--that's why the `getpagesize' system call was

The use of <mach/vm_param.h> in user-mode code is a bit questionable.  I
think the only reason anything outside the kernel uses that header is for
VM_MIN_ADDRESS/VM_MAX_ADDRESS (which are defined in <mach/machine/vm_param.h>,
i.e. gnumach/i386/include/mach/i386/vm_param.h).  However, for some reason
cthreads.h includes it and that colors many random programs.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]