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