Compare commits
2 Commits
44bd93b8b4
...
de167c3c67
Author | SHA1 | Date | |
---|---|---|---|
de167c3c67 | |||
cd9ecc1746 |
@ -5,7 +5,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int status;
|
||||
static int status = 0;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -16,7 +16,9 @@ typedef struct
|
||||
|
||||
void show_prompt()
|
||||
{
|
||||
printf("[%ld]> ", getpid());
|
||||
if (status) { printf("%d [%ld]> ", WEXITSTATUS(status), getpid()); }
|
||||
else
|
||||
printf("[%ld]> ", getpid());
|
||||
}
|
||||
|
||||
int command_matches(command* cmd, const char* string)
|
||||
@ -117,8 +119,6 @@ void command_execute(command* cmd)
|
||||
}
|
||||
int exit_status = WEXITSTATUS(status);
|
||||
if (exit_status == -2 || exit_status == -3) printf("(PID %ld) Segmentation fault\n", result);
|
||||
else if (exit_status)
|
||||
printf("Exited with code %d\n", WEXITSTATUS(status));
|
||||
command_clear(cmd);
|
||||
show_prompt();
|
||||
}
|
||||
|
@ -490,7 +490,13 @@ void sys_waitpid(Context* context, long pid, int* wstatus,
|
||||
*kwstatus = (int)(child->exit_status & 0xff);
|
||||
release_user_ref(kwstatus);
|
||||
}
|
||||
else { kinfoln("wstatus ptr is invalid: %p", (void*)wstatus); }
|
||||
else
|
||||
{
|
||||
kinfoln("wstatus ptr is invalid: %p", (void*)wstatus);
|
||||
child->state = child->Exited;
|
||||
context->rax = -EFAULT;
|
||||
return;
|
||||
}
|
||||
}
|
||||
child->state = child->Exited;
|
||||
context->rax = (long)child->id;
|
||||
|
Loading…
Reference in New Issue
Block a user