diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-06-28 17:02:42 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-06-28 17:02:42 +0200 |
commit | a19521aa74edfa4a2eb62466b04c9264c3b6576c (patch) | |
tree | 36b94730d8690c2d131f39b3cc3ff715674f9fcc /src/lib/shm_ap_rbuff.c | |
parent | acd29da104d0d8ddace2b2693314542bb5a56fcc (diff) | |
parent | 99d19307fae8f1370f52a62aee88fded624ad464 (diff) | |
download | ouroboros-a19521aa74edfa4a2eb62466b04c9264c3b6576c.tar.gz ouroboros-a19521aa74edfa4a2eb62466b04c9264c3b6576c.zip |
Merged in sandervrijders/ouroboros/be (pull request #144)
lib, irmd, ipcpd: Change of IRM API
Diffstat (limited to 'src/lib/shm_ap_rbuff.c')
-rw-r--r-- | src/lib/shm_ap_rbuff.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/shm_ap_rbuff.c b/src/lib/shm_ap_rbuff.c index 6ee2936c..69e96c40 100644 --- a/src/lib/shm_ap_rbuff.c +++ b/src/lib/shm_ap_rbuff.c @@ -55,7 +55,7 @@ struct shm_ap_rbuff { size_t * ptr_tail; /* start of ringbuffer tail */ pthread_mutex_t * shm_mutex; /* lock all free space in shm */ pthread_cond_t * work; /* threads will wait for a signal */ - pid_t pid; /* pid to which this rb belongs */ + pid_t api; /* api to which this rb belongs */ int fd; }; @@ -138,19 +138,19 @@ struct shm_ap_rbuff * shm_ap_rbuff_create() *rb->ptr_tail = 0; rb->fd = shm_fd; - rb->pid = getpid(); + rb->api = getpid(); return rb; } -struct shm_ap_rbuff * shm_ap_rbuff_open(pid_t pid) +struct shm_ap_rbuff * shm_ap_rbuff_open(pid_t api) { struct shm_ap_rbuff * rb; int shm_fd; struct rb_entry * shm_base; char fn[25]; - sprintf(fn, SHM_AP_RBUFF_PREFIX "%d", pid); + sprintf(fn, SHM_AP_RBUFF_PREFIX "%d", api); rb = malloc(sizeof(*rb)); if (rb == NULL) { @@ -190,7 +190,7 @@ struct shm_ap_rbuff * shm_ap_rbuff_open(pid_t pid) rb->work = (pthread_cond_t *) (rb->shm_mutex + 1); rb->fd = shm_fd; - rb->pid = pid; + rb->api = api; return rb; } @@ -219,7 +219,7 @@ void shm_ap_rbuff_destroy(struct shm_ap_rbuff * rb) return; } - if (rb->pid != getpid()) { + if (rb->api != getpid()) { LOG_ERR("Tried to destroy other AP's rbuff."); return; } @@ -227,7 +227,7 @@ void shm_ap_rbuff_destroy(struct shm_ap_rbuff * rb) if (close(rb->fd) < 0) LOG_DBGF("Couldn't close shared memory."); - sprintf(fn, SHM_AP_RBUFF_PREFIX "%d", rb->pid); + sprintf(fn, SHM_AP_RBUFF_PREFIX "%d", rb->api); if (munmap(rb->shm_base, SHM_RBUFF_FILE_SIZE) == -1) LOG_DBGF("Couldn't unmap shared memory."); |