summaryrefslogtreecommitdiff
path: root/include/ouroboros/shm_du_map.h
Commit message (Collapse)AuthorAgeFilesLines
* lib: robust locking in shared memory and crash recoverydimitri staessens2016-07-021-23/+11
| | | | | | | | | | | | | | This PR enhances the shared memory providing recovery if a process crashes. It adds a SHM_DU_TIMEOUT_MICROS variable, setting an expiration time for SDU's when shared memory is full. If an application doesn't read a blocking SDU within this time, the shared memory will be cleansed of all SDU's for this application and the application's rbuff will be cleared. Some refactoring of the API's. Fixed wrong pthread checks in IRMd. Fixes #13 Fixes #14
* lib, irmd, ipcp: robust mutexesdimitri staessens2016-06-211-5/+7
| | | | | | | | Update to POSIX 200112L to allow use of robust mutexes in the shm_du_map. Removed the implementation of the rw_lock in favor of pthread_rwlock_t. Placeholder for the shm_du_map_sanitize function.
* irmd, lib: use shm_du_map as lockfile.dimitri staessens2016-06-171-0/+2
| | | | | | | | | | | | Added the pid of the irmd to the shm_du_map. The IRMd will check for an existing shm_du_map. If there is an existing file, it will exit if the owner IRMd is running or remove it if the owner IRMd is not running. Also simplifies calculation of the shm_du_map pointers and corrects exiting calls for the IRMd. Fixes #8.
* tools: updated cbr with flood and sleep optionsdimitri staessens2016-05-271-1/+1
| | | | | | | The cbr client will now use busy waiting by default to control the sending rate. A --sleep option has been added to allow low CPU usage when sending at low data rates. A --flood option has been added that writes SDU's as fast as possible.
* lib: Add missing modulo calculationSander Vrijders2016-05-161-10/+10
| | | | | | Adds a missing modulo calculation that would result in index -1 being returned instead of zero when the ringbuffer skipped back to the beginning.
* irmd: flow allocation and fast pathdimitri staessens2016-05-071-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit has a first implementation of flow allocation (the "slow path") and read/write (the "fast path") for ouroboros. It provides basic but unstable communications over the shared memory. It required a lot of changes all over the stack, and fixes a number of previously undetected issues. This PR still need heavy revision regarding data model, locking and cleanup. lib/dev: modifications to the API. It now uses an ap_init() call to set the AP name and sets the Instance ID to the pid of the process. It also binds the AP to the shared memory and creates tables for mappings in the fast path. A call to ap_fini() releases the resources. lib/shm_ap_rbuff: added ring buffer for data exchange between processes in the fast path. It passes an index in the shm_du_map. lib/shm_du_map: rewrote API to work with calls from dev.c. Garbage collector added. Tests updated to new API. ipcpd/ipcp-data: removed everything related to flows, as these are universal for all ap's and kept in ap_data (dev.c), or similar structs for shim ipcps. shim-udp: added flow allocator and read/write functions and shm elements. irmd: revised data model and structures necessary for flow allocation. tools: echo updated to new dev.h API. messaging system was updated to comply with new flow allocation messages. All exchanges use pid and port_id to bootstrap the fast path.
* lib, irmd: Update communication with IRMdSander Vrijders2016-03-301-4/+0
| | | | | All messages sent to the IRMd now also get a reply back with the result of the operation.
* lib/ipcpd: fixed logging mistakedimitri staessens2016-03-251-3/+0
| | | | logs should be included in source, not in header
* lib: Shared Memorydimitri staessens2016-03-241-7/+4
| | | | | | | | Updated tests. Added code to drop a corner case (packet where the tail PCI would cross the edge of the ring buffer) because solving this very rare case is not worth the performance hit on the ringbuffer the extra code would incur. This means the ringbuffer might drop a very small percentage of packets.
* lib: optimization of ringbufferDimitri Staessens2016-03-201-1/+1
| | | | | | | | Got rid of divisions and modulo operations. Change in the meaning of a #define. SHM_DU_MAP_SIZE: is now an exponent of 2. Default is 10, allowing for 1024 blocks in the map.
* lib: updated shm_du_map to be a hybrid ring bufferDimitri Staessens2016-03-191-3/+2
| | | | | | Elements must be created/destroyed in order, but IPCPs can access PCI while the PDU is in the ring buffer. Test updated, no more waits are needed.
* lib: shared memory mapDimitri Staessens2016-03-191-0/+75
The shared memory map will allow passing SDU's between IPCPs efficiently. It is a single block of managed memory. SDU's are stored in a shm_du_buff datastructure, which is a list of blocks inside the shared memory region. The mechanism for passing SDU's is not yet implemented and could be either within the region or using another local IPC mechanism. The following things are configured at compile time: SHM_FILE_NAME : the name. Default is "ouroboros_du_map". SHM_DU_BUFF_BLOCK_SIZE: size of a block inside the shared memory region. Default is the pagesize of the system. SHM_DU_MAP_SIZE : the approximate size in bytes of the shared memory map. The actual filesize may differ by a small margin. Default is 4MB.