[sys] Pass on values for failed executions

This commit is contained in:
Kevin Lange 2011-12-06 20:36:25 -06:00
parent dca46fffc4
commit 04a5f4a833
2 changed files with 5 additions and 5 deletions

View File

@ -38,7 +38,7 @@ exec(
fs_node_t * file = kopen(path,0);
if (!file) {
/* Command not found */
kexit(127);
return 0;
}
/* Read in the binary contents */
Elf32_Header * header = (Elf32_Header *)malloc(file->length + 100);
@ -54,7 +54,7 @@ exec(
kprintf("Fatal: Not a valid ELF executable.\n");
free(header);
close_fs(file);
kexit(127);
return -1;
}
/* Load the loadable segments from the binary */
@ -128,7 +128,7 @@ system(
int child = fork();
if (child == 0) {
exec(path,argc,argv);
kexit(0x5ADFACE);
kexit(-1);
return -1;
} else {
/* We are system(), so we need to wait for the child

View File

@ -222,8 +222,6 @@ enter_user_jmp(uintptr_t location, int argc, char ** argv, uintptr_t stack) {
void task_exit(int retval) {
IRQ_OFF;
current_task->retval = retval;
current_task->finished = 1;
/* Free the image memory */
for (uintptr_t i = 0; i < current_task->image_size; i += 0x1000) {
#if 0
@ -244,6 +242,8 @@ void task_exit(int retval) {
} else {
prev->next = current_task->next;
}
current_task->retval = retval;
current_task->finished = 1;
//free((void *)(current_task->stack - KERNEL_STACK_SIZE));
//free((void *)current_task->page_directory);
//free((void *)current_task->descriptors);