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

The generic read operation for files that are vnodes: regular files, and devices, pipes and FIFOs, which may have to wait for data. More...

#include <core/system.h>
#include <fs/vfs.h>
#include <fs/iobuf.h>
#include <core/arch.h>
#include <dev/dev.h>
#include <sys/sched.h>
#include <aquila/fcntl.h>
#include <aquila/errno.h>
#include <aquila/dirent.h>

Go to the source code of this file.

Functions

ssize_t posix_file_read (struct file *file, struct iobuf *io)
 Reads from an open file at its offset, and moves the offset past what was read.

Detailed Description

The generic read operation for files that are vnodes: regular files, and devices, pipes and FIFOs, which may have to wait for data.

Definition in file read.c.

Function Documentation

◆ posix_file_read()

ssize_t posix_file_read ( struct file * file,
struct iobuf * io )

Reads from an open file at its offset, and moves the offset past what was read.

If there is nothing to read yet, it waits for data (a pipe's, a terminal's), unless the file is non-blocking.

Parameters
filethe open file
iowhere the data goes, and how much is wanted
Returns
the number of bytes read, 0 at the end of the file, -EAGAIN if a non-blocking read would wait, -ERESTARTSYS if a signal came while it waited, or another negative errno

Definition at line 29 of file read.c.

References arch_rtime_ns(), file::flags, ISDEV, kdev_fops(), NULL, file::offset, posix_file_read(), fops::read_timeout, iobuf::resid, sched_wait(), vfs_file_eof(), vfs_read_io(), VNODE_DEV, and waitq_wakeup().

Referenced by posix_file_read().