Implement syscall for file opening and refactor open_files initialisation in thread.c w/ S.

This commit is contained in:
EDiasAlberto
2024-11-08 15:33:47 +00:00
parent 5bd94894e0
commit 92e93b8060
3 changed files with 27 additions and 6 deletions

View File

@@ -238,6 +238,7 @@ thread_create (const char *name, int priority,
struct thread *parent_thread = thread_current ();
init_thread (t, name, parent_thread->nice, priority, parent_thread->recent_cpu);
tid = t->tid = allocate_tid ();
hash_init (&t->open_files, fd_hash, fd_less, NULL);
/* Prepare thread for first run by initializing its stack.
Do this atomically so intermediate values for the 'stack'
@@ -662,7 +663,6 @@ init_thread (struct thread *t, const char *name, int nice, int priority,
t->priority = t->base_priority;
t->exit_status = -1;
hash_init (&t->open_files, fd_hash, fd_less, NULL);
old_level = intr_disable ();
list_push_back (&all_list, &t->allelem);