aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-08-21 11:55:38 -0400
committerIan Moffett <ian@osmora.org>2024-08-21 11:55:38 -0400
commit8f2a455cf3866857349e377cd2cf2bb898e0a494 (patch)
tree7c82932d44d2256767b0138c12d4b77470d0af82 /sys/kern
parent546c223267b6a385030ab2c4d5211bca1420709d (diff)
kernel: Add ref count to filedesc
Keep track of how many threads are currently using the file descriptor. This will be useful when fork() is implemented. Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_syscalls.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 371c1a5..937ae87 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -90,6 +90,7 @@ fd_alloc(struct filedesc **fd_out)
return -ENOMEM;
}
+ fd->refcnt = 1;
fd->fdno = i;
td->fds[i] = fd;