Type syscallType = Type.GetType("Mono.Unix.Native.Syscall, Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
Type utsnameType = Type.GetType("Mono.Unix.Native.Utsname, Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
if (syscallType != null && utsnameType != null)
{
Object[] arg = new Object[] { Activator.CreateInstance(utsnameType) };
MethodInfo uname = syscallType.GetMethod("uname", new Type[] { utsnameType.MakeByRefType() });
FieldInfo fi = utsnameType.GetField(field);
if (uname != null && fi != null)
{
uname.Invoke(null, arg);
return (String)fi.GetValue(arg[0]);
}
}
return null;
}