|
RocketLogger
2.0.1
|
#include <sys/types.h>
Include dependency graph for sem.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Macros | |
| #define | SEM_KEY 2222 |
| Semaphore key (used for set creation) More... | |
| #define | SEM_OPT_NO_FLAG 0 |
| Time out time in seconds, waiting on semaphore write. More... | |
| #define | SEM_TIMEOUT_READ 3 |
| Time out time in seconds, waiting on semaphore read. More... | |
| #define | SEM_TIMEOUT_WRITE 1 |
| Time out time in seconds, waiting on semaphore write. More... | |
| #define | SEM_SEM_COUNT 2 |
| Total number of semaphores in set. More... | |
| #define | SEM_INDEX_DATA 0 |
| Index of the data semaphore (protects shared memory accesses) More... | |
| #define | SEM_INDEX_WAIT 1 |
| Index of the wait semaphore (blocks until new data is available) More... | |
Functions | |
| int | sem_create (key_t key, int count) |
| int | sem_remove (int id) |
| int | sem_open (key_t key, int count) |
| int | sem_wait (int id, int index, int timeout) |
| int | sem_set (int id, int index, int value) |
| int | sem_get (int id, int index) |
| #define SEM_INDEX_DATA 0 |
| #define SEM_INDEX_WAIT 1 |
| #define SEM_KEY 2222 |
Semaphore key (used for set creation)
Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| #define SEM_OPT_NO_FLAG 0 |
| #define SEM_TIMEOUT_READ 3 |
| #define SEM_TIMEOUT_WRITE 1 |
| int sem_create | ( | key_t | key, |
| int | count | ||
| ) |
Create RocketLogger semaphore set.
| key | The key identifying the semaphore set to create |
| count | The number of semaphores in the set to create |
Definition at line 49 of file sem.c.
References rl_log(), and RL_LOG_ERROR.
Here is the call graph for this function:| int sem_get | ( | int | id, |
| int | index | ||
| ) |
Get value of a semaphore.
| id | ID of semaphore set |
| index | Index of semaphore in set |
Definition at line 129 of file sem.c.
References rl_log(), and RL_LOG_ERROR.
Here is the call graph for this function:| int sem_open | ( | key_t | key, |
| int | count | ||
| ) |
Open existing RocketLogger semaphore set.
| key | The key identifying the semaphore set |
| count | The number of semaphores in the set |
Definition at line 68 of file sem.c.
References rl_log(), and RL_LOG_ERROR.
Here is the call graph for this function:| int sem_remove | ( | int | id | ) |
Remove semaphore set.
| id | ID of set to remove |
Definition at line 58 of file sem.c.
References rl_log(), RL_LOG_ERROR, and SUCCESS.
Here is the call graph for this function:| int sem_set | ( | int | id, |
| int | index, | ||
| int | value | ||
| ) |
Set value to semaphore.
| id | ID of semaphore set |
| index | Index of semaphore in set |
| value | Value to be set to semaphore |
Definition at line 108 of file sem.c.
References rl_log(), RL_LOG_ERROR, SEM_OPT_NO_FLAG, SEM_TIMEOUT_WRITE, and SUCCESS.
Here is the call graph for this function:| int sem_wait | ( | int | id, |
| int | index, | ||
| int | timeout | ||
| ) |
Wait on a semaphore until access granted.
| id | ID of semaphore set |
| index | Index of semaphore in set |
| timeout | Maximum waiting time before failing in seconds |
Definition at line 78 of file sem.c.
References rl_log(), RL_LOG_ERROR, SEM_OPT_NO_FLAG, and SUCCESS.
Here is the call graph for this function: