[MLton] additional sysconf variables

Christopher Cramer tsuyoshi at yumegakanau.org
Sun Jul 10 17:16:55 PDT 2011


Hi

Below is a patch that adds support for querying these variables with
Posix.ProcEnv.sysconf:

	AVPHYS_PAGES
	NPROCESSORS_CONF
	NPROCESSORS_ONLN
	PHYS_PAGES

Index: runtime/basis/Posix/ProcEnv/sysconf-consts.c
===================================================================
--- runtime/basis/Posix/ProcEnv/sysconf-consts.c	(revision 7550)
+++ runtime/basis/Posix/ProcEnv/sysconf-consts.c	(working copy)
@@ -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
Index: runtime/gen/basis-ffi.def
===================================================================
--- runtime/gen/basis-ffi.def	(revision 7550)
+++ runtime/gen/basis-ffi.def	(working copy)
@@ -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
Index: basis-library/posix/proc-env.sml
===================================================================
--- basis-library/posix/proc-env.sml	(revision 7550)
+++ basis-library/posix/proc-env.sml	(working copy)
@@ -121,6 +121,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 +152,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") ::?
Index: basis-library/primitive/basis-ffi.sml
===================================================================
--- basis-library/primitive/basis-ffi.sml	(revision 7550)
+++ basis-library/primitive/basis-ffi.sml	(working copy)
@@ -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 mailing list