Paraslash Audio Streaming | |
About News Download Documentation Development |
Inter-process communication and shared memory helpers. More...
#include "para.h"
#include "error.h"
#include "ipc.h"
#include <sys/types.h>
#include <sys/param.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
Functions | |
int | mutex_new (void) |
Define a new mutex. More... | |
int | mutex_destroy (int id) |
Destroy a mutex. More... | |
void | mutex_lock (int id) |
Lock the given mutex. More... | |
void | mutex_unlock (int id) |
Unlock a mutex. More... | |
int | shm_new (size_t size) |
Create a new shared memory area of given size. More... | |
int | shm_destroy (int id) |
Destroy the given shared memory area. More... | |
int | shm_attach (int id, enum shm_attach_mode mode, void **result) |
Attach a shared memory segment. More... | |
int | shm_size (int id, size_t *result) |
Get the size of a shared memory segment. More... | |
int | shm_detach (void *addr) |
Detach a shared memory segment. More... | |
size_t | shm_get_shmmax (void) |
Get the maximal size of a shared memory area. More... | |
Inter-process communication and shared memory helpers.
int mutex_new | ( | void | ) |
Define a new mutex.
References ERRNO_TO_PARA_ERROR.
int mutex_destroy | ( | int | id | ) |
Destroy a mutex.
id | The identifier of the mutex to be destroyed. |
References ERRNO_TO_PARA_ERROR.
void mutex_lock | ( | int | id | ) |
Lock the given mutex.
id | The identifier of the shared memory area to lock. |
This function either succeeds or aborts.
void mutex_unlock | ( | int | id | ) |
Unlock a mutex.
id | The identifier of the mutex. |
This function either succeeds or aborts.
int shm_new | ( | size_t | size | ) |
Create a new shared memory area of given size.
size | The size of the shared memory area to create. |
References ERRNO_TO_PARA_ERROR.
Referenced by pass_buffer_as_shm(), and send_callback_request().
int shm_destroy | ( | int | id | ) |
Destroy the given shared memory area.
id | The shared memory identifier. |
References ERRNO_TO_PARA_ERROR.
Referenced by pass_buffer_as_shm().
int shm_attach | ( | int | id, |
enum shm_attach_mode | mode, | ||
void ** | result | ||
) |
Attach a shared memory segment.
id | The identifier of the shared memory segment to attach. |
mode | Either ATTACH_RO (read only) or ATTACH_RW (read/write). |
result | Points to the attached area just attached on success. |
References ATTACH_RW, and ERRNO_TO_PARA_ERROR.
Referenced by load_afd(), pass_buffer_as_shm(), and send_callback_request().
int shm_size | ( | int | id, |
size_t * | result | ||
) |
Get the size of a shared memory segment.
id | The shared memory segment identifier. |
result | Size in bytes is returned here, zero on errors. |
References ERRNO_TO_PARA_ERROR.
Referenced by load_afd().
int shm_detach | ( | void * | addr | ) |
Detach a shared memory segment.
addr | The address of the attached segment. |
References ERRNO_TO_PARA_ERROR.
Referenced by pass_buffer_as_shm(), and send_callback_request().
size_t shm_get_shmmax | ( | void | ) |
Get the maximal size of a shared memory area.
The value is only computed once when the function is called for the first time. Subsequent calls return the number which was computed during the first call.
References PARA_INFO_LOG, and PARA_WARNING_LOG.