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

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

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

Go to the source code of this file.

Functions

ssize_t posix_file_write (struct file *file, struct iobuf *io)
 Writes to an open file at its offset, and moves the offset past what was written.

Detailed Description

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

Definition in file write.c.

Function Documentation

◆ posix_file_write()

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

Writes to an open file at its offset, and moves the offset past what was written.

With O_APPEND, a regular file is written at its end. A blocking write waits for room (in a pipe, say) until everything is written; a non-blocking one writes only if it can without waiting.

Parameters
filethe open file
iothe data, and how much of it
Returns
the number of bytes written, -EAGAIN if a non-blocking write would wait, or a negative errno if nothing was written

Definition at line 25 of file write.c.

References iobuf::fault, file::flags, file::offset, posix_file_write(), iobuf::resid, vfs_file_can_write(), vfs_file_eof(), vfs_write_io(), waitq_sleep(), and waitq_wakeup().

Referenced by posix_file_write().