- We need to invalidate the selection area when we replace the
[mono-project.git] / mono / metadata / environment.c
blob0313affe16eb997b30512d1bbb203ea011733183
1 /*
2 * environment.c: System.Environment support internal calls
4 * Authors:
5 * Dick Porter (dick@ximian.com)
6 * Sebastien Pouliot (sebastien@ximian.com)
8 * (C) 2002 Ximian, Inc.
9 * (C) 2004 Novell (http://www.novell.com)
12 #include <config.h>
13 #include <glib.h>
15 #include <mono/metadata/appdomain.h>
16 #include <mono/metadata/environment.h>
17 #include <mono/metadata/exception.h>
18 #include <mono/io-layer/io-layer.h>
20 #ifndef PLATFORM_WIN32
21 #include <sys/utsname.h>
22 #endif
24 static gint32 exitcode=0;
26 gint32 mono_environment_exitcode_get (void)
28 return(exitcode);
31 void mono_environment_exitcode_set (gint32 value)
33 exitcode=value;
36 /* note: we better manipulate the string in managed code (easier and safer) */
37 MonoString*
38 ves_icall_System_Environment_GetOSVersionString (void)
40 #ifdef PLATFORM_WIN32
41 OSVERSIONINFO verinfo;
43 MONO_ARCH_SAVE_REGS;
45 verinfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
46 if (GetVersionEx (&verinfo)) {
47 char version [64];
48 /* maximum string length is 35 bytes
49 3 x 10 bytes per number, 1 byte for 0, 3 x 1 byte for dots, 1 for NULL */
50 sprintf (version, "%ld.%ld.%ld.0",
51 verinfo.dwMajorVersion,
52 verinfo.dwMinorVersion,
53 verinfo.dwBuildNumber);
54 return mono_string_new (mono_domain_get (), version);
56 #else
57 struct utsname name;
59 MONO_ARCH_SAVE_REGS;
61 if (uname (&name) == 0) {
62 return mono_string_new (mono_domain_get (), name.release);
64 #endif
65 return mono_string_new (mono_domain_get (), "0.0.0.0");
68 gint32 ves_icall_System_Environment_get_ProcessorCount(void)
70 SYSTEM_INFO sys_info;
71 GetSystemInfo(&sys_info);
72 return sys_info.dwNumberOfProcessors;