diff options
author | David Yuste <dyuste@gcc.gnu.org> | 2011-02-23 14:34:41 +0000 |
---|---|---|
committer | David Yuste <dyuste@gcc.gnu.org> | 2011-02-23 14:34:41 +0000 |
commit | fed8d1ce2b2f2725dbddfd81fe0d5ec4087d3fdb (patch) | |
tree | 960cb6407d5ea5bc48f454c5e80f8bce3ce6928a | |
parent | 8ffcec0ccc0815c121883ead1bdb03e01059098a (diff) |
Added libstd:sysconf. Also some small changes in MSCorelibWrapper.cs:gettimes
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/st/cli-be@170437 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libstd/include/Makefile.am | 1 | ||||
-rw-r--r-- | libstd/include/Makefile.in | 1 | ||||
-rw-r--r-- | libstd/include/__host.h | 3 | ||||
-rw-r--r-- | libstd/include/bits/confname.h | 254 | ||||
-rw-r--r-- | libstd/include/unistd.h | 2 | ||||
-rw-r--r-- | libstd/src/MSCorelibWrapper.cs | 43 | ||||
-rw-r--r-- | libstd/src/Makefile.am | 1 | ||||
-rw-r--r-- | libstd/src/Makefile.in | 28 | ||||
-rw-r--r-- | libstd/src/__host.c | 6 | ||||
-rw-r--r-- | libstd/src_opt/MSCorelibWrapper.cs | 3 |
10 files changed, 330 insertions, 12 deletions
diff --git a/libstd/include/Makefile.am b/libstd/include/Makefile.am index 91cc94f09dc..e7bfe2f050d 100644 --- a/libstd/include/Makefile.am +++ b/libstd/include/Makefile.am @@ -34,6 +34,7 @@ include_HEADERS = \ wctype.h includebits_HEADERS = \ + bits/confname.h \ bits/libstd_errno.h \ bits/libstd_fcntl.h \ bits/libstd_float.h \ diff --git a/libstd/include/Makefile.in b/libstd/include/Makefile.in index d18089e02be..21d36427266 100644 --- a/libstd/include/Makefile.in +++ b/libstd/include/Makefile.in @@ -215,6 +215,7 @@ include_HEADERS = \ wctype.h includebits_HEADERS = \ + bits/confname.h \ bits/libstd_errno.h \ bits/libstd_fcntl.h \ bits/libstd_float.h \ diff --git a/libstd/include/__host.h b/libstd/include/__host.h index e2ac1840359..45967ca0e26 100644 --- a/libstd/include/__host.h +++ b/libstd/include/__host.h @@ -90,6 +90,9 @@ LIBSTD_HPROTO(int, unlink, const char *path); /* Attempts to write bytes into stream. */ LIBSTD_HPROTO(int, write, int fildes, void *buf, int nbytes); +/* get configuration information at runtime */ +LIBSTD_HPROTO(long, getsysconf, int); + /* Getting clock */ LIBSTD_HPROTO(int, clock, void); diff --git a/libstd/include/bits/confname.h b/libstd/include/bits/confname.h new file mode 100644 index 00000000000..273e985bf1c --- /dev/null +++ b/libstd/include/bits/confname.h @@ -0,0 +1,254 @@ +/* + + Copyright (C) 2007-2008 Free Software Foundation, Inc. + Contributed by STMicroelectronics + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to the Free +Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ + +#ifndef __LIBSTD_CONFNAME_H__ +#define __LIBSTD_CONFNAME_H__ + +#ifndef __UNISTD_H && !defined __LIBSTD_CRT_BUILD +# error "Never use <bits/confname.h> directly; include <unistd.h> instead." +#endif + +/* Remember to update values in src/MSCorlibWrapper.cs */ + +__BEGIN_EXTERN_C + +enum { + _SC_ARG_MAX = 0, + _SC_CHILD_MAX = 1, + _SC_CLK_TCK = 2, + _SC_NGROUPS_MAX = 3, + _SC_OPEN_MAX = 4, + _SC_STREAM_MAX = 5, + _SC_TZNAME_MAX = 6, + _SC_JOB_CONTROL = 7, + _SC_SAVED_IDS = 8, + _SC_REALTIME_SIGNALS = 9, + _SC_PRIORITY_SCHEDULING = 10, + _SC_TIMERS = 11, + _SC_ASYNCHRONOUS_IO = 12, + _SC_PRIORITIZED_IO = 13, + _SC_SYNCHRONIZED_IO = 14, + _SC_FSYNC = 15, + _SC_MAPPED_FILES = 16, + _SC_MEMLOCK = 17, + _SC_MEMLOCK_RANGE = 18, + _SC_MEMORY_PROTECTION = 19, + _SC_MESSAGE_PASSING = 20, + _SC_SEMAPHORES = 21, + _SC_SHARED_MEMORY_OBJECTS = 22, + _SC_AIO_LISTIO_MAX = 23, + _SC_AIO_MAX = 24, + _SC_AIO_PRIO_DELTA_MAX = 25, + _SC_DELAYTIMER_MAX = 26, + _SC_MQ_OPEN_MAX = 27, + _SC_MQ_PRIO_MAX = 28, + _SC_VERSION = 29, + _SC_PAGESIZE = 30, + _SC_RTSIG_MAX = 31, + _SC_SEM_NSEMS_MAX = 32, + _SC_SEM_VALUE_MAX = 33, + _SC_SIGQUEUE_MAX = 34, + _SC_TIMER_MAX = 35, + _SC_BC_BASE_MAX = 36, + _SC_BC_DIM_MAX = 37, + _SC_BC_SCALE_MAX = 38, + _SC_BC_STRING_MAX = 39, + _SC_COLL_WEIGHTS_MAX = 40, + _SC_EQUIV_CLASS_MAX = 41, + _SC_EXPR_NEST_MAX = 42, + _SC_LINE_MAX = 43, + _SC_RE_DUP_MAX = 44, + _SC_CHARCLASS_NAME_MAX = 45, + _SC_2_VERSION = 46, + _SC_2_C_BIND = 47, + _SC_2_C_DEV = 48, + _SC_2_FORT_DEV = 49, + _SC_2_FORT_RUN = 50, + _SC_2_SW_DEV = 51, + _SC_2_LOCALEDEF = 52, + _SC_PII = 53, + _SC_PII_XTI = 54, + _SC_PII_SOCKET = 55, + _SC_PII_INTERNET = 56, + _SC_PII_OSI = 57, + _SC_POLL = 58, + _SC_SELECT = 59, + _SC_UIO_MAXIOV = 60, + _SC_IOV_MAX = 61, + _SC_PII_INTERNET_STREAM = 62, + _SC_PII_INTERNET_DGRAM = 63, + _SC_PII_OSI_COTS = 64, + _SC_PII_OSI_CLTS = 65, + _SC_PII_OSI_M = 66, + _SC_T_IOV_MAX = 67, + _SC_THREADS = 68, + _SC_THREAD_SAFE_FUNCTIONS = 69, + _SC_GETGR_R_SIZE_MAX = 70, + _SC_GETPW_R_SIZE_MAX = 71, + _SC_LOGIN_NAME_MAX = 72, + _SC_TTY_NAME_MAX = 73, + _SC_THREAD_DESTRUCTOR_ITERATIONS = 74, + _SC_THREAD_KEYS_MAX = 75, + _SC_THREAD_STACK_MIN = 76, + _SC_THREAD_THREADS_MAX = 77, + _SC_THREAD_ATTR_STACKADDR = 78, + _SC_THREAD_ATTR_STACKSIZE = 79, + _SC_THREAD_PRIORITY_SCHEDULING = 80, + _SC_THREAD_PRIO_INHERIT = 81, + _SC_THREAD_PRIO_PROTECT = 82, + _SC_THREAD_PROCESS_SHARED = 83, + _SC_NPROCESSORS_CONF = 84, + _SC_NPROCESSORS_ONLN = 85, + _SC_PHYS_PAGES = 86, + _SC_AVPHYS_PAGES = 87, + _SC_ATEXIT_MAX = 88, + _SC_PASS_MAX = 89, + _SC_XOPEN_VERSION = 90, + _SC_XOPEN_XCU_VERSION = 91, + _SC_XOPEN_UNIX = 92, + _SC_XOPEN_CRYPT = 93, + _SC_XOPEN_ENH_I18N = 94, + _SC_XOPEN_SHM = 95, + _SC_2_CHAR_TERM = 96, + _SC_2_C_VERSION = 97, + _SC_2_UPE = 98, + _SC_XOPEN_XPG2 = 99, + _SC_XOPEN_XPG3 = 100, + _SC_XOPEN_XPG4 = 101, + _SC_CHAR_BIT = 102, + _SC_CHAR_MAX = 103, + _SC_CHAR_MIN = 104, + _SC_INT_MAX = 105, + _SC_INT_MIN = 106, + _SC_LONG_BIT = 107, + _SC_WORD_BIT = 108, + _SC_MB_LEN_MAX = 109, + _SC_NZERO = 110, + _SC_SSIZE_MAX = 111, + _SC_SCHAR_MAX = 112, + _SC_SCHAR_MIN = 113, + _SC_SHRT_MAX = 114, + _SC_SHRT_MIN = 115, + _SC_UCHAR_MAX = 116, + _SC_UINT_MAX = 117, + _SC_ULONG_MAX = 118, + _SC_USHRT_MAX = 119, + _SC_NL_ARGMAX = 120, + _SC_NL_LANGMAX = 121, + _SC_NL_MSGMAX = 122, + _SC_NL_NMAX = 123, + _SC_NL_SETMAX = 124, + _SC_NL_TEXTMAX = 125, + _SC_XBS5_ILP32_OFF32 = 126, + _SC_XBS5_ILP32_OFFBIG = 127, + _SC_XBS5_LP64_OFF64 = 128, + _SC_XBS5_LPBIG_OFFBIG = 129, + _SC_XOPEN_LEGACY = 130, + _SC_XOPEN_REALTIME = 131, + _SC_XOPEN_REALTIME_THREADS = 132, + _SC_ADVISORY_INFO = 133, + _SC_BARRIERS = 134, + _SC_BASE = 135, + _SC_C_LANG_SUPPORT = 136, + _SC_C_LANG_SUPPORT_R = 137, + _SC_CLOCK_SELECTION = 138, + _SC_CPUTIME = 139, + _SC_THREAD_CPUTIME = 140, + _SC_DEVICE_IO = 141, + _SC_DEVICE_SPECIFIC = 142, + _SC_DEVICE_SPECIFIC_R = 143, + _SC_FD_MGMT = 144, + _SC_FIFO = 145, + _SC_PIPE = 146, + _SC_FILE_ATTRIBUTES = 147, + _SC_FILE_LOCKING = 148, + _SC_FILE_SYSTEM = 149, + _SC_MONOTONIC_CLOCK = 150, + _SC_MULTI_PROCESS = 151, + _SC_SINGLE_PROCESS = 152, + _SC_NETWORKING = 153, + _SC_READER_WRITER_LOCKS = 154, + _SC_SPIN_LOCKS = 155, + _SC_REGEXP = 156, + _SC_REGEX_VERSION = 157, + _SC_SHELL = 158, + _SC_SIGNALS = 159, + _SC_SPAWN = 160, + _SC_SPORADIC_SERVER = 161, + _SC_THREAD_SPORADIC_SERVER = 162, + _SC_SYSTEM_DATABASE = 163, + _SC_SYSTEM_DATABASE_R = 164, + _SC_TIMEOUTS = 165, + _SC_TYPED_MEMORY_OBJECTS = 166, + _SC_USER_GROUPS = 167, + _SC_USER_GROUPS_R = 168, + _SC_2_PBS = 169, + _SC_2_PBS_ACCOUNTING = 170, + _SC_2_PBS_LOCATE = 171, + _SC_2_PBS_MESSAGE = 172, + _SC_2_PBS_TRACK = 173, + _SC_SYMLOOP_MAX = 174, + _SC_STREAMS = 175, + _SC_2_PBS_CHECKPOINT = 176, + _SC_V6_ILP32_OFF32 = 177, + _SC_V6_ILP32_OFFBIG = 178, + _SC_V6_LP64_OFF64 = 179, + _SC_V6_LPBIG_OFFBIG = 180, + _SC_HOST_NAME_MAX = 181, + _SC_TRACE = 182, + _SC_TRACE_EVENT_FILTER = 183, + _SC_TRACE_INHERIT = 184, + _SC_TRACE_LOG = 185, + _SC_LEVEL1_ICACHE_SIZE = 186, + _SC_LEVEL1_ICACHE_ASSOC = 187, + _SC_LEVEL1_ICACHE_LINESIZE = 188, + _SC_LEVEL1_DCACHE_SIZE = 189, + _SC_LEVEL1_DCACHE_ASSOC = 190, + _SC_LEVEL1_DCACHE_LINESIZE = 191, + _SC_LEVEL2_CACHE_SIZE = 192, + _SC_LEVEL2_CACHE_ASSOC = 193, + _SC_LEVEL2_CACHE_LINESIZE = 194, + _SC_LEVEL3_CACHE_SIZE = 195, + _SC_LEVEL3_CACHE_ASSOC = 196, + _SC_LEVEL3_CACHE_LINESIZE = 197, + _SC_LEVEL4_CACHE_SIZE = 198, + _SC_LEVEL4_CACHE_ASSOC = 199, + _SC_LEVEL4_CACHE_LINESIZE = 200, + _SC_IPV6 = 236, + _SC_RAW_SOCKETS = 237, + _SC_V7_ILP32_OFF32 = 238, + _SC_V7_ILP32_OFFBIG = 239, + _SC_V7_LP64_OFF64 = 240, + _SC_V7_LPBIG_OFFBIG = 241, + _SC_SS_REPL_MAX = 242, + _SC_TRACE_EVENT_NAME_MAX = 243, + _SC_TRACE_NAME_MAX = 244, + _SC_TRACE_SYS_MAX = 245, + _SC_TRACE_USER_EVENT_MAX = 246, + _SC_XOPEN_STREAMS = 247, + _SC_THREAD_ROBUST_PRIO_INHERIT = 248, + _SC_THREAD_ROBUST_PRIO_PROTECT = 249 +}; + +__END_EXTERN_C + +#endif diff --git a/libstd/include/unistd.h b/libstd/include/unistd.h index 958f76d367c..64aa72916ba 100644 --- a/libstd/include/unistd.h +++ b/libstd/include/unistd.h @@ -32,6 +32,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include <sys/types.h> #include <bits/libstd_stdio.h> +#include <bits/confname.h> __BEGIN_EXTERN_C @@ -40,6 +41,7 @@ LIBSTD_LPROTO(ssize_t, read, int, void *, size_t); LIBSTD_LPROTO(ssize_t, write, int, const void *, size_t); LIBSTD_LPROTO(off_t, lseek, int, off_t, int); LIBSTD_LPROTO(int, unlink, const char *); +LIBSTD_LPROTO(long, sysconf, int); #define STDIN_FILENO __LIBSTD_STDIN_FILENO #define STDOUT_FILENO __LIBSTD_STDOUT_FILENO diff --git a/libstd/src/MSCorelibWrapper.cs b/libstd/src/MSCorelibWrapper.cs index 312d20578bf..331f1c19474 100644 --- a/libstd/src/MSCorelibWrapper.cs +++ b/libstd/src/MSCorelibWrapper.cs @@ -100,6 +100,13 @@ public class MSCorelibWrapper private const int __LIBSTD_S_IWRITE = 0x0080; private const int __LIBSTD_S_IEXEC = 0x0040; + /* sysconf variable names */ + /* in sync with bits/confname.h */ + private const int __LIBSTD_SC_CLK_TCK = 2; + + /* Value of sysconf (SC_CLK_TCK), consistent with + * usual values in POSIX. (used by gettimes) */ + private const int _SC_CLK_TCK_VALUE = 100; static MSCorelibWrapper() { @@ -668,30 +675,46 @@ public class MSCorelibWrapper Process tp = Process.GetCurrentProcess(); try { - /* Posix times seems to return timings ins centiseconds */ - *tms_utime = (uint)(tp.UserProcessorTime.TotalMilliseconds/10); - *tms_stime = (uint)(tp.PrivilegedProcessorTime.TotalMilliseconds/10); + /* This is valid as long as _SC_CLK_TCK_VALUE is 100 */ + *tms_utime = (uint)(tp.UserProcessorTime.TotalMilliseconds/(1000/_SC_CLK_TCK_VALUE)); + *tms_stime = (uint)(tp.PrivilegedProcessorTime.TotalMilliseconds/(1000/_SC_CLK_TCK_VALUE)); /* Currently there is no way to get childs timings. - * In .NET it is possible to check parent ID by means of - * PeroformanceCounter : "Creating Process Id", but it - * is not implemented in Mono */ + In .NET it is possible to check parent ID by means of + PeroformanceCounter : "Creating Process Id", but it + is not implemented in Mono */ *tms_cutime = 0; *tms_cstime = 0; - Console.Error.Write("Warning: gettimes() - tms_cutime and tms_cstime defaults to 0 ({0} {1})\n"); + Console.Error.Write("Warning: gettimes() - tms_cutime and tms_cstime defaults to 0\n"); } catch (PlatformNotSupportedException) { my_errno = __LIBSTD_ENOTSUP; return -1; } /* clks (as return value of times function) is an arbitrary - * time reference. only useful when making more than one call - * to times. Thus we can use the value returned by clock */ - *clks = (uint) clock(); + time reference. only useful when making more than one call + to times. */ + *clks = (uint)((DateTime.UtcNow.Ticks - initial_ticks)/(10000000/_SC_CLK_TCK_VALUE)); return 0; } + public static int getsysconf (int name) + { + switch (name) { + case __LIBSTD_SC_CLK_TCK: + /* this value is must be coherent with the clocks returned by 'gettimes' + In this implementation we use 100 ticks -> 1 s */ + return _SC_CLK_TCK_VALUE; + + default: + Console.Error.Write("Warning: getsysconf({0}) - Not implemented\n", name); + my_errno = __LIBSTD_ENOTSUP; + return -1; + } + } + + public static void exit(int status) { Environment.Exit(status); diff --git a/libstd/src/Makefile.am b/libstd/src/Makefile.am index 4e3d14d0ee5..5b69b567968 100644 --- a/libstd/src/Makefile.am +++ b/libstd/src/Makefile.am @@ -109,6 +109,7 @@ SRC = _Exit.c \ strtolul.c \ strtollull.c \ strxfrm.c \ + sysconf.c \ system.c \ systime.c \ time.c \ diff --git a/libstd/src/Makefile.in b/libstd/src/Makefile.in index 0b0e0233dd0..49dbf41b804 100644 --- a/libstd/src/Makefile.in +++ b/libstd/src/Makefile.in @@ -98,7 +98,7 @@ am__objects_1 = libstd_la-_Exit.lo libstd_la-__io_device.lo \ libstd_la-strncmp.lo libstd_la-strncpy.lo libstd_la-strpbrk.lo \ libstd_la-strrchr.lo libstd_la-strspn.lo libstd_la-strstr.lo \ libstd_la-strtod.lo libstd_la-strtok.lo libstd_la-strtolul.lo \ - libstd_la-strtollull.lo libstd_la-strxfrm.lo \ + libstd_la-strtollull.lo libstd_la-strxfrm.lo libstd_la-sysconf.lo \ libstd_la-system.lo libstd_la-systime.lo libstd_la-time.lo libstd_la-times.lo\ libstd_la-tmpfile.lo libstd_la-tmpnam.lo libstd_la-ungetc.lo \ libstd_la-unlink.lo libstd_la-vfprintf.lo libstd_la-vfscanf.lo \ @@ -170,7 +170,7 @@ am__objects_2 = libstd_dll-_Exit.$(OBJEXT) \ libstd_dll-strrchr.$(OBJEXT) libstd_dll-strspn.$(OBJEXT) \ libstd_dll-strstr.$(OBJEXT) libstd_dll-strtod.$(OBJEXT) \ libstd_dll-strtok.$(OBJEXT) libstd_dll-strtolul.$(OBJEXT) \ - libstd_dll-strtollull.$(OBJEXT) libstd_dll-strxfrm.$(OBJEXT) \ + libstd_dll-strtollull.$(OBJEXT) libstd_dll-strxfrm.$(OBJEXT) libstd_dll-sysconf.$(OBJEXT) \ libstd_dll-system.$(OBJEXT) libstd_dll-systime.$(OBJEXT) \ libstd_dll-time.$(OBJEXT) libstd_dll-times.$(OBJEXT) libstd_dll-tmpfile.$(OBJEXT) \ libstd_dll-tmpnam.$(OBJEXT) libstd_dll-ungetc.$(OBJEXT) \ @@ -426,6 +426,7 @@ SRC = _Exit.c \ strtolul.c \ strtollull.c \ strxfrm.c \ + sysconf.c \ system.c \ systime.c \ time.c \ @@ -647,6 +648,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_dll-strtollull.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_dll-strtolul.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_dll-strxfrm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_dll-sysconf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_dll-system.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_dll-systime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_dll-time.Po@am__quote@ @@ -775,6 +777,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_la-strtollull.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_la-strtolul.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_la-strxfrm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_la-sysconf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_la-system.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_la-systime.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstd_la-time.Plo@am__quote@ @@ -1585,6 +1588,13 @@ libstd_la-strxfrm.lo: strxfrm.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstd_la_CFLAGS) $(CFLAGS) -c -o libstd_la-strxfrm.lo `test -f 'strxfrm.c' || echo '$(srcdir)/'`strxfrm.c +libstd_la-sysconf.lo: sysconf.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstd_la_CFLAGS) $(CFLAGS) -MT libstd_la-sysconf.lo -MD -MP -MF "$(DEPDIR)/libstd_la-sysconf.Tpo" -c -o libstd_la-sysconf.lo `test -f 'sysconf.c' || echo '$(srcdir)/'`sysconf.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libstd_la-sysconf.Tpo" "$(DEPDIR)/libstd_la-sysconf.Plo"; else rm -f "$(DEPDIR)/libstd_la-sysconf.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sysconf.c' object='libstd_la-sysconf.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstd_la_CFLAGS) $(CFLAGS) -c -o libstd_la-sysconf.lo `test -f 'sysconf.c' || echo '$(srcdir)/'`sysconf.c + libstd_la-system.lo: system.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstd_la_CFLAGS) $(CFLAGS) -MT libstd_la-system.lo -MD -MP -MF "$(DEPDIR)/libstd_la-system.Tpo" -c -o libstd_la-system.lo `test -f 'system.c' || echo '$(srcdir)/'`system.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libstd_la-system.Tpo" "$(DEPDIR)/libstd_la-system.Plo"; else rm -f "$(DEPDIR)/libstd_la-system.Tpo"; exit 1; fi @@ -3251,6 +3261,20 @@ libstd_dll-strxfrm.obj: strxfrm.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstd_dll_CFLAGS) $(CFLAGS) -c -o libstd_dll-strxfrm.obj `if test -f 'strxfrm.c'; then $(CYGPATH_W) 'strxfrm.c'; else $(CYGPATH_W) '$(srcdir)/strxfrm.c'; fi` +libstd_dll-sysconf.o: sysconf.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstd_dll_CFLAGS) $(CFLAGS) -MT libstd_dll-sysconf.o -MD -MP -MF "$(DEPDIR)/libstd_dll-sysconf.Tpo" -c -o libstd_dll-sysconf.o `test -f 'sysconf.c' || echo '$(srcdir)/'`sysconf.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libstd_dll-sysconf.Tpo" "$(DEPDIR)/libstd_dll-sysconf.Po"; else rm -f "$(DEPDIR)/libstd_dll-sysconf.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sysconf.c' object='libstd_dll-sysconf.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstd_dll_CFLAGS) $(CFLAGS) -c -o libstd_dll-sysconf.o `test -f 'sysconf.c' || echo '$(srcdir)/'`sysconf.c + +libstd_dll-sysconf.obj: sysconf.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstd_dll_CFLAGS) $(CFLAGS) -MT libstd_dll-sysconf.obj -MD -MP -MF "$(DEPDIR)/libstd_dll-sysconf.Tpo" -c -o libstd_dll-sysconf.obj `if test -f 'sysconf.c'; then $(CYGPATH_W) 'sysconf.c'; else $(CYGPATH_W) '$(srcdir)/sysconf.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libstd_dll-sysconf.Tpo" "$(DEPDIR)/libstd_dll-sysconf.Po"; else rm -f "$(DEPDIR)/libstd_dll-sysconf.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sysconf.c' object='libstd_dll-sysconf.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstd_dll_CFLAGS) $(CFLAGS) -c -o libstd_dll-sysconf.obj `if test -f 'sysconf.c'; then $(CYGPATH_W) 'sysconf.c'; else $(CYGPATH_W) '$(srcdir)/sysconf.c'; fi` + libstd_dll-system.o: system.c @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libstd_dll_CFLAGS) $(CFLAGS) -MT libstd_dll-system.o -MD -MP -MF "$(DEPDIR)/libstd_dll-system.Tpo" -c -o libstd_dll-system.o `test -f 'system.c' || echo '$(srcdir)/'`system.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libstd_dll-system.Tpo" "$(DEPDIR)/libstd_dll-system.Po"; else rm -f "$(DEPDIR)/libstd_dll-system.Tpo"; exit 1; fi diff --git a/libstd/src/__host.c b/libstd/src/__host.c index fd20244cce3..d0428b0fbca 100644 --- a/libstd/src/__host.c +++ b/libstd/src/__host.c @@ -438,6 +438,12 @@ LIBSTD_HPROTO_IMPL(int, gettimes, unsigned long * clks, unsigned long * tms_utim return 0; } +/* get configuration information at runtime */ +LIBSTD_HPROTO_IMPL(long, getsysconf, int name) +{ + return sysconf(name); +} + LIBSTD_HPROTO_IMPL(int, fpclassify, double p0) { return fpclassify(p0); diff --git a/libstd/src_opt/MSCorelibWrapper.cs b/libstd/src_opt/MSCorelibWrapper.cs index 3d67d39080a..17119d956fd 100644 --- a/libstd/src_opt/MSCorelibWrapper.cs +++ b/libstd/src_opt/MSCorelibWrapper.cs @@ -79,6 +79,9 @@ public class MSCorelibWrapper [DllImport("MSCorelibWrapper_support.so", EntryPoint="__host__gettimes")] unsafe public static int gettimes (uint *clks,uint *tms_utime, uint *tms_stime, uint *tms_cutime, uint *tms_cstime) + [DllImport("MSCorelibWrapper_support.so", EntryPoint="__host__getsysconf")] + public static int getsysconf (int name); + [DllImport("MSCorelibWrapper_support.so", EntryPoint="__host__exit")] unsafe public static extern void exit(int status); |