diff options
author | Sander Vrijders <[email protected]> | 2016-08-09 16:14:33 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-08-09 16:14:33 +0200 |
commit | f558d4404a9cb5b87ce3e239d8c0712bbaaba39a (patch) | |
tree | 8414f9e0d72910c4115bd9bce4e2cd4e0e52a465 /src/lib | |
parent | d7a3ac1eae57404630b39ad68b548910c88ed150 (diff) | |
parent | 9dce327e10bffddc9dc5058f06407e8ff12389b7 (diff) | |
download | ouroboros-f558d4404a9cb5b87ce3e239d8c0712bbaaba39a.tar.gz ouroboros-f558d4404a9cb5b87ce3e239d8c0712bbaaba39a.zip |
Merged in dstaesse/ouroboros/be-bugfixing (pull request #195)
lib: Various fixes
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/dev.c | 4 | ||||
-rw-r--r-- | src/lib/shm_ap_rbuff.c | 13 | ||||
-rw-r--r-- | src/lib/shm_du_map.c | 10 |
3 files changed, 5 insertions, 22 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c index 6f0de8c8..3c31ce6d 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -203,6 +203,7 @@ int flow_accept(char ** ae_name) _ap_instance->flows[cfd].port_id = recv_msg->port_id; _ap_instance->flows[cfd].oflags = FLOW_O_DEFAULT; + _ap_instance->flows[cfd].api = recv_msg->api; pthread_rwlock_unlock(&_ap_instance->flows_lock); pthread_rwlock_unlock(&_ap_instance->data_lock); @@ -321,8 +322,7 @@ int flow_alloc(char * dst_name, _ap_instance->flows[fd].port_id = recv_msg->port_id; _ap_instance->flows[fd].oflags = FLOW_O_DEFAULT; - _ap_instance->flows[fd].api = - shm_ap_rbuff_get_api(_ap_instance->flows[fd].rb); + _ap_instance->flows[fd].api = recv_msg->api; pthread_rwlock_unlock(&_ap_instance->flows_lock); pthread_rwlock_unlock(&_ap_instance->data_lock); diff --git a/src/lib/shm_ap_rbuff.c b/src/lib/shm_ap_rbuff.c index 62ef5cf1..1c7fd600 100644 --- a/src/lib/shm_ap_rbuff.c +++ b/src/lib/shm_ap_rbuff.c @@ -462,19 +462,6 @@ ssize_t shm_ap_rbuff_read_port_b(struct shm_ap_rbuff * rb, return idx; } -pid_t shm_ap_rbuff_get_api(struct shm_ap_rbuff *rb) -{ - pid_t api = -1; - if (rb == NULL) - return -1; - - pthread_mutex_lock(rb->lock); - api = rb->api; - pthread_mutex_unlock(rb->lock); - - return api; -} - void shm_ap_rbuff_reset(struct shm_ap_rbuff * rb) { if (rb == NULL) diff --git a/src/lib/shm_du_map.c b/src/lib/shm_du_map.c index 3e2c99d4..9ca282b9 100644 --- a/src/lib/shm_du_map.c +++ b/src/lib/shm_du_map.c @@ -91,14 +91,11 @@ static void garbage_collect(struct shm_du_map * dum) { #ifdef SHM_DU_MAP_MULTI_BLOCK struct shm_du_buff * sdb; - while (!shm_map_empty(dum) && - (sdb = get_tail_ptr(dum))->dst_api == -1) - + while (!shm_map_empty(dum) && (sdb = get_tail_ptr(dum))->dst_api == -1) *dum->ptr_tail = (*dum->ptr_tail + sdb->blocks) & (SHM_BUFFER_SIZE - 1); #else - while (!shm_map_empty(dum) && - get_tail_ptr(dum)->dst_api == -1) + while (!shm_map_empty(dum) && get_tail_ptr(dum)->dst_api == -1) *dum->ptr_tail = (*dum->ptr_tail + 1) & (SHM_BUFFER_SIZE - 1); @@ -296,8 +293,7 @@ void * shm_du_map_sanitize(void * o) struct timespec now; struct timespec dl; - if (pthread_cond_wait(dum->full, dum->lock) - == EOWNERDEAD) { + if (pthread_cond_wait(dum->full, dum->lock) == EOWNERDEAD) { LOG_WARN("Recovering dead mutex."); pthread_mutex_consistent(dum->lock); } |