PatchworkOS  d0b3021
A non-POSIX operating system.
Loading...
Searching...
No Matches

Pipes. More...

Collaboration diagram for Pipes:

Detailed Description

Pipes.

Pipes are exposed in the /dev/pipe directory. Pipes are unidirectional communication channels that can be used for inter-process communication (IPC).

Creating Pipes

Pipes are created using the /dev/pipe/new file. Opening this file using open() will return one file descriptor that can be used for both reading and writing. To create a pipe with separate file descriptors for reading and writing, use open2() with the /dev/pipe/new file.

Using Pipes

Pipes can be read from and written to using the expected read() and write() system calls. Pipes are blocking and pollable, following expected POSIX semantics.

Data Structures

struct  pipe_t
 

Functions

static uint64_t pipe_open (file_t *file)
 
static uint64_t pipe_open2 (file_t *files[2])
 
static void pipe_close (file_t *file)
 
static uint64_t pipe_read (file_t *file, void *buffer, size_t count, size_t *offset)
 
static uint64_t pipe_write (file_t *file, const void *buffer, size_t count, size_t *offset)
 
static wait_queue_tpipe_poll (file_t *file, poll_events_t *revents)
 
uint64_t pipe_init (void)
 
void pipe_deinit (void)
 

Variables

static dentry_tpipeDir = NULL
 
static dentry_tnewFile = NULL
 
static file_ops_t fileOps
 

Function Documentation

◆ pipe_open()

static uint64_t pipe_open ( file_t file)
static

Definition at line 55 of file pipe.c.

Here is the call graph for this function:

◆ pipe_open2()

static uint64_t pipe_open2 ( file_t files[2])
static

Definition at line 80 of file pipe.c.

Here is the call graph for this function:

◆ pipe_close()

static void pipe_close ( file_t file)
static

Definition at line 107 of file pipe.c.

Here is the call graph for this function:

◆ pipe_read()

static uint64_t pipe_read ( file_t file,
void buffer,
size_t  count,
size_t offset 
)
static

Definition at line 133 of file pipe.c.

Here is the call graph for this function:

◆ pipe_write()

static uint64_t pipe_write ( file_t file,
const void buffer,
size_t  count,
size_t offset 
)
static

Definition at line 177 of file pipe.c.

Here is the call graph for this function:

◆ pipe_poll()

static wait_queue_t * pipe_poll ( file_t file,
poll_events_t revents 
)
static

Definition at line 223 of file pipe.c.

Here is the call graph for this function:

◆ pipe_init()

uint64_t pipe_init ( void  )

Definition at line 253 of file pipe.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pipe_deinit()

void pipe_deinit ( void  )

Definition at line 273 of file pipe.c.

Here is the caller graph for this function:

Variable Documentation

◆ pipeDir

dentry_t* pipeDir = NULL
static

Definition at line 52 of file pipe.c.

◆ newFile

dentry_t* newFile = NULL
static

Definition at line 53 of file pipe.c.

◆ fileOps

file_ops_t fileOps
static
Initial value:
= {
.open = pipe_open,
.open2 = pipe_open2,
.close = pipe_close,
.read = pipe_read,
.write = pipe_write,
.poll = pipe_poll,
}
static uint64_t pipe_open(file_t *file)
Definition pipe.c:55
static void pipe_close(file_t *file)
Definition pipe.c:107
static uint64_t pipe_read(file_t *file, void *buffer, size_t count, size_t *offset)
Definition pipe.c:133
static uint64_t pipe_write(file_t *file, const void *buffer, size_t count, size_t *offset)
Definition pipe.c:177
static uint64_t pipe_open2(file_t *files[2])
Definition pipe.c:80
static wait_queue_t * pipe_poll(file_t *file, poll_events_t *revents)
Definition pipe.c:223

Definition at line 244 of file pipe.c.