L4Re - L4 Runtime Environment
shmc.h
Go to the documentation of this file.
1 
5 /*
6  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
7  * Björn Döbel <doebel@os.inf.tu-dresden.de>
8  * economic rights: Technische Universität Dresden (Germany)
9  * This file is part of TUD:OS and distributed under the terms of the
10  * GNU Lesser General Public License 2.1.
11  * Please see the COPYING-LGPL-2.1 file for details.
12  */
13 #pragma once
14 
15 #include <l4/sys/linkage.h>
16 #include <l4/sys/types.h>
17 #include <l4/sys/err.h>
18 
69 #define __INCLUDED_FROM_L4SHMC_H__
70 #include <l4/shmc/types.h>
71 
72 __BEGIN_DECLS
73 
84 L4_CV long
85 l4shmc_create(const char *shmc_name, l4_umword_t shm_size);
86 
98 L4_CV L4_INLINE long
99 l4shmc_attach(const char *shmc_name, l4shmc_area_t *shmarea);
100 
113 L4_CV long
114 l4shmc_attach_to(const char *shmc_name, l4_umword_t timeout_ms,
115  l4shmc_area_t *shmarea);
116 
129 L4_CV long
130 l4shmc_add_chunk(l4shmc_area_t *shmarea,
131  const char *chunk_name,
132  l4_umword_t chunk_capacity,
133  l4shmc_chunk_t *chunk);
134 
146 L4_CV long
147 l4shmc_add_signal(l4shmc_area_t *shmarea,
148  const char *signal_name,
149  l4shmc_signal_t *signal);
150 
160 L4_CV L4_INLINE long
161 l4shmc_trigger(l4shmc_signal_t *signal);
162 
172 L4_CV L4_INLINE long
173 l4shmc_chunk_try_to_take(l4shmc_chunk_t *chunk);
174 
185 L4_CV L4_INLINE long
186 l4shmc_chunk_ready(l4shmc_chunk_t *chunk, l4_umword_t size);
187 
198 L4_CV L4_INLINE long
199 l4shmc_chunk_ready_sig(l4shmc_chunk_t *chunk, l4_umword_t size);
200 
212 L4_CV L4_INLINE long
213 l4shmc_get_chunk(l4shmc_area_t *shmarea,
214  const char *chunk_name,
215  l4shmc_chunk_t *chunk);
216 
230 L4_CV long
231 l4shmc_get_chunk_to(l4shmc_area_t *shmarea,
232  const char *chunk_name,
233  l4_umword_t timeout_ms,
234  l4shmc_chunk_t *chunk);
235 
249 L4_CV long
250 l4shmc_iterate_chunk(l4shmc_area_t *shmarea, const char **chunk_name,
251  long offs);
252 
265 L4_CV L4_INLINE long
266 l4shmc_attach_signal(l4shmc_area_t *shmarea,
267  const char *signal_name,
268  l4_cap_idx_t thread,
269  l4shmc_signal_t *signal);
270 
285 L4_CV long
286 l4shmc_attach_signal_to(l4shmc_area_t *shmarea,
287  const char *signal_name,
288  l4_cap_idx_t thread,
289  l4_umword_t timeout_ms,
290  l4shmc_signal_t *signal);
291 
305 L4_CV long
306 l4shmc_get_signal_to(l4shmc_area_t *shmarea,
307  const char *signal_name,
308  l4_umword_t timeout_ms,
309  l4shmc_signal_t *signal);
310 
311 L4_CV L4_INLINE long
312 l4shmc_get_signal(l4shmc_area_t *shmarea,
313  const char *signal_name,
314  l4shmc_signal_t *signal);
315 
316 
330 L4_CV long
331 l4shmc_enable_signal(l4shmc_signal_t *signal);
332 
346 L4_CV long
347 l4shmc_enable_chunk(l4shmc_chunk_t *chunk);
348 
358 L4_CV L4_INLINE long
359 l4shmc_wait_any(l4shmc_signal_t **retsignal);
360 
374 L4_CV L4_INLINE long
375 l4shmc_wait_any_try(l4shmc_signal_t **retsignal);
376 
391 L4_CV long
392 l4shmc_wait_any_to(l4_timeout_t timeout, l4shmc_signal_t **retsignal);
393 
403 L4_CV L4_INLINE long
404 l4shmc_wait_signal(l4shmc_signal_t *signal);
405 
416 L4_CV long
417 l4shmc_wait_signal_to(l4shmc_signal_t *signal, l4_timeout_t timeout);
418 
432 L4_CV L4_INLINE long
433 l4shmc_wait_signal_try(l4shmc_signal_t *signal);
434 
444 L4_CV L4_INLINE long
445 l4shmc_wait_chunk(l4shmc_chunk_t *chunk);
446 
461 L4_CV long
462 l4shmc_wait_chunk_to(l4shmc_chunk_t *chunk, l4_timeout_t timeout);
463 
477 L4_CV L4_INLINE long
478 l4shmc_wait_chunk_try(l4shmc_chunk_t *chunk);
479 
489 L4_CV L4_INLINE long
490 l4shmc_chunk_consumed(l4shmc_chunk_t *chunk);
491 
501 L4_CV long
502 l4shmc_connect_chunk_signal(l4shmc_chunk_t *chunk,
503  l4shmc_signal_t *signal);
504 
514 L4_CV L4_INLINE long
515 l4shmc_is_chunk_ready(l4shmc_chunk_t *chunk);
516 
526 L4_CV L4_INLINE long
527 l4shmc_is_chunk_clear(l4shmc_chunk_t *chunk);
528 
538 L4_CV L4_INLINE void *
539 l4shmc_chunk_ptr(l4shmc_chunk_t *chunk);
540 
550 L4_CV L4_INLINE long
551 l4shmc_chunk_size(l4shmc_chunk_t *chunk);
552 
562 L4_CV L4_INLINE long
563 l4shmc_chunk_capacity(l4shmc_chunk_t *chunk);
564 
574 L4_CV L4_INLINE l4shmc_signal_t *
575 l4shmc_chunk_signal(l4shmc_chunk_t *chunk);
576 
585 L4_CV L4_INLINE l4_cap_idx_t
586 l4shmc_signal_cap(l4shmc_signal_t *signal);
587 
597 L4_CV L4_INLINE long
598 l4shmc_check_magic(l4shmc_chunk_t *chunk);
599 
609 L4_CV L4_INLINE long
610 l4shmc_area_size(l4shmc_area_t *shmarea);
611 
623 L4_CV long
624 l4shmc_area_size_free(l4shmc_area_t *shmarea);
625 
632 L4_CV long
634 
642 L4_CV long
644 
645 #include <l4/shmc/internal.h>
646 
long l4shmc_get_chunk(l4shmc_area_t *shmarea, const char *chunk_name, l4shmc_chunk_t *chunk)
Get chunk out of shared memory area.
void * l4shmc_chunk_ptr(l4shmc_chunk_t *chunk)
Get data pointer to chunk.
l4_cap_idx_t l4shmc_signal_cap(l4shmc_signal_t *signal)
Get the signal capability of a signal.
long l4shmc_wait_chunk_to(l4shmc_chunk_t *chunk, l4_timeout_t timeout)
Check whether a specific chunk has an event pending, with timeout.
long l4shmc_attach(const char *shmc_name, l4shmc_area_t *shmarea)
Attach to a shared memory area.
long l4shmc_is_chunk_clear(l4shmc_chunk_t *chunk)
Check whether chunk is free.
long l4shmc_area_overhead(void)
Get memory overhead per area that is not available for chunks.
l4shmc_signal_t * l4shmc_chunk_signal(l4shmc_chunk_t *chunk)
Get the signal of a chunk.
Common L4 ABI Data Types.
long l4shmc_wait_signal_to(l4shmc_signal_t *signal, l4_timeout_t timeout)
Wait on a specific signal, with timeout.
long l4shmc_chunk_ready(l4shmc_chunk_t *chunk, l4_umword_t size)
Mark chunk as filled (ready).
long l4shmc_iterate_chunk(l4shmc_area_t *shmarea, const char **chunk_name, long offs)
Iterate over names of all existing chunks.
long l4shmc_wait_any_to(l4_timeout_t timeout, l4shmc_signal_t **retsignal)
Wait for any signal with timeout.
long l4shmc_wait_chunk_try(l4shmc_chunk_t *chunk)
Check whether a specific chunk has an event pending.
long l4shmc_wait_chunk(l4shmc_chunk_t *chunk)
Wait on a specific chunk.
long l4shmc_check_magic(l4shmc_chunk_t *chunk)
Check magic value of a chunk.
long l4shmc_area_size(l4shmc_area_t *shmarea)
Get size of shared memory area.
unsigned long l4_cap_idx_t
L4 Capability selector Type.
Definition: types.h:341
#define __END_DECLS
End section with C types and functions.
Definition: compiler.h:193
long l4shmc_enable_signal(l4shmc_signal_t *signal)
Enable a signal.
long l4shmc_is_chunk_ready(l4shmc_chunk_t *chunk)
Check whether data is available.
long l4shmc_get_signal_to(l4shmc_area_t *shmarea, const char *signal_name, l4_umword_t timeout_ms, l4shmc_signal_t *signal)
Get signal object from the shared memory area.
long l4shmc_chunk_capacity(l4shmc_chunk_t *chunk)
Get capacity of a chunk.
long l4shmc_enable_chunk(l4shmc_chunk_t *chunk)
Enable a signal connected with a chunk.
long l4shmc_chunk_size(l4shmc_chunk_t *chunk)
Get current size of a chunk.
long l4shmc_chunk_consumed(l4shmc_chunk_t *chunk)
Mark a chunk as free.
long l4shmc_attach_signal_to(l4shmc_area_t *shmarea, const char *signal_name, l4_cap_idx_t thread, l4_umword_t timeout_ms, l4shmc_signal_t *signal)
Attach to signal, with timeout.
Timeout pair.
Definition: __timeout.h:57
long l4shmc_trigger(l4shmc_signal_t *signal)
Trigger a signal.
long l4shmc_wait_any(l4shmc_signal_t **retsignal)
Wait on any signal.
long l4shmc_wait_signal(l4shmc_signal_t *signal)
Wait on a specific signal.
long l4shmc_wait_any_try(l4shmc_signal_t **retsignal)
Check whether any waited signal has an event pending.
Error codes.
unsigned long l4_umword_t
Unsigned machine word.
Definition: l4int.h:52
long l4shmc_attach_signal(l4shmc_area_t *shmarea, const char *signal_name, l4_cap_idx_t thread, l4shmc_signal_t *signal)
Attach to signal.
long l4shmc_get_chunk_to(l4shmc_area_t *shmarea, const char *chunk_name, l4_umword_t timeout_ms, l4shmc_chunk_t *chunk)
Get chunk out of shared memory area, with timeout.
#define L4_CV
Define calling convention.
Definition: linkage.h:44
long l4shmc_area_size_free(l4shmc_area_t *shmarea)
Get free size of shared memory area.
long l4shmc_attach_to(const char *shmc_name, l4_umword_t timeout_ms, l4shmc_area_t *shmarea)
Attach to a shared memory area, with limited waiting.
long l4shmc_add_chunk(l4shmc_area_t *shmarea, const char *chunk_name, l4_umword_t chunk_capacity, l4shmc_chunk_t *chunk)
Add a chunk in the shared memory area.
long l4shmc_wait_signal_try(l4shmc_signal_t *signal)
Check whether a specific signal has an event pending.
long l4shmc_connect_chunk_signal(l4shmc_chunk_t *chunk, l4shmc_signal_t *signal)
Connect a signal with a chunk.
long l4shmc_add_signal(l4shmc_area_t *shmarea, const char *signal_name, l4shmc_signal_t *signal)
Add a signal for the shared memory area.
long l4shmc_create(const char *shmc_name, l4_umword_t shm_size)
Create a shared memory area.
long l4shmc_chunk_overhead(void)
Get memory overhead required in addition to the chunk capacity for adding one chunk.
long l4shmc_chunk_try_to_take(l4shmc_chunk_t *chunk)
Try to mark chunk busy.
long l4shmc_chunk_ready_sig(l4shmc_chunk_t *chunk, l4_umword_t size)
Mark chunk as filled (ready) and signal consumer.