AquilaOS documentation
How it works, and its code
Toggle main menu visibility
Loading...
Searching...
No Matches
open.c
Go to the documentation of this file.
1
4
5
#include <
fs/posix.h
>
6
#include <aquila/fcntl.h>
7
#include <
fs/stat.h
>
8
#include <
sys/sched.h
>
9
17
int
posix_file_open
(
struct
file
*
file
)
18
{
19
/* O_TRUNC is for regular files; devices and FIFOs ignore it */
20
if
((
file
->
flags
& O_TRUNC) && S_ISREG(
file
->vnode->mode)) {
21
return
vfs_file_trunc
(
file
, 0);
22
}
23
24
return
0;
25
}
vfs_file_trunc
int vfs_file_trunc(struct file *file, off_t len)
Changes the length of an open file.
Definition
fops.c:213
posix_file_open
int posix_file_open(struct file *file)
Finishes opening a file: with O_TRUNC, a regular file is truncated to 0 bytes.
Definition
open.c:17
posix.h
sched.h
stat.h
file
An open file (POSIX's "open file description", fs/file.c).
Definition
vfs.h:157
file::flags
int flags
Definition
vfs.h:164
kernel
fs
posix
open.c
Generated by
1.18.0