[MLton-commit] r7557

Matthew Fluet fluet at mlton.org
Wed Jul 20 13:18:25 PDT 2011


Support for additional sysconf variables.

Adds support for querying the following variables with Posix.ProcEnv.sysconf:

    AVPHYS_PAGES
    NPROCESSORS_CONF
    NPROCESSORS_ONLN
    PHYS_PAGES

Contributed by Christopher Cramer <tsuyoshi at yumegakanau.org>.
----------------------------------------------------------------------

U   mlton/trunk/basis-library/posix/proc-env.sml
U   mlton/trunk/basis-library/primitive/basis-ffi.sml
U   mlton/trunk/runtime/basis/Posix/ProcEnv/sysconf-consts.c
U   mlton/trunk/runtime/basis-ffi.h
U   mlton/trunk/runtime/gen/basis-ffi.def
U   mlton/trunk/runtime/gen/basis-ffi.h
U   mlton/trunk/runtime/gen/basis-ffi.sml

----------------------------------------------------------------------

Modified: mlton/trunk/basis-library/posix/proc-env.sml
===================================================================
--- mlton/trunk/basis-library/posix/proc-env.sml	2011-07-20 20:18:11 UTC (rev 7556)
+++ mlton/trunk/basis-library/posix/proc-env.sml	2011-07-20 20:18:15 UTC (rev 7557)
@@ -1,4 +1,5 @@
-(* Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh
+(* Copyright (C) 2011 Matthew Fluet.
+ * Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh
  *    Jagannathan, and Stephen Weeks.
  * Copyright (C) 1997-2000 NEC Research Institute.
  *
@@ -121,6 +122,7 @@
                (Prim.SC_ARG_MAX,"ARG_MAX") ::?
                (Prim.SC_ASYNCHRONOUS_IO,"ASYNCHRONOUS_IO") ::?
                (Prim.SC_ATEXIT_MAX,"ATEXIT_MAX") ::?
+               (Prim.SC_AVPHYS_PAGES,"AVPHYS_PAGES") ::?
                (Prim.SC_BARRIERS,"BARRIERS") ::?
                (Prim.SC_BC_BASE_MAX,"BC_BASE_MAX") ::?
                (Prim.SC_BC_DIM_MAX,"BC_DIM_MAX") ::?
@@ -151,9 +153,12 @@
                (Prim.SC_MQ_OPEN_MAX,"MQ_OPEN_MAX") ::?
                (Prim.SC_MQ_PRIO_MAX,"MQ_PRIO_MAX") ::?
                (Prim.SC_NGROUPS_MAX,"NGROUPS_MAX") ::?
+               (Prim.SC_NPROCESSORS_CONF,"NPROCESSORS_CONF") ::?
+               (Prim.SC_NPROCESSORS_ONLN,"NPROCESSORS_ONLN") ::?
                (Prim.SC_OPEN_MAX,"OPEN_MAX") ::?
                (Prim.SC_PAGESIZE,"PAGESIZE") ::?
                (Prim.SC_PAGE_SIZE,"PAGE_SIZE") ::?
+               (Prim.SC_PHYS_PAGES,"PHYS_PAGES") ::?
                (Prim.SC_PRIORITIZED_IO,"PRIORITIZED_IO") ::?
                (Prim.SC_PRIORITY_SCHEDULING,"PRIORITY_SCHEDULING") ::?
                (Prim.SC_RAW_SOCKETS,"RAW_SOCKETS") ::?

Modified: mlton/trunk/basis-library/primitive/basis-ffi.sml
===================================================================
--- mlton/trunk/basis-library/primitive/basis-ffi.sml	2011-07-20 20:18:11 UTC (rev 7556)
+++ mlton/trunk/basis-library/primitive/basis-ffi.sml	2011-07-20 20:18:15 UTC (rev 7557)
@@ -540,6 +540,7 @@
 val SC_ARG_MAX = _const "Posix_ProcEnv_SC_ARG_MAX" : C_Int.t;
 val SC_ASYNCHRONOUS_IO = _const "Posix_ProcEnv_SC_ASYNCHRONOUS_IO" : C_Int.t;
 val SC_ATEXIT_MAX = _const "Posix_ProcEnv_SC_ATEXIT_MAX" : C_Int.t;
+val SC_AVPHYS_PAGES = _const "Posix_ProcEnv_SC_AVPHYS_PAGES" : C_Int.t;
 val SC_BARRIERS = _const "Posix_ProcEnv_SC_BARRIERS" : C_Int.t;
 val SC_BC_BASE_MAX = _const "Posix_ProcEnv_SC_BC_BASE_MAX" : C_Int.t;
 val SC_BC_DIM_MAX = _const "Posix_ProcEnv_SC_BC_DIM_MAX" : C_Int.t;
@@ -570,9 +571,12 @@
 val SC_MQ_OPEN_MAX = _const "Posix_ProcEnv_SC_MQ_OPEN_MAX" : C_Int.t;
 val SC_MQ_PRIO_MAX = _const "Posix_ProcEnv_SC_MQ_PRIO_MAX" : C_Int.t;
 val SC_NGROUPS_MAX = _const "Posix_ProcEnv_SC_NGROUPS_MAX" : C_Int.t;
+val SC_NPROCESSORS_CONF = _const "Posix_ProcEnv_SC_NPROCESSORS_CONF" : C_Int.t;
+val SC_NPROCESSORS_ONLN = _const "Posix_ProcEnv_SC_NPROCESSORS_ONLN" : C_Int.t;
 val SC_OPEN_MAX = _const "Posix_ProcEnv_SC_OPEN_MAX" : C_Int.t;
 val SC_PAGE_SIZE = _const "Posix_ProcEnv_SC_PAGE_SIZE" : C_Int.t;
 val SC_PAGESIZE = _const "Posix_ProcEnv_SC_PAGESIZE" : C_Int.t;
+val SC_PHYS_PAGES = _const "Posix_ProcEnv_SC_PHYS_PAGES" : C_Int.t;
 val SC_PRIORITIZED_IO = _const "Posix_ProcEnv_SC_PRIORITIZED_IO" : C_Int.t;
 val SC_PRIORITY_SCHEDULING = _const "Posix_ProcEnv_SC_PRIORITY_SCHEDULING" : C_Int.t;
 val SC_RAW_SOCKETS = _const "Posix_ProcEnv_SC_RAW_SOCKETS" : C_Int.t;

Modified: mlton/trunk/runtime/basis/Posix/ProcEnv/sysconf-consts.c
===================================================================
--- mlton/trunk/runtime/basis/Posix/ProcEnv/sysconf-consts.c	2011-07-20 20:18:11 UTC (rev 7556)
+++ mlton/trunk/runtime/basis/Posix/ProcEnv/sysconf-consts.c	2011-07-20 20:18:15 UTC (rev 7557)
@@ -100,6 +100,10 @@
 #define _SC_ADVISORY_INFO -1
 #endif
 const C_Int_t Posix_ProcEnv_SC_ADVISORY_INFO = _SC_ADVISORY_INFO;
+#ifndef _SC_AVPHYS_PAGES
+#define _SC_AVPHYS_PAGES -1
+#endif
+const C_Int_t Posix_ProcEnv_SC_AVPHYS_PAGES = _SC_AVPHYS_PAGES;
 #ifndef _SC_BARRIERS
 #define _SC_BARRIERS -1
 #endif
@@ -152,6 +156,18 @@
 #define _SC_MONOTONIC_CLOCK -1
 #endif
 const C_Int_t Posix_ProcEnv_SC_MONOTONIC_CLOCK = _SC_MONOTONIC_CLOCK;
+#ifndef _SC_NPROCESSORS_CONF
+#define _SC_NPROCESSORS_CONF -1
+#endif
+const C_Int_t Posix_ProcEnv_SC_NPROCESSORS_CONF = _SC_NPROCESSORS_CONF;
+#ifndef _SC_NPROCESSORS_ONLN
+#define _SC_NPROCESSORS_ONLN -1
+#endif
+const C_Int_t Posix_ProcEnv_SC_NPROCESSORS_ONLN = _SC_NPROCESSORS_ONLN;
+#ifndef _SC_PHYS_PAGES
+#define _SC_PHYS_PAGES -1
+#endif
+const C_Int_t Posix_ProcEnv_SC_PHYS_PAGES = _SC_PHYS_PAGES;
 #ifndef _SC_PRIORITIZED_IO
 #define _SC_PRIORITIZED_IO -1
 #endif

Modified: mlton/trunk/runtime/basis-ffi.h
===================================================================
--- mlton/trunk/runtime/basis-ffi.h	2011-07-20 20:18:11 UTC (rev 7556)
+++ mlton/trunk/runtime/basis-ffi.h	2011-07-20 20:18:15 UTC (rev 7557)
@@ -430,6 +430,7 @@
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_ARG_MAX;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_ASYNCHRONOUS_IO;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_ATEXIT_MAX;
+PRIVATE extern const C_Int_t Posix_ProcEnv_SC_AVPHYS_PAGES;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_BARRIERS;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_BC_BASE_MAX;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_BC_DIM_MAX;
@@ -460,9 +461,12 @@
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_MQ_OPEN_MAX;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_MQ_PRIO_MAX;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_NGROUPS_MAX;
+PRIVATE extern const C_Int_t Posix_ProcEnv_SC_NPROCESSORS_CONF;
+PRIVATE extern const C_Int_t Posix_ProcEnv_SC_NPROCESSORS_ONLN;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_OPEN_MAX;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_PAGE_SIZE;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_PAGESIZE;
+PRIVATE extern const C_Int_t Posix_ProcEnv_SC_PHYS_PAGES;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_PRIORITIZED_IO;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_PRIORITY_SCHEDULING;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_RAW_SOCKETS;

Modified: mlton/trunk/runtime/gen/basis-ffi.def
===================================================================
--- mlton/trunk/runtime/gen/basis-ffi.def	2011-07-20 20:18:11 UTC (rev 7556)
+++ mlton/trunk/runtime/gen/basis-ffi.def	2011-07-20 20:18:15 UTC (rev 7557)
@@ -411,6 +411,7 @@
 Posix.ProcEnv.SC_ARG_MAX = _const : C_Int.t
 Posix.ProcEnv.SC_ASYNCHRONOUS_IO = _const : C_Int.t
 Posix.ProcEnv.SC_ATEXIT_MAX = _const : C_Int.t
+Posix.ProcEnv.SC_AVPHYS_PAGES = _const : C_Int.t
 Posix.ProcEnv.SC_BARRIERS = _const : C_Int.t
 Posix.ProcEnv.SC_BC_BASE_MAX = _const : C_Int.t
 Posix.ProcEnv.SC_BC_DIM_MAX = _const : C_Int.t
@@ -441,9 +442,12 @@
 Posix.ProcEnv.SC_MQ_OPEN_MAX = _const : C_Int.t
 Posix.ProcEnv.SC_MQ_PRIO_MAX = _const : C_Int.t
 Posix.ProcEnv.SC_NGROUPS_MAX = _const : C_Int.t
+Posix.ProcEnv.SC_NPROCESSORS_CONF = _const : C_Int.t
+Posix.ProcEnv.SC_NPROCESSORS_ONLN = _const : C_Int.t
 Posix.ProcEnv.SC_OPEN_MAX = _const : C_Int.t
 Posix.ProcEnv.SC_PAGESIZE = _const : C_Int.t
 Posix.ProcEnv.SC_PAGE_SIZE = _const : C_Int.t
+Posix.ProcEnv.SC_PHYS_PAGES = _const : C_Int.t
 Posix.ProcEnv.SC_PRIORITIZED_IO = _const : C_Int.t
 Posix.ProcEnv.SC_PRIORITY_SCHEDULING = _const : C_Int.t
 Posix.ProcEnv.SC_RAW_SOCKETS = _const : C_Int.t

Modified: mlton/trunk/runtime/gen/basis-ffi.h
===================================================================
--- mlton/trunk/runtime/gen/basis-ffi.h	2011-07-20 20:18:11 UTC (rev 7556)
+++ mlton/trunk/runtime/gen/basis-ffi.h	2011-07-20 20:18:15 UTC (rev 7557)
@@ -430,6 +430,7 @@
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_ARG_MAX;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_ASYNCHRONOUS_IO;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_ATEXIT_MAX;
+PRIVATE extern const C_Int_t Posix_ProcEnv_SC_AVPHYS_PAGES;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_BARRIERS;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_BC_BASE_MAX;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_BC_DIM_MAX;
@@ -460,9 +461,12 @@
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_MQ_OPEN_MAX;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_MQ_PRIO_MAX;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_NGROUPS_MAX;
+PRIVATE extern const C_Int_t Posix_ProcEnv_SC_NPROCESSORS_CONF;
+PRIVATE extern const C_Int_t Posix_ProcEnv_SC_NPROCESSORS_ONLN;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_OPEN_MAX;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_PAGE_SIZE;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_PAGESIZE;
+PRIVATE extern const C_Int_t Posix_ProcEnv_SC_PHYS_PAGES;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_PRIORITIZED_IO;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_PRIORITY_SCHEDULING;
 PRIVATE extern const C_Int_t Posix_ProcEnv_SC_RAW_SOCKETS;

Modified: mlton/trunk/runtime/gen/basis-ffi.sml
===================================================================
--- mlton/trunk/runtime/gen/basis-ffi.sml	2011-07-20 20:18:11 UTC (rev 7556)
+++ mlton/trunk/runtime/gen/basis-ffi.sml	2011-07-20 20:18:15 UTC (rev 7557)
@@ -540,6 +540,7 @@
 val SC_ARG_MAX = _const "Posix_ProcEnv_SC_ARG_MAX" : C_Int.t;
 val SC_ASYNCHRONOUS_IO = _const "Posix_ProcEnv_SC_ASYNCHRONOUS_IO" : C_Int.t;
 val SC_ATEXIT_MAX = _const "Posix_ProcEnv_SC_ATEXIT_MAX" : C_Int.t;
+val SC_AVPHYS_PAGES = _const "Posix_ProcEnv_SC_AVPHYS_PAGES" : C_Int.t;
 val SC_BARRIERS = _const "Posix_ProcEnv_SC_BARRIERS" : C_Int.t;
 val SC_BC_BASE_MAX = _const "Posix_ProcEnv_SC_BC_BASE_MAX" : C_Int.t;
 val SC_BC_DIM_MAX = _const "Posix_ProcEnv_SC_BC_DIM_MAX" : C_Int.t;
@@ -570,9 +571,12 @@
 val SC_MQ_OPEN_MAX = _const "Posix_ProcEnv_SC_MQ_OPEN_MAX" : C_Int.t;
 val SC_MQ_PRIO_MAX = _const "Posix_ProcEnv_SC_MQ_PRIO_MAX" : C_Int.t;
 val SC_NGROUPS_MAX = _const "Posix_ProcEnv_SC_NGROUPS_MAX" : C_Int.t;
+val SC_NPROCESSORS_CONF = _const "Posix_ProcEnv_SC_NPROCESSORS_CONF" : C_Int.t;
+val SC_NPROCESSORS_ONLN = _const "Posix_ProcEnv_SC_NPROCESSORS_ONLN" : C_Int.t;
 val SC_OPEN_MAX = _const "Posix_ProcEnv_SC_OPEN_MAX" : C_Int.t;
 val SC_PAGE_SIZE = _const "Posix_ProcEnv_SC_PAGE_SIZE" : C_Int.t;
 val SC_PAGESIZE = _const "Posix_ProcEnv_SC_PAGESIZE" : C_Int.t;
+val SC_PHYS_PAGES = _const "Posix_ProcEnv_SC_PHYS_PAGES" : C_Int.t;
 val SC_PRIORITIZED_IO = _const "Posix_ProcEnv_SC_PRIORITIZED_IO" : C_Int.t;
 val SC_PRIORITY_SCHEDULING = _const "Posix_ProcEnv_SC_PRIORITY_SCHEDULING" : C_Int.t;
 val SC_RAW_SOCKETS = _const "Posix_ProcEnv_SC_RAW_SOCKETS" : C_Int.t;




More information about the MLton-commit mailing list