diff --git a/lib/ipc_int.h b/lib/ipc_int.h index 6016f1a..fb4c7fa 100644 --- a/lib/ipc_int.h +++ b/lib/ipc_int.h @@ -24,6 +24,7 @@ #include #include "config.h" + #include #include #include @@ -71,8 +72,6 @@ struct qb_ipc_connection_response { char event[PATH_MAX] __attribute__ ((aligned(8))); } __attribute__ ((aligned(8))); - - struct qb_ipcc_connection; struct qb_ipc_one_way { diff --git a/lib/ipc_posix_mq.c b/lib/ipc_posix_mq.c index 5d7976d..2616f33 100644 --- a/lib/ipc_posix_mq.c +++ b/lib/ipc_posix_mq.c @@ -80,7 +80,7 @@ static int32_t posix_mq_open(struct qb_ipc_one_way *one_way, if (res != 0) { return res; } - one_way->u.pmq.q = mq_open(name, O_RDWR | O_NONBLOCK); + one_way->u.pmq.q = mq_open(name, O_RDWR); if (one_way->u.pmq.q == (mqd_t) - 1) { res = -errno; perror("mq_open"); @@ -400,14 +400,6 @@ cleanup: return res; } -#warning TODO implement this. -#if 0 -static int32_t qb_ipcc_pmq_fd_get(struct qb_ipcc_connection *c) -{ - return c->response.u.pmq.q; -} -#endif - int32_t qb_ipcs_pmq_create(struct qb_ipcs_service * s) { s->funcs.recv = qb_ipc_pmq_recv; diff --git a/lib/ipcc.c b/lib/ipcc.c index 48c713b..4661602 100644 --- a/lib/ipcc.c +++ b/lib/ipcc.c @@ -153,11 +153,7 @@ ssize_t qb_ipcc_recv(struct qb_ipcc_connection * c, void *msg_ptr, int32_t qb_ipcc_fd_get(struct qb_ipcc_connection * c, int32_t * fd) { - if (c->needs_sock_for_poll) { - *fd = c->sock; - } else { - *fd = 0; /*TODO?? */ - } + *fd = c->sock; return 0; } @@ -165,15 +161,13 @@ ssize_t qb_ipcc_event_recv(struct qb_ipcc_connection * c, void *msg_pt, size_t msg_len, int32_t ms_timeout) { char one_byte = 1; - int32_t res = 0; + int32_t res; - if (c->needs_sock_for_poll) { - res = qb_ipc_us_recv_ready(c->sock, ms_timeout); - if (res < 0) { - return res; - } - qb_ipc_us_recv(c->sock, &one_byte, 1); + res = qb_ipc_us_recv_ready(c->sock, ms_timeout); + if (res < 0) { + return res; } + qb_ipc_us_recv(c->sock, &one_byte, 1); return c->funcs.recv(&c->event, msg_pt, msg_len, ms_timeout); } diff --git a/lib/ipcs.c b/lib/ipcs.c index ced2e43..404894e 100644 --- a/lib/ipcs.c +++ b/lib/ipcs.c @@ -144,11 +144,9 @@ ssize_t qb_ipcs_event_send(struct qb_ipcs_connection *c, const void *data, ssize_t res; qb_ipcs_connection_ref_inc(c); - res = c->service->funcs.send(&c->event, data, size); - if (c->service->needs_sock_for_poll) { - qb_ipc_us_send(c->sock, data, 1); - } + res = c->service->funcs.send(&c->event, data, size); + qb_ipc_us_send(c->sock, data, 1); qb_ipcs_connection_ref_dec(c); @@ -161,11 +159,9 @@ ssize_t qb_ipcs_event_sendv(qb_ipcs_connection_t *c, const struct iovec * iov, s ssize_t res; qb_ipcs_connection_ref_inc(c); - res = c->service->funcs.sendv(&c->event, iov, iov_len); - if (c->service->needs_sock_for_poll) { - qb_ipc_us_send(c->sock, &res, 1); - } + res = c->service->funcs.sendv(&c->event, iov, iov_len); + qb_ipc_us_send(c->sock, &res, 1); qb_ipcs_connection_ref_dec(c); diff --git a/lib/ringbuffer.c b/lib/ringbuffer.c index 116c323..cdfc345 100644 --- a/lib/ringbuffer.c +++ b/lib/ringbuffer.c @@ -273,12 +273,6 @@ ssize_t qb_rb_space_free(qb_ringbuffer_t * rb) return space_free; } -/* - * TODO write a function that returns the number of chunks - * in the rb. - * - */ - static size_t _qb_rb_space_used_locked_(qb_ringbuffer_t * rb) { uint32_t write_size; diff --git a/lib/ringbuffer_helper.c b/lib/ringbuffer_helper.c index 78a95ff..407cadf 100644 --- a/lib/ringbuffer_helper.c +++ b/lib/ringbuffer_helper.c @@ -377,7 +377,6 @@ int32_t qb_rb_lock_create(struct qb_ringbuffer_s * rb, uint32_t flags) #if _POSIX_THREAD_PROCESS_SHARED > 0 can_use_shared_posix = 1; #endif - if (((rb->flags & QB_RB_FLAG_SHARED_PROCESS) == 0) && (rb->flags & QB_RB_FLAG_SHARED_THREAD) == 0) { rb->lock_fn = my_null_fn;