diff --git a/threads/thread.h b/threads/thread.h index 2feb8cc242719e1d684aef2108d9c8ca501a922f..ba4adf7f15cdb827a750759d6754c64f20d09109 100644 --- a/threads/thread.h +++ b/threads/thread.h @@ -6,8 +6,7 @@ #include <stdint.h> /* States in a thread's life cycle. */ -enum thread_status - { +enum thread_status { THREAD_RUNNING, /* Running thread. */ THREAD_READY, /* Not running but ready to run. */ THREAD_BLOCKED, /* Waiting for an event to trigger. */ diff --git a/userprog/populate_stack.c b/userprog/populate_stack.c index 7e61578c7eba25f6fd9e18329bec85ea1399a426..19c995c54dffc4a9d2b7af1c8835a6a8323958fc 100644 --- a/userprog/populate_stack.c +++ b/userprog/populate_stack.c @@ -22,8 +22,8 @@ void populate_stack(void** stack_pointer, int argc, char** argv) { while (--i >= 0) { *stack_pointer = *stack_pointer - (strlen(argv[i]) + 1) * sizeof(char); - - arr[i] = (uint32_t *)*stack_pointer; // Assigns the current reference of the stack pointer to the array + // Assigns the current reference of the stack pointer to the array + arr[i] = (uint32_t *)*stack_pointer; memcpy(*stack_pointer, argv[i], strlen(argv[i]) + 1); } @@ -35,7 +35,7 @@ void populate_stack(void** stack_pointer, int argc, char** argv) { while (--i >= 0) { - move_stack_pointer(stack_pointer, -4); //32bit Moves the stack pointer back 4 + move_stack_pointer(stack_pointer, -4); //Moves the stack pointer back 4 (*(uint32_t **)(*stack_pointer)) = arr[i]; } diff --git a/userprog/syscall_close.c b/userprog/syscall_close.c index a3064b95f71b4fc8078ed710d89198f9bcb83252..d9614a3ef3c8b078b85cc73e2bcf31011c73cda0 100644 --- a/userprog/syscall_close.c +++ b/userprog/syscall_close.c @@ -1,6 +1,6 @@ /* - * Closes file descriptor fd. Exiting or terminating a process implicitly closes all its open file - * descriptors, as if by calling this function for each one. + * Closes file descriptor fd. Exiting or terminating a process implicitly closes + * all its open file descriptors, as if by calling this function for each one. * Authored by Alex Stratford */ @@ -11,7 +11,8 @@ #include "lib/kernel/list.h" // Dependency for list_remove int syscall_close(struct intr_frame *f) { - int file_descriptor = *((int*)f->esp + 1); // pop off first int argument from interrupt frame + // pop off first int argument from interrupt frame + int file_descriptor = *((int*)f->esp + 1); // Described in system_calls.h, stores file descriptors mapped to files struct file_map *f_map = get_file(file_descriptor); if (f_map == NULL) // Checking if file is empty or non-existent