aboutsummaryrefslogtreecommitdiff
path: root/kernel/proc
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2024-04-25 04:04:20 +0000
committersotech117 <michael_foiani@brown.edu>2024-04-25 04:04:20 +0000
commit88db52baebd10ab1c2643f214ab9d44edcdb0851 (patch)
treef365ba758acd1bf164429cfbc02790e0ebbf8a79 /kernel/proc
parenta3e64ef2bf31dda9a94db011a96651de918ea968 (diff)
fix refcount issue
Diffstat (limited to 'kernel/proc')
-rw-r--r--kernel/proc/proc.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/kernel/proc/proc.c b/kernel/proc/proc.c
index 1e38ca8..91be451 100644
--- a/kernel/proc/proc.c
+++ b/kernel/proc/proc.c
@@ -260,6 +260,20 @@ void proc_cleanup(long status)
// NOT_YET_IMPLEMENTED("PROCS: proc_cleanup");
dbg(DBG_PROC, "proc_cleanup called on proc with pid=%d with exit status=%d\n", curproc->p_pid, status);
+#ifdef __VFS__
+ for (int fd = 0; fd < NFILES; fd++)
+ {
+ if (curproc->p_files[fd])
+ {
+ fput(curproc->p_files + fd);
+ }
+ }
+ if (curproc->p_cwd)
+ {
+ vput(&curproc->p_cwd);
+ }
+#endif
+
if (curproc->p_pid == PID_INIT)
{
@@ -289,20 +303,6 @@ void proc_cleanup(long status)
// } else {
curproc->p_status = status;
// }
-
-#ifdef __VFS__
- for (int fd = 0; fd < NFILES; fd++)
- {
- if (curproc->p_files[fd])
- {
- fput(curproc->p_files + fd);
- }
- }
- if (curproc->p_cwd)
- {
- vput(&curproc->p_cwd);
- }
-#endif
}
/*