From a38886b264aee28ab587e1297df23bc5442cbb0e Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 26 Mar 2024 18:42:40 -0400 Subject: kernel: filedesc: Add more comments Signed-off-by: Ian Moffett --- sys/kern/kern_filedesc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/kern_filedesc.c b/sys/kern/kern_filedesc.c index c610747..f340671 100644 --- a/sys/kern/kern_filedesc.c +++ b/sys/kern/kern_filedesc.c @@ -56,6 +56,7 @@ make_write_buf(struct proc *td, const void *data, char **buf_out, size_t count) { char *buf = NULL; + /* Count cannot be 0 or exceed the max size */ if (count > MAX_RW_SIZE || count == 0) { return -EINVAL; } @@ -130,8 +131,10 @@ fd_alloc(struct proc *td, struct filedesc **fd_out) __assert(td != NULL); } + /* Find free fd table entry */ for (size_t i = 0; i < PROC_MAX_FDS; ++i) { if (td->fds[i] != NULL) { + /* In use */ continue; } -- cgit v1.2.3