init Move to term_XXX() interface
This commit is contained in:
@ -1,11 +1,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <ulib.h>
|
#include <ulib.h>
|
||||||
|
|
||||||
uint64_t PID;
|
|
||||||
Dev_t termdev;
|
|
||||||
|
|
||||||
void tb_runinitscript(void) {
|
void tb_runinitscript(void) {
|
||||||
dev_gethandle(&termdev, "termdev");
|
|
||||||
|
|
||||||
char *tbargs[] = { "-m", "runfile", "-f", "base:/scripts/init.tb" };
|
char *tbargs[] = { "-m", "runfile", "-f", "base:/scripts/init.tb" };
|
||||||
int32_t tb = proc_spawn("base:/bin/tb", tbargs, ARRLEN(tbargs));
|
int32_t tb = proc_spawn("base:/bin/tb", tbargs, ARRLEN(tbargs));
|
||||||
@ -15,11 +11,11 @@ void tb_runinitscript(void) {
|
|||||||
while(proc_pollstate(tb) != 4) {
|
while(proc_pollstate(tb) != 4) {
|
||||||
int32_t r;
|
int32_t r;
|
||||||
|
|
||||||
char buf[100];
|
char buf[1024];
|
||||||
string_memset(buf, 0, sizeof(buf));
|
string_memset(buf, 0, sizeof(buf));
|
||||||
r = ipc_piperead(tb, 0, (uint8_t *const)buf, sizeof(buf)-1);
|
r = ipc_piperead(tb, 0, (uint8_t *const)buf, sizeof(buf)-1);
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
dev_cmd(&termdev, DEV_TERMDEV_PUTCH, buf, string_len(buf));
|
term_write(buf, string_len(buf));
|
||||||
} else {
|
} else {
|
||||||
schedrelease();
|
schedrelease();
|
||||||
}
|
}
|
||||||
@ -27,8 +23,6 @@ void tb_runinitscript(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
PID = proc_getpid();
|
|
||||||
|
|
||||||
tb_runinitscript();
|
tb_runinitscript();
|
||||||
|
|
||||||
uprintf("Shell exited! Please reboot the system.\n");
|
uprintf("Shell exited! Please reboot the system.\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user