AquilaOS documentation
How it works, and its code
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
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}
int vfs_file_trunc(struct file *file, off_t len)
Changes the length of an open file.
Definition fops.c:213
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
An open file (POSIX's "open file description", fs/file.c).
Definition vfs.h:157
int flags
Definition vfs.h:164