axle OS
x86_32 UNIX-like hobby OS
fd.h
1 #ifndef FILE_DESC_H
2 #define FILE_DESC_H
3 
4 #include <stdint.h>
5 #include <stdbool.h>
6 #include "fd_entry.h"
7 #include <kernel/util/multitasking/tasks/task.h>
8 
9 /* query whether file descriptor entry 'entry' refers to
10  * and unused file descriptor
11  */
12 bool fd_empty(fd_entry entry);
13 
14 /* replace file descriptor entry at index 'index in
15  * 'task's file descriptor table with an empty entry
16  */
17 void fd_remove(task_t* task, int index);
18 
19 /* add the file descriptor entry 'entry' to
20  * 'task's file descriptor table at the first
21  * empty location
22  */
23 int fd_add(task_t* task, fd_entry entry);
24 
25 
26 /* add the file descriptor entry 'entry' to
27  * 'task's file descriptor table at index 'index'
28  * if an entry already exists at 'index', this silently
29  * calls 'fd_remove' on it
30  */
31 int fd_add_index(task_t* task, fd_entry entry, int index);
32 
33 #endif
34 
Definition: task.h:30
Definition: fd_entry.h:10