Mount /proc and /sys when being init

This commit is contained in:
Łukasz Magiera 2016-02-12 11:12:27 +01:00
parent 8820138c3c
commit 21624f310c
3 changed files with 13 additions and 0 deletions

View File

@ -22,6 +22,7 @@ void logm(const char *message);
lua_State* getL();
void run_init();
void lupi_init();
void luanative_start(lua_State *L);
void setup_modules(lua_State *L);
void termutils_start(lua_State *L);

11
src/c/init.c Normal file
View File

@ -0,0 +1,11 @@
#include "lupi.h"
#include <sys/mount.h>
#include <sys/types.h>
#include <unistd.h>
void lupi_init() {
if(getpid() == 1) {
mount(NULL, "/sys", "sysfs", 0, NULL);
mount(NULL, "/proc", "procfs", 0, NULL);
}
}

View File

@ -21,6 +21,7 @@ lua_State* getL() {
}
void run_init() {
lupi_init();
L = luaL_newstate();
luaL_openlibs (L);