Add std{in,out,err}_h
This commit is contained in:
parent
5e7a6efeb8
commit
1994245cea
15
harness.c
15
harness.c
|
@ -37,6 +37,10 @@ typedef unsigned char u_char;
|
|||
/* TODO: reuse stacks (via a freelist) */
|
||||
/* TODO: investigate avoiding syscall in swapcontext, setcontext etc. */
|
||||
|
||||
IOHandle *stdin_h = NULL;
|
||||
IOHandle *stdout_h = NULL;
|
||||
IOHandle *stderr_h = NULL;
|
||||
|
||||
static volatile int harness_running = 1;
|
||||
Process *current_process = NULL;
|
||||
|
||||
|
@ -250,7 +254,12 @@ static void clean_dead_processes(void) {
|
|||
}
|
||||
|
||||
void boot_harness(void) {
|
||||
stdin_h = new_iohandle(0);
|
||||
stdout_h = new_iohandle(1);
|
||||
stderr_h = new_iohandle(2);
|
||||
|
||||
ICHECK(getcontext(&scheduler), "boot_harness getcontext");
|
||||
|
||||
while (1) {
|
||||
while (runlist.count) {
|
||||
queue_t work = runlist;
|
||||
|
@ -268,6 +277,12 @@ void boot_harness(void) {
|
|||
//info("Blocking for events\n");
|
||||
event_loop(EVLOOP_ONCE);
|
||||
}
|
||||
|
||||
info("Shutting down.\n");
|
||||
|
||||
delete_iohandle(stdin_h);
|
||||
delete_iohandle(stdout_h);
|
||||
delete_iohandle(stderr_h);
|
||||
}
|
||||
|
||||
void interrupt_harness(void) {
|
||||
|
|
Loading…
Reference in New Issue