feat: proper cleanup for shared pages

This commit is contained in:
2024-12-04 12:27:39 +00:00
parent f2aba977b4
commit c0ff53beff
3 changed files with 85 additions and 18 deletions

View File

@@ -172,8 +172,9 @@ start_process (void *proc_start_data)
to store the command that executed the process. */
if (data->success)
{
data->success =
process_init_stack (data->cmd_saveptr, &if_.esp, data->file_name);
data->success = use_shared_file (exec_file)
&& process_init_stack (data->cmd_saveptr, &if_.esp,
data->file_name);
}
/* Signal that the process has finished attempting to load. */
@@ -366,6 +367,7 @@ process_exit (void)
/* Clean up all open files */
hash_destroy (&cur->open_files, fd_cleanup);
hash_destroy (&cur->pages, page_cleanup);
unuse_shared_file (cur->exec_file);
/* Close the executable file, implicitly allowing it to be written to. */
if (cur->exec_file != NULL)