aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-26 18:42:40 -0400
committerIan Moffett <ian@osmora.org>2024-03-26 18:42:40 -0400
commita38886b264aee28ab587e1297df23bc5442cbb0e (patch)
treedc4867cd88d3beb966fbc2f38801872e25ac0c5c /sys
parent54224fb3d937811de957d51596602c0f2afc5fbe (diff)
kernel: filedesc: Add more comments
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_filedesc.c3
1 files changed, 3 insertions, 0 deletions
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;
}