2 #include <l4/sys/kip.h>
3 #include <l4/util/kip.h>
14 class Lib_info : public Lib
17 Lib_info() : Lib(P_env) {}
19 static int kipstr(lua_State *l)
21 const char *s = l4_kip_version_string(l4re_kip());
26 static int archstr(lua_State *l)
29 const char *s = "x86";
30 #elif defined(ARCH_amd64)
31 const char *s = "amd64";
32 #elif defined(ARCH_arm)
33 const char *s = "arm";
34 #elif defined(ARCH_ppc32)
35 const char *s = "ppc32";
37 #error Add your arch-string!
43 static int platformstr(lua_State *l)
45 if (l4util_kip_kernel_is_ux(l4re_kip()))
46 lua_pushstring(l, "ux");
48 lua_pushstring(l, l4re_kip()->platform_info.name);
52 void init(lua_State *l)
54 luaL_register(l, package, empty_reg);
61 lua_pushcfunction(l, kipstr);
62 lua_setfield(l, -2, "str");
63 lua_setfield(l, -2, "Kip");
66 lua_pushcfunction(l, archstr);
67 lua_setfield(l, -2, "arch");
70 lua_pushcfunction(l, platformstr);
71 lua_setfield(l, -2, "platform");
73 lua_setfield(l, -2, "Info");
79 static Lib_info __info_lib;