Remove superfluous process_exit () in start_process

This commit is contained in:
Themis Demetriades
2024-11-13 17:58:34 +00:00
parent be68d81cf6
commit 446c50ea29

View File

@@ -155,7 +155,6 @@ start_process (void *proc_start_data)
/* If stack initialization failed, free process resources and quit. */ /* If stack initialization failed, free process resources and quit. */
if (!success) if (!success)
{ {
process_exit ();
thread_exit (); thread_exit ();
} }
@@ -297,7 +296,10 @@ process_wait (tid_t child_tid UNUSED)
break; break;
} }
if (child_result == NULL) if (child_result == NULL)
return -1; {
printf ("-1 due to: child_result == NULL\n");
return -1;
}
/* Wait for child to die. */ /* Wait for child to die. */
sema_down (&child_result->sema); sema_down (&child_result->sema);
/* We need lock release in process_exit, so we need to acquire (and possibly /* We need lock release in process_exit, so we need to acquire (and possibly
@@ -311,6 +313,12 @@ process_wait (tid_t child_tid UNUSED)
int exit_status = child_result->exit_status; int exit_status = child_result->exit_status;
lock_release (&child_result->lock); lock_release (&child_result->lock);
free (child_result); free (child_result);
if (exit_status == -1)
{
printf ("-1 due to: child exit status wrong!\n");
}
return exit_status; return exit_status;
} }
@@ -318,6 +326,9 @@ process_wait (tid_t child_tid UNUSED)
void void
process_exit (void) process_exit (void)
{ {
printf("(%s) EXIT STATUS: %d\n", thread_name (), thread_current ()->exit_status);
struct thread *cur = thread_current (); struct thread *cur = thread_current ();
uint32_t *pd; uint32_t *pd;