AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
lseek.c File Reference

The generic lseek operation for files that are vnodes, as POSIX (IEEE Std 1003.1) describes it. More...

#include <core/system.h>
#include <fs/vfs.h>
#include <fs/posix.h>
#include <aquila/errno.h>

Go to the source code of this file.

Functions

off_t posix_file_lseek (struct file *file, off_t offset, int whence)
 Moves an open file's offset: to offset (SEEK_SET), by offset from where it is (SEEK_CUR), or by offset from the end of the file (SEEK_END).

Detailed Description

The generic lseek operation for files that are vnodes, as POSIX (IEEE Std 1003.1) describes it.

Definition in file lseek.c.

Function Documentation

◆ posix_file_lseek()

off_t posix_file_lseek ( struct file * file,
off_t offset,
int whence )

Moves an open file's offset: to offset (SEEK_SET), by offset from where it is (SEEK_CUR), or by offset from the end of the file (SEEK_END).

The offset may go past the end of the file.

Parameters
filethe open file
offsetthe offset, or the distance to move it
whenceSEEK_SET, SEEK_CUR or SEEK_END
Returns
the new offset, or -EINVAL if whence is wrong or the new offset would be negative

Definition at line 22 of file lseek.c.

References file::offset, posix_file_lseek(), and vnode::size.

Referenced by posix_file_lseek().