From 8f2a455cf3866857349e377cd2cf2bb898e0a494 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 21 Aug 2024 11:55:38 -0400 Subject: 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 --- sys/kern/vfs_syscalls.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sys/kern') 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; -- cgit v1.2.3