[MLton] Re: [MLton-commit] r5742

Jesper Louis Andersen jesper.louis.andersen at gmail.com
Sun Jul 8 15:29:58 PDT 2007


On 7/8/07, Matthew Fluet <fluet at tti-c.org> wrote:
>
>
> Is the HW_PAGESIZE sysctl also a size_t?  The FreeBSD sysctl man page
> just says that the type is "integer".


Oh, my change may actually be slightly wrong. The HW_PHYSMEM mib is defined
in
/usr/src/sys/kern/kern_mib.c:

-->
 SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_ULONG | CTLFLAG_RD,
        0, 0, sysctl_hw_physmem, "LU", "");
<--

with a type of CLTYPE_ULONG, which you can find in /usr/src/sys/sys/sysctl.h
described as an Unsigned Long. On a 64-bit architecture, this will be a
64-bit value if my memory serves me right with C-conventions and LP64. So
rather than a size_t, we may want an unsigned long in FreeBSD land...

The HW_PAGESIZE is also right there
-->
SYSCTL_INT(_hw, HW_PAGESIZE, pagesize, CTLFLAG_RD,
    0, PAGE_SIZE, "System memory page size");
<--

SYSCTL_INT is a macro defined in /usr/src/sys/sys/sysctl.h setting
CTLTYPE_INT which is an 'int' in C-conventions. FreeBSD would serve us
better had they documented this in their man-page in my opinion.

Also, the NetBSD man page seems to suggest that a separate physmem64
> control is used to fetch the size of RAM, while physmem is guaranteed to
> be 32-bits:
>    http://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-current


The sysctls are different among the BSD-derived systems. There may be some
simarity between NetBSD and OpenBSD due to their heritage (OpenBSD stems
from NetBSD). It does mean, though, that we might want to handle the sysctls
on a per-platform basis more than we do right now. I am not sure what is the
best approach to take.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton/attachments/20070709/252f75f2/attachment.html


More information about the MLton mailing list