#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/msg.h>
#include <sys/sem.h>
#include <exception>
#include <system_error>
#include <cerrno>
Go to the source code of this file.
|
#define | MEMKEY 0x45861534 |
|
#define | SEMKEY 0x45861534 |
|
#define | MSGKEY 0x45861534 |
|
#define | MSGLEN 126 |
|
#define | SHMSIZE 4096 |
|
|
intptr_t * | connect_shm () |
|
int | p (int sem, int counter) |
|
int | v (int sem, int counter) |
|
int | semsetall (int sem_group, int number_in_group, int value) |
|
◆ generic_t
typedef for generic pointers in shared memory segment
◆ octopOS_id_t
typedef to increase readability
◆ sem_id_t
typedef to make Lukas happy
◆ connect_shm()
intptr_t* connect_shm |
( |
| ) |
|
function for connecting shared memmory to address space.
- Returns
- A pointer to the top of the shared memory space
◆ p()
int p |
( |
int |
sem, |
|
|
int |
counter |
|
) |
| |
Decraments a semaphore.
- Parameters
-
sem | The semaphore to access |
counter | the counter to decrament |
- Returns
- value of system call. fail if < 0.
◆ semsetall()
int semsetall |
( |
int |
sem_group, |
|
|
int |
number_in_group, |
|
|
int |
value |
|
) |
| |
Initializes all counters in a semaphore.
- Parameters
-
sem_group | The semaphore to initializes. |
number_in_group | Number of counters in the group. |
value | The initial value to set. |
- Returns
- value of system call. fail if < 0.
◆ v()
int v |
( |
int |
sem, |
|
|
int |
counter |
|
) |
| |
Incraments a semaphore.
- Parameters
-
sem | The semaphore to access |
counter | the counter to incraments |
- Returns
- value of system call. fail if < 0.
◆ CREATE_PUB
const unsigned CREATE_PUB = 1 |
packet type is requesting creation of publisher
◆ CREATE_SUB
const unsigned CREATE_SUB = 3 |
packet type is requesting creation of subscriber
◆ NUMMODULES
const unsigned NUMMODULES = 20 |
The number of modules octopOS will start
◆ PUBLISH_CODE
const unsigned PUBLISH_CODE = 2 |
packet type is requesting notification of subscribers
◆ SUB_BIT
const unsigned SUB_BIT = 0x20000000 |
The subscriber bit that needs to be set in ids
◆ TEMP_BIT
const unsigned TEMP_BIT = 0x40000000 |
The bit in ids that specifies it is a temp id