MOS Source Code
Loading...
Searching...
No Matches
libipc.c File Reference
#include "libipc/ipc.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
+ Include dependency graph for libipc.c:

Go to the source code of this file.

Macros

#define do_read(fd, buffer, size)
 
#define do_write(fd, buffer, size)
 
#define do_warn(fmt, ...)
 

Functions

 MOS_STATIC_ASSERT (sizeof(size_t)==sizeof(uint64_t), "size_t must be 64 bits")
 
ipc_msg_tipc_msg_create (size_t size)
 Create a new IPC message.
 
void ipc_msg_destroy (ipc_msg_t *buffer)
 Destroy an IPC message.
 
ipc_msg_tipc_read_msg (ipcfd_t fd)
 Read an IPC message.
 
bool ipc_write_msg (ipcfd_t fd, ipc_msg_t *buffer)
 Write an IPC message.
 
bool ipc_write_as_msg (ipcfd_t fd, const char *data, size_t size)
 
size_t ipc_read_as_msg (ipcfd_t fd, char *buffer, size_t buffer_size)
 

Macro Definition Documentation

◆ do_read

#define do_read ( fd,
buffer,
size )
Value:
read(fd, buffer, size)
size_t size
Definition slab.c:30
static char buffer[2048]
Definition test_printf.c:7

Definition at line 19 of file libipc.c.

Referenced by ipc_read_as_msg(), and ipc_read_msg().

◆ do_write

#define do_write ( fd,
buffer,
size )
Value:
write(fd, buffer, size)

Definition at line 20 of file libipc.c.

Referenced by ipc_write_as_msg(), and ipc_write_msg().

◆ do_warn

#define do_warn ( fmt,
... )
Value:
fprintf(stderr, fmt __VA_OPT__(, ) __VA_ARGS__)
u32 const char * fmt
Definition assert.h:36
#define stderr
Definition mos_stdio.h:32

Definition at line 21 of file libipc.c.

Referenced by ipc_read_as_msg(), ipc_read_msg(), ipc_write_as_msg(), and ipc_write_msg().

Function Documentation

◆ MOS_STATIC_ASSERT()

MOS_STATIC_ASSERT ( sizeof(size_t) = =sizeof(uint64_t),
"size_t must be 64 bits"  )

◆ ipc_msg_create()

ipc_msg_t * ipc_msg_create ( size_t size)

Create a new IPC message.

Parameters
sizeThe size of the message.
Returns
ipc_msg_t* The message.

Definition at line 26 of file libipc.c.

Referenced by ipc_read_msg().

◆ ipc_msg_destroy()

void ipc_msg_destroy ( ipc_msg_t * buffer)

Destroy an IPC message.

Parameters
bufferThe message.

Definition at line 33 of file libipc.c.

Referenced by ipc_read_msg(), rpc_call_exec(), and rpc_handle_client().

◆ ipc_read_msg()

ipc_msg_t * ipc_read_msg ( ipcfd_t fd)

Read an IPC message.

Parameters
fdThe file descriptor.
Returns
ipc_msg_t* The message.

Definition at line 38 of file libipc.c.

Referenced by rpc_call_exec(), and rpc_handle_client().

+ Here is the call graph for this function:

◆ ipc_write_msg()

bool ipc_write_msg ( ipcfd_t fd,
ipc_msg_t * buffer )

Write an IPC message.

Parameters
fdThe file descriptor.
bufferThe message.
Returns
true The message was written.
false The message was not written.

Definition at line 67 of file libipc.c.

◆ ipc_write_as_msg()

bool ipc_write_as_msg ( ipcfd_t fd,
const char * data,
size_t size )

Definition at line 86 of file libipc.c.

Referenced by rpc_call_exec(), and rpc_handle_client().

◆ ipc_read_as_msg()

size_t ipc_read_as_msg ( ipcfd_t fd,
char * buffer,
size_t buffer_size )

Definition at line 105 of file libipc.c.