diff options
author | Anton Kling <anton@kling.gg> | 2024-04-23 14:35:09 +0200 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-04-23 14:35:09 +0200 |
commit | 0305b0abe4ada656462d575a5e0f0618b42def2d (patch) | |
tree | ecffe02ac3670457ed2cf0fbb513efbb69867d01 /kernel/fs/fifo.c | |
parent | 33663539c2bac856cf2abe79e815ad179dffecdf (diff) |
VFS: Fix reference count of file descriptors.
It appears that there was a race condition where the process got closed
before the server accepted the incoming request. Causing the file
descriptor to have "0" in the reference count but it would still be
given when calling accept.
Diffstat (limited to 'kernel/fs/fifo.c')
-rw-r--r-- | kernel/fs/fifo.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/kernel/fs/fifo.c b/kernel/fs/fifo.c index a0a9248..5b01616 100644 --- a/kernel/fs/fifo.c +++ b/kernel/fs/fifo.c @@ -63,26 +63,6 @@ FIFO_FILE *create_fifo_object(void) { return n; } -int create_fifo(void) { - - vfs_fd_t *fd = kmalloc(sizeof(vfs_fd_t)); - int fd_n; - assert(list_add(¤t_task->file_descriptors, fd, &fd_n)); - - fd->flags = O_RDWR | O_NONBLOCK; - fd->inode = kmalloc(sizeof(vfs_inode_t)); - - fd->inode->internal_object = (void *)create_fifo_object(); - fd->inode->open = NULL; - fd->inode->read = fifo_read; - fd->inode->write = fifo_write; - fd->inode->close = fifo_close; - fd->inode->get_vm_object = NULL; - fd->inode->is_open = 1; - - return fd_n; -} - int fifo_write(u8 *buffer, u64 offset, u64 len, vfs_fd_t *fd) { (void)offset; FIFO_FILE *file = (FIFO_FILE *)fd->inode->internal_object; |