AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
pipe.h File Reference
#include <core/system.h>
#include <fs/vfs.h>
#include <ds/ringbuf.h>

Go to the source code of this file.

Data Structures

struct  pipe
 A pipe, or a FIFO's pipe. More...

Macros

#define PIPE_BUFLEN   1024

Functions

int pipefs_pipe (struct file *read, struct file *write)
 Makes an anonymous pipe, for pipe(): one open file for each end.
int pipefs_fifo_open (struct file *file)
 Opens a FIFO: the open file's vnode becomes an end of the FIFO's pipe, made by its first open.

Variables

struct fs pipefs

Macro Definition Documentation

◆ PIPE_BUFLEN

#define PIPE_BUFLEN   1024

Definition at line 14 of file pipe.h.

Referenced by pipefs_mkpipe().

Function Documentation

◆ pipefs_fifo_open()

int pipefs_fifo_open ( struct file * file)

Opens a FIFO: the open file's vnode becomes an end of the FIFO's pipe, made by its first open.

Opening for reading waits for a writer, and opening for writing for a reader, unless the file is non-blocking (then a writer without readers fails with ENXIO) or opened read-write (which is both).

Parameters
filethe open file, whose vnode is the FIFO; it's left as it was on failure
Returns
0, -ENXIO, -ENOMEM, or -ERESTARTSYS if a signal came while it waited

Definition at line 239 of file pipe.c.

References END_RDWR, END_READ, END_WRITE, pipe::fifo, vnode::fifo, file::flags, has_readers(), has_writers(), NULL, pipefs_end(), pipefs_fifo_open(), pipefs_mkpipe(), pipefs_pfree(), pipe::queue, pipe::r_opens, vnode::ref, vfs_close(), pipe::w_opens, waitq_sleep(), and waitq_wakeup().

Referenced by pipefs_fifo_open(), and vfs_file_open().

◆ pipefs_pipe()

int pipefs_pipe ( struct file * read,
struct file * write )

Makes an anonymous pipe, for pipe(): one open file for each end.

Parameters
readthe open file for the reading end, its vnode set here
writethe open file for the writing end, its vnode and flags set here
Returns
0, -EINVAL, or -ENOMEM

Definition at line 199 of file pipe.c.

References END_READ, END_WRITE, file::flags, kfree(), NULL, pipefs_end(), pipefs_mkpipe(), pipefs_pfree(), and pipefs_pipe().

Referenced by pipefs_pipe(), and sys_pipe().

Variable Documentation

◆ pipefs

struct fs pipefs
extern

Definition at line 308 of file pipe.c.

Referenced by pipefs_end().