[MLton] additional sysconf variables

Christopher Cramer tsuyoshi at yumegakanau.org
Tue Jul 12 17:41:42 PDT 2011


On Tue, Jul 12, 2011 at 04:56:22PM -0400, Matthew Fluet wrote:
> For the most part, we've been following the Single Unix Specification
> for the POSIX functionality.  The currently supported sysconf
> variables correspond to those that are required by the specification
> (http://pubs.opengroup.org/onlinepubs/009695399/functions/sysconf.html).
>  I'm not sure the best way of handling variables above and beyond the
> required set.  Adding them piecemeal like this seems to be an onerous
> process.  SML/NJ tries to mine <unistd.h> for _SC* names and generates
> a table specific to the target platform.

Well... I don't think it's that onerous. I just copied the few extra ones
from the Linux docs. Checking the other platforms supported by MLton,
Solaris also has SC_NPROCESSORS_MAX, and then HPUX has a about a dozen
others. FreeBSD, OSX, AIX, OpenBSD, and NetBSD don't have any others
(most of them have just SC_NPROCESSORS_CONF and SC_NPROCESSORS_ONLN -
SC_NPROCESSORS_ONLN is in fact the one I want).

Personally, I don't care about anything except Linux, but adding
SC_NPROCESSORS_MAX is not a big deal. The HPUX ones are mostly for
checking CPU characteristics, and I don't think they'll ever be useful
for a program written in SML. If you'd really like, I could write a
thing to do it the SML/NJ way though.



More information about the MLton mailing list