Voxia OS
v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
fd.c
Go to the documentation of this file.
1
#include "
fd.h
"
2
#include "
memory/kalloc.h
"
3
4
struct
fdtable
*
alloc_fdtable
() {
5
struct
fdtable
*
table
=
kalloc
(
sizeof
(
struct
fdtable
));
6
table
->max_fds =
INITIAL_MAX_FDS
;
7
table
->fds = (
struct
file_descriptor
**)
kalloc
(
8
sizeof
(
struct
file_descriptor
*) *
table
->max_fds);
9
table
->next_fd = 0;
10
return
table
;
11
}
12
13
struct
file_descriptor
*
alloc_fd
() {
14
struct
file_descriptor
* fd =
kalloc
(
sizeof
(
struct
file_descriptor
));
15
return
fd;
16
}
17
18
19
void
free_fdtable
(
struct
fdtable
*
table
) {
20
kfree2
(
table
->fds);
21
kfree2
(
table
);
22
}
table
madt_record_table_entry_t table[]
Definition
acpi.h:3
alloc_fd
struct file_descriptor * alloc_fd()
Definition
fd.c:13
alloc_fdtable
struct fdtable * alloc_fdtable()
Definition
fd.c:4
free_fdtable
void free_fdtable(struct fdtable *table)
Definition
fd.c:19
fd.h
INITIAL_MAX_FDS
#define INITIAL_MAX_FDS
Definition
fd.h:7
kalloc.h
kalloc
void * kalloc(size_t size)
kfree2
void kfree2(void *ptr)
fdtable
Definition
fd.h:20
file_descriptor
Definition
fd.h:10
kernel
sys
fd.c
Generated on Sat May 30 2026 11:09:57 for Voxia OS by
1.13.2