Loading...
Searching...
No Matches
Chunks
Shared Memory Library
Collaboration diagram for Chunks:

## Topics

| Producer
| Consumer

## Functions

long | l4shmc_add_chunk (l4shmc_area_t *shmarea, char const *chunk_name, l4_umword_t chunk_capacity, l4shmc_chunk_t *chunk)
| Add a chunk in the shared memory area.
long | l4shmc_get_chunk (l4shmc_area_t *shmarea, char const *chunk_name, l4shmc_chunk_t *chunk)
| Get chunk out of shared memory area.
long | l4shmc_get_chunk_to (l4shmc_area_t *shmarea, char const *chunk_name, l4_umword_t timeout_ms, l4shmc_chunk_t *chunk)
| Get chunk out of shared memory area, with timeout.
long | l4shmc_iterate_chunk (l4shmc_area_t const *shmarea, char const **chunk_name, long offs)
| Iterate over names of all existing chunks.
void * | l4shmc_chunk_ptr (l4shmc_chunk_t const *chunk)
| Get data pointer to chunk.
long | l4shmc_chunk_capacity (l4shmc_chunk_t const *chunk)
| Get capacity of a chunk.
l4shmc_signal_t * | l4shmc_chunk_signal (l4shmc_chunk_t const *chunk)
| Get the registered signal of a chunk.

## Detailed Description

## Function Documentation

## l4shmc_add_chunk()

long l4shmc_add_chunk | ( | l4shmc_area_t * | shmarea,
|  | char const * | chunk_name,
|  | l4_umword_t | chunk_capacity,
|  | l4shmc_chunk_t * | chunk )

Add a chunk in the shared memory area.

Parameters

  | shmarea | The shared memory area to put the chunk in.
  | chunk_name | Name of the chunk.
  | chunk_capacity | Capacity for payload of the chunk in bytes.
  [out] | chunk | Chunk structure to fill in.

Return values

  0 | Success.
  <0 | Error.

Examples
  examples/libs/shmc/prodcons.c.

References L4_CV.

## l4shmc_chunk_capacity()

long l4shmc_chunk_capacity | ( | l4shmc_chunk_t const * | chunk | ) |

inline

Get capacity of a chunk.

Parameters

  chunk | Chunk.

Returns
  Capacity of the chunk in bytes.

References L4_CV, and L4_INLINE.

## l4shmc_chunk_ptr()

void * l4shmc_chunk_ptr | ( | l4shmc_chunk_t const * | chunk | ) |

inline

Get data pointer to chunk.

Parameters

  chunk | Chunk.

Returns
  Chunk pointer.

Examples
  examples/libs/shmc/prodcons.c.

References L4_CV, and L4_INLINE.

## l4shmc_chunk_signal()

l4shmc_signal_t * l4shmc_chunk_signal | ( | l4shmc_chunk_t const * | chunk | ) |

inline

Get the registered signal of a chunk.

Parameters

  chunk | Chunk.

Return values

  0 | No signal has been registered with this chunk.
  !=0 | Pointer to signal otherwise.

References L4_CV, and L4_INLINE.

## l4shmc_get_chunk()

long l4shmc_get_chunk | ( | l4shmc_area_t * | shmarea,
|  | char const * | chunk_name,
|  | l4shmc_chunk_t * | chunk )

inline

Get chunk out of shared memory area.

Parameters

  | shmarea | Shared memory area.
  | chunk_name | Name of the chunk.
  [out] | chunk | Chunk data structure to fill.

Return values

  0 | Success.
  <0 | Error.

Examples
  examples/libs/shmc/prodcons.c.

References L4_CV.

## l4shmc_get_chunk_to()

long l4shmc_get_chunk_to | ( | l4shmc_area_t * | shmarea,
|  | char const * | chunk_name,
|  | l4_umword_t | timeout_ms,
|  | l4shmc_chunk_t * | chunk )

Get chunk out of shared memory area, with timeout.

Parameters

  | shmarea | Shared memory area.
  | chunk_name | Name of the chunk.
  | timeout_ms | Timeout in milliseconds to wait for the chunk to appear in the shared memory area.
  [out] | chunk | Chunk data structure to fill.

Return values

  0 | Success.
  <0 | Error.

References L4_CV.

## l4shmc_iterate_chunk()

long l4shmc_iterate_chunk | ( | l4shmc_area_t const * | shmarea,
|  | char const ** | chunk_name,
|  | long | offs )

Iterate over names of all existing chunks.

Parameters

  shmarea | Shared memory area.
  chunk_name | Where the name of the current chunk will be stored
  offs | 0 to start iteration, return value of previous call to l4shmc_iterate_chunk() to get next chunk

Return values

  0 | No more chunks available.
  <0 | Error.
  >0 | Iterator value for the next call.

References L4_CV.