36 lines
840 B
C
36 lines
840 B
C
#include <stdint.h>
|
|
#include <string/string.h>
|
|
#include <system/system.h>
|
|
#include <sysdefs/ipcpipe.h>
|
|
#include <sysdefs/processctl.h>
|
|
#include <uprintf.h>
|
|
#include <ansiq/all.h>
|
|
#include <string/char.h>
|
|
#include <util/util.h>
|
|
#include <dlmalloc/malloc.h>
|
|
#include <errors.h>
|
|
|
|
uint64_t PID;
|
|
|
|
void tb_runinitscript(void) {
|
|
char *tbargs[] = { "-m", "runfile", "-f", "base:/scripts/init.tb", "-logcmds", "yes" };
|
|
int32_t tb = processctl(-1, PCTL_SPAWN, (uint64_t)"base:/bin/tb", (uint64_t)&tbargs, ARRLEN(tbargs));
|
|
|
|
ipcpipe(tb, IPCPIPE_IN, IPCPIPE_ADD_BCAST, NULL, 1);
|
|
|
|
processctl(tb, PCTL_RUN, 0, 0, 0);
|
|
|
|
while(processctl(tb, PCTL_POLLSTATE, 0, 0, 0) != 4);
|
|
}
|
|
|
|
void main(void) {
|
|
PID = (uint64_t)processctl(-1, PCTL_GETPID, 0, 0, 0);
|
|
|
|
tb_runinitscript();
|
|
|
|
uprintf("Shell exited! Please reboot the system.\n");
|
|
|
|
for(;;);
|
|
}
|
|
|