MOS Source Code
Loading...
Searching...
No Matches
pipe.c File Reference
#include <limits.h>
#include "mos/ipc/pipe.h"
#include "mos/mm/slab_autoinit.h"
#include "mos/platform/platform.h"
#include "mos/syslog/printk.h"
#include "mos/tasks/schedule.h"
#include "mos/tasks/signal.h"
#include "mos/tasks/wait.h"
#include <mos/lib/sync/spinlock.h>
#include <mos_stdlib.h>
+ Include dependency graph for pipe.c:

Go to the source code of this file.

Macros

#define pr_fmt(fmt)
 
#define PIPE_MAGIC   MOS_FOURCC('P', 'I', 'P', 'E')
 
#define advance_buffer(buffer, bytes)
 

Functions

 SLAB_AUTOINIT ("pipe", pipe_slab, pipe_t)
 
 SLAB_AUTOINIT ("pipeio", pipeio_slab, pipeio_t)
 
size_t pipe_write (pipe_t *pipe, const void *buf, size_t size)
 
size_t pipe_read (pipe_t *pipe, void *buf, size_t size)
 
bool pipe_close_one_end (pipe_t *pipe)
 Close one end of the pipe, so that the other end will get EOF.
 
pipe_tpipe_create (size_t bufsize)
 
static size_t pipeio_io_read (io_t *io, void *buf, size_t size)
 
static size_t pipeio_io_write (io_t *io, const void *buf, size_t size)
 
static void pipeio_io_close (io_t *io)
 
pipeio_tpipeio_create (pipe_t *pipe)
 

Variables

static slab_tpipe_slab = NULL
 
static slab_tpipeio_slab = NULL
 
static const io_op_t pipe_io_ops
 

Macro Definition Documentation

◆ pr_fmt

#define pr_fmt ( fmt)
Value:
"pipe: " fmt
u32 const char * fmt
Definition assert.h:36

Definition at line 6 of file pipe.c.

◆ PIPE_MAGIC

#define PIPE_MAGIC   MOS_FOURCC('P', 'I', 'P', 'E')

Definition at line 19 of file pipe.c.

Referenced by pipe_close_one_end(), pipe_create(), pipe_read(), and pipe_write().

◆ advance_buffer

#define advance_buffer ( buffer,
bytes )
Value:
((buffer) = (void *) ((char *) (buffer) + (bytes)))
static char buffer[2048]
Definition test_printf.c:7

Definition at line 27 of file pipe.c.

Referenced by pipe_read(), and pipe_write().

Function Documentation

◆ SLAB_AUTOINIT() [1/2]

SLAB_AUTOINIT ( "pipe" ,
pipe_slab ,
pipe_t  )

◆ SLAB_AUTOINIT() [2/2]

SLAB_AUTOINIT ( "pipeio" ,
pipeio_slab ,
pipeio_t  )

◆ pipe_write()

size_t pipe_write ( pipe_t * pipe,
const void * buf,
size_t size )

Definition at line 29 of file pipe.c.

Referenced by ipc_client_write(), ipc_server_write(), and pipeio_io_write().

+ Here is the call graph for this function:

◆ pipe_read()

size_t pipe_read ( pipe_t * pipe,
void * buf,
size_t size )

Definition at line 89 of file pipe.c.

Referenced by ipc_client_read(), ipc_server_read(), and pipeio_io_read().

+ Here is the call graph for this function:

◆ pipe_close_one_end()

bool pipe_close_one_end ( pipe_t * pipe)

Close one end of the pipe, so that the other end will get EOF.

Note
The other end should also call this function to get the pipe correctly freed.
Parameters
pipeThe pipe to close one end of.
Returns
true if the pipe was fully closed, false if the other end is still open.

Definition at line 143 of file pipe.c.

Referenced by ipc_client_close_channel(), ipc_server_close_channel(), and pipeio_io_close().

+ Here is the call graph for this function:

◆ pipe_create()

pipe_t * pipe_create ( size_t bufsize)

Definition at line 174 of file pipe.c.

Referenced by ipc_server_accept(), and MOS_STATIC_ASSERT().

+ Here is the call graph for this function:

◆ pipeio_io_read()

static size_t pipeio_io_read ( io_t * io,
void * buf,
size_t size )
static

Definition at line 186 of file pipe.c.

+ Here is the call graph for this function:

◆ pipeio_io_write()

static size_t pipeio_io_write ( io_t * io,
const void * buf,
size_t size )
static

Definition at line 193 of file pipe.c.

+ Here is the call graph for this function:

◆ pipeio_io_close()

static void pipeio_io_close ( io_t * io)
static

Definition at line 200 of file pipe.c.

+ Here is the call graph for this function:

◆ pipeio_create()

pipeio_t * pipeio_create ( pipe_t * pipe)

Definition at line 228 of file pipe.c.

Referenced by MOS_STATIC_ASSERT().

+ Here is the call graph for this function:

Variable Documentation

◆ pipe_slab

slab_t* pipe_slab = NULL
static

Definition at line 21 of file pipe.c.

Referenced by pipe_create().

◆ pipeio_slab

slab_t* pipeio_slab = NULL
static

Definition at line 24 of file pipe.c.

Referenced by pipeio_create().

◆ pipe_io_ops

const io_op_t pipe_io_ops
static
Initial value:
= {
.write = pipeio_io_write,
.read = pipeio_io_read,
.close = pipeio_io_close,
}
static void pipeio_io_close(io_t *io)
Definition pipe.c:200
static size_t pipeio_io_write(io_t *io, const void *buf, size_t size)
Definition pipe.c:193
static size_t pipeio_io_read(io_t *io, void *buf, size_t size)
Definition pipe.c:186

Definition at line 222 of file pipe.c.

Referenced by pipeio_create().