Signed-off-by: Angus Salkeld asalkeld@redhat.com --- include/qb/qbipcs.h | 2 ++ lib/ipc_int.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/qb/qbipcs.h b/include/qb/qbipcs.h index 3e175db..5d2420b 100644 --- a/include/qb/qbipcs.h +++ b/include/qb/qbipcs.h @@ -218,6 +218,8 @@ void qb_ipcs_connection_ref_inc(qb_ipcs_connection_t *c); */ void qb_ipcs_connection_ref_dec(qb_ipcs_connection_t *c);
+void qb_ipcs_disconnect(qb_ipcs_connection_t *c); + /** * Get the service id related to this connection's service. * (as passed into qb_ipcs_create() diff --git a/lib/ipc_int.h b/lib/ipc_int.h index 01f9ead..e609302 100644 --- a/lib/ipc_int.h +++ b/lib/ipc_int.h @@ -196,6 +196,4 @@ struct qb_ipcs_connection* qb_ipcs_connection_alloc(struct qb_ipcs_service *s); int32_t qb_ipcs_process_request(struct qb_ipcs_service *s, struct qb_ipc_request_header *hdr);
-void qb_ipcs_disconnect(struct qb_ipcs_connection *c); - #endif /* QB_IPC_INT_H_DEFINED */
Signed-off-by: Angus Salkeld asalkeld@redhat.com --- lib/ipc_int.h | 2 + lib/ipcs.c | 178 ++++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 115 insertions(+), 65 deletions(-)
diff --git a/lib/ipc_int.h b/lib/ipc_int.h index e609302..ed36ca8 100644 --- a/lib/ipc_int.h +++ b/lib/ipc_int.h @@ -178,6 +178,8 @@ struct qb_ipcs_connection { char *receive_buf; void *context; int32_t fc_enabled; + int32_t poll_events; + int32_t outstanding_notifiers; struct qb_ipcs_connection_stats stats; };
diff --git a/lib/ipcs.c b/lib/ipcs.c index 37d950b..5fd014c 100644 --- a/lib/ipcs.c +++ b/lib/ipcs.c @@ -105,22 +105,49 @@ int32_t qb_ipcs_run(struct qb_ipcs_service* s) return res; }
-void qb_ipcs_request_rate_limit(struct qb_ipcs_service* s, enum qb_ipcs_rate_limit rl) +static int32_t _modify_dispatch_descriptor_(struct qb_ipcs_connection *c) +{ + if (c->service->type == QB_IPC_POSIX_MQ + && !c->service->needs_sock_for_poll) { + return c->service->poll_fns.dispatch_mod(c->service-> + poll_priority, + (int32_t) c->request.u. + pmq.q, c->poll_events, + c, + qb_ipcs_dispatch_service_request); + } else if (c->service->type == QB_IPC_SOCKET) { + return c->service->poll_fns.dispatch_mod(c->service-> + poll_priority, + c->event.u.us.sock, + c->poll_events, c, + qb_ipcs_dispatch_connection_request); + } else { + return c->service->poll_fns.dispatch_mod(c->service-> + poll_priority, + c->setup.u.us.sock, + c->poll_events, c, + qb_ipcs_dispatch_connection_request); + } + return -EINVAL; +} + +void qb_ipcs_request_rate_limit(struct qb_ipcs_service *s, + enum qb_ipcs_rate_limit rl) { struct qb_ipcs_connection *c; - enum qb_loop_priority p; + enum qb_loop_priority old_p = s->poll_priority;
switch (rl) { case QB_IPCS_RATE_FAST: - p = QB_LOOP_HIGH; + s->poll_priority = QB_LOOP_HIGH; break; case QB_IPCS_RATE_SLOW: case QB_IPCS_RATE_OFF: - p = QB_LOOP_LOW; + s->poll_priority = QB_LOOP_LOW; break; default: case QB_IPCS_RATE_NORMAL: - p = QB_LOOP_MED; + s->poll_priority = QB_LOOP_MED; break; }
@@ -128,29 +155,14 @@ void qb_ipcs_request_rate_limit(struct qb_ipcs_service* s, enum qb_ipcs_rate_lim qb_ipcs_connection_ref_inc(c);
qb_ipcs_flowcontrol_set(c, (rl == QB_IPCS_RATE_OFF)); - if (s->poll_priority == p) { + if (old_p == s->poll_priority) { qb_ipcs_connection_ref_dec(c); continue; }
- if (s->type == QB_IPC_POSIX_MQ && !s->needs_sock_for_poll) { - (void)s->poll_fns.dispatch_mod(p, (int32_t)c->request.u.pmq.q, - POLLIN | POLLPRI | POLLNVAL, - c, qb_ipcs_dispatch_service_request); - } else if (s->type == QB_IPC_SOCKET) { - (void)s->poll_fns.dispatch_mod(p, c->event.u.us.sock, - POLLIN | POLLPRI | POLLNVAL, - c, - qb_ipcs_dispatch_connection_request); - } else { - (void)s->poll_fns.dispatch_mod(p, c->setup.u.us.sock, - POLLIN | POLLPRI | POLLNVAL, - c, - qb_ipcs_dispatch_connection_request); - } + (void)_modify_dispatch_descriptor_(c); qb_ipcs_connection_ref_dec(c); } - s->poll_priority = p; }
void qb_ipcs_ref(struct qb_ipcs_service *s) @@ -223,76 +235,102 @@ ssize_t qb_ipcs_response_sendv(struct qb_ipcs_connection *c, const struct iovec return res; }
-ssize_t qb_ipcs_event_send(struct qb_ipcs_connection *c, const void *data, +static int32_t send_event_notification(int32_t fd, int32_t revents, void *data) +{ + ssize_t res = 0; + struct qb_ipcs_connection *c = data; + + if (c->outstanding_notifiers > 0) { + res = qb_ipc_us_send(&c->setup, data, c->outstanding_notifiers); + } + if (res > 0) { + c->outstanding_notifiers -= res; + } + if (c->outstanding_notifiers > 0) { + return 0; + } else { + c->outstanding_notifiers = 0; + c->poll_events = POLLIN; + (void)_modify_dispatch_descriptor_(c); + } + return 0; +} + +ssize_t qb_ipcs_event_send(struct qb_ipcs_connection * c, const void *data, size_t size) { ssize_t res; ssize_t res2 = 0; - int32_t try_count = 0;
qb_ipcs_connection_ref_inc(c);
- do { - try_count++; - res = c->service->funcs.send(&c->event, data, size); - if (res == size) { - c->stats.events++; - } else if (res == -EAGAIN) { - c->stats.send_retries++; - } - } while (res == -EAGAIN && try_count < 20); - if (res > 0) { - if (c->service->needs_sock_for_poll) { - do { - res2 = qb_ipc_us_send(&c->setup, &res, 1); - } while (res2 == -EAGAIN); + res = c->service->funcs.send(&c->event, data, size); + if (res != size) { + goto deref_and_return; + } + c->stats.events++; + if (c->service->needs_sock_for_poll) { + if (c->outstanding_notifiers > 0) { + c->outstanding_notifiers++; + } else { + res2 = qb_ipc_us_send(&c->setup, data, 1); + if (res2 == 1) { + goto deref_and_return; + } + /* + * notify the client later, when we can. + */ + c->outstanding_notifiers++; + c->poll_events = POLLOUT | POLLIN; + (void)_modify_dispatch_descriptor_(c); } - } else if (res != -EAGAIN) { - qb_util_log(LOG_ERR, - "failed to send event : %s", - strerror(-res)); } + +deref_and_return: + qb_ipcs_connection_ref_dec(c);
return res; }
- -ssize_t qb_ipcs_event_sendv(struct qb_ipcs_connection *c, const struct iovec * iov, size_t iov_len) +ssize_t qb_ipcs_event_sendv(struct qb_ipcs_connection * c, + const struct iovec * iov, size_t iov_len) { ssize_t res; ssize_t res2; - int32_t try_count = 0;
qb_ipcs_connection_ref_inc(c);
- do { - try_count++; - res = c->service->funcs.sendv(&c->event, iov, iov_len); - if (res > 0) { - c->stats.events++; - } else if (res == -EAGAIN) { - c->stats.send_retries++; - } - } while (res == -EAGAIN && try_count < 20); - if (res > 0) { - if (c->service->needs_sock_for_poll) { - do { - res2 = qb_ipc_us_send(&c->setup, &res, 1); - } while (res2 == -EAGAIN); + res = c->service->funcs.sendv(&c->event, iov, iov_len); + if (res < 0) { + goto deref_and_return; + } + c->stats.events++; + if (c->service->needs_sock_for_poll) { + if (c->outstanding_notifiers > 0) { + c->outstanding_notifiers++; + } else { + res2 = qb_ipc_us_send(&c->setup, res, 1); + if (res2 == 1) { + goto deref_and_return; + } + /* + * notify the client later, when we can. + */ + c->outstanding_notifiers++; + c->poll_events = POLLOUT | POLLIN; + (void)_modify_dispatch_descriptor_(c); } - } else if (res != -EAGAIN) { - qb_util_log(LOG_ERR, - "failed to send event : %s", - strerror(-res)); }
+deref_and_return: + qb_ipcs_connection_ref_dec(c);
return res; }
-qb_ipcs_connection_t * qb_ipcs_connection_first_get(struct qb_ipcs_service* s) +qb_ipcs_connection_t *qb_ipcs_connection_first_get(struct qb_ipcs_service * s) { struct qb_ipcs_connection *c; struct qb_list_head *iter; @@ -523,6 +561,16 @@ int32_t qb_ipcs_dispatch_connection_request(int32_t fd, int32_t revents, qb_ipcs_disconnect(c); return -ESHUTDOWN; } + + if (revents & POLLOUT) { + res = send_event_notification(fd, revents, data); + if ((revents & POLLIN) == 0) { + return 0; + } + } + if (c->fc_enabled) { + return 0; + } avail = _request_q_len_get(c); do { res = _process_request_(c, IPC_REQUEST_TIMEOUT); @@ -532,7 +580,7 @@ int32_t qb_ipcs_dispatch_connection_request(int32_t fd, int32_t revents, if (res > 0) { avail--; } - } while (avail > 0 && res > 0); + } while (avail > 0 && res > 0 && !c->fc_enabled);
if (c->service->needs_sock_for_poll && recvd > 0) { (void)qb_ipc_us_recv(&c->setup, bytes, recvd, 0);
Signed-off-by: Angus Salkeld asalkeld@redhat.com --- lib/loop_poll.c | 37 ++++++++++++++----------------------- 1 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/lib/loop_poll.c b/lib/loop_poll.c index ef762c8..109065d 100644 --- a/lib/loop_poll.c +++ b/lib/loop_poll.c @@ -84,7 +84,6 @@ struct qb_poll_entry { struct qb_poll_source { struct qb_loop_source s; #ifdef HAVE_EPOLL - struct epoll_event *events; int32_t epollfd; #else struct pollfd *ufds; @@ -337,7 +336,6 @@ qb_loop_poll_create(struct qb_loop *l)
#ifdef HAVE_EPOLL s->epollfd = epoll_create1(EPOLL_CLOEXEC); - s->events = 0; #else s->ufds = 0; #endif /* HAVE_EPOLL */ @@ -372,12 +370,10 @@ static int32_t _get_empty_array_position_(struct qb_poll_source * s) int32_t found = 0; int32_t install_pos; int32_t res = 0; - int32_t new_size = 0; struct qb_poll_entry *pe; -#ifdef HAVE_EPOLL - struct epoll_event *ev; -#else +#ifndef HAVE_EPOLL struct pollfd *ufds; + int32_t new_size = 0; #endif /* HAVE_EPOLL */
for (found = 0, install_pos = 0; @@ -399,14 +395,7 @@ static int32_t _get_empty_array_position_(struct qb_poll_source * s) return res; }
-#ifdef HAVE_EPOLL - new_size = (s->poll_entry_count+ 1) * sizeof(struct epoll_event); - ev = realloc(s->events, new_size); - if (ev == NULL) { - return -ENOMEM; - } - s->events = ev; -#else +#ifndef HAVE_EPOLL new_size = (s->poll_entry_count+ 1) * sizeof(struct pollfd); ufds = realloc(s->ufds, new_size); if (ufds == NULL) { @@ -434,7 +423,7 @@ static int32_t _poll_add_(struct qb_loop *l, int32_t res = 0; struct qb_poll_source * s; #ifdef HAVE_EPOLL - struct epoll_event *ev; + struct epoll_event ev; #endif /* HAVE_EPOLL */
if (l == NULL) { @@ -456,11 +445,10 @@ static int32_t _poll_add_(struct qb_loop *l, pe->p = p; pe->runs = 0; #ifdef HAVE_EPOLL - ev = &s->events[install_pos]; - ev->events = poll_to_epoll_event(events); - ev->data.u64 = 0; /* valgrind */ - ev->data.u32 = install_pos; - if (epoll_ctl(s->epollfd, EPOLL_CTL_ADD, fd, ev) == -1) { + ev.events = poll_to_epoll_event(events); + ev.data.u64 = 0; /* valgrind */ + ev.data.u32 = install_pos; + if (epoll_ctl(s->epollfd, EPOLL_CTL_ADD, fd, &ev) == -1) { res = -errno; qb_util_log(LOG_ERR, "epoll_ctl(add) : %s", strerror(-res)); } @@ -504,6 +492,9 @@ int32_t qb_loop_poll_mod(struct qb_loop *l, int32_t res = 0; struct qb_poll_entry *pe; struct qb_poll_source * s = (struct qb_poll_source *)l->fd_source; +#ifdef HAVE_EPOLL + struct epoll_event ev; +#endif /* HAVE_EPOLL */
/* * Find file descriptor to modify events and dispatch function @@ -518,9 +509,9 @@ int32_t qb_loop_poll_mod(struct qb_loop *l, pe->p = p; if (pe->ufd.events != events) { #ifdef HAVE_EPOLL - s->events[i].events = poll_to_epoll_event(events); - s->events[i].data.u32 = i; - if (epoll_ctl(s->epollfd, EPOLL_CTL_MOD, fd, &s->events[i]) == -1) { + ev.events = poll_to_epoll_event(events); + ev.data.u32 = i; + if (epoll_ctl(s->epollfd, EPOLL_CTL_MOD, fd, &ev) == -1) { res = -errno; qb_util_log(LOG_ERR, "epoll_ctl(mod) : %s", strerror(-res)); }
Signed-off-by: Angus Salkeld asalkeld@redhat.com --- lib/ipcs.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/ipcs.c b/lib/ipcs.c index 5fd014c..1538d40 100644 --- a/lib/ipcs.c +++ b/lib/ipcs.c @@ -250,7 +250,7 @@ static int32_t send_event_notification(int32_t fd, int32_t revents, void *data) return 0; } else { c->outstanding_notifiers = 0; - c->poll_events = POLLIN; + c->poll_events = POLLIN | POLLPRI | POLLNVAL, (void)_modify_dispatch_descriptor_(c); } return 0; @@ -281,7 +281,7 @@ ssize_t qb_ipcs_event_send(struct qb_ipcs_connection * c, const void *data, * notify the client later, when we can. */ c->outstanding_notifiers++; - c->poll_events = POLLOUT | POLLIN; + c->poll_events = POLLOUT | POLLIN | POLLPRI | POLLNVAL, (void)_modify_dispatch_descriptor_(c); } } @@ -310,7 +310,7 @@ ssize_t qb_ipcs_event_sendv(struct qb_ipcs_connection * c, if (c->outstanding_notifiers > 0) { c->outstanding_notifiers++; } else { - res2 = qb_ipc_us_send(&c->setup, res, 1); + res2 = qb_ipc_us_send(&c->setup, &res, 1); if (res2 == 1) { goto deref_and_return; } @@ -318,7 +318,7 @@ ssize_t qb_ipcs_event_sendv(struct qb_ipcs_connection * c, * notify the client later, when we can. */ c->outstanding_notifiers++; - c->poll_events = POLLOUT | POLLIN; + c->poll_events = POLLOUT | POLLIN | POLLPRI | POLLNVAL, (void)_modify_dispatch_descriptor_(c); } } @@ -382,6 +382,7 @@ struct qb_ipcs_connection *qb_ipcs_connection_alloc(struct qb_ipcs_service *s) c->context = NULL; c->fc_enabled = QB_FALSE; c->state = QB_IPCS_CONNECTION_INACTIVE; + c->poll_events = POLLIN | POLLPRI | POLLNVAL; return c; }
Signed-off-by: Angus Salkeld asalkeld@redhat.com --- lib/ipc_shm.c | 34 ++++++++++++++++++++++++++-------- lib/ipcs.c | 3 ++- 2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/lib/ipc_shm.c b/lib/ipc_shm.c index e9b60d5..114a317 100644 --- a/lib/ipc_shm.c +++ b/lib/ipc_shm.c @@ -57,6 +57,10 @@ static ssize_t qb_ipc_shm_sendv(struct qb_ipc_one_way *one_way, int32_t i; char *pt = NULL;
+ if (one_way->u.shm.rb == NULL) { + return -EIDRM; + } + for (i = 0; i < iov_len; i++) { total_size += iov[i].iov_len; } @@ -82,10 +86,14 @@ static ssize_t qb_ipc_shm_recv(struct qb_ipc_one_way *one_way, size_t msg_len, int32_t ms_timeout) { - ssize_t res = qb_rb_chunk_read(one_way->u.shm.rb, - (void *)msg_ptr, - msg_len, - ms_timeout); + ssize_t res; + if (one_way->u.shm.rb == NULL) { + return -EIDRM; + } + res = qb_rb_chunk_read(one_way->u.shm.rb, + (void *)msg_ptr, + msg_len, + ms_timeout); if (res == -ETIMEDOUT) { return -EAGAIN; } @@ -94,9 +102,14 @@ static ssize_t qb_ipc_shm_recv(struct qb_ipc_one_way *one_way,
static ssize_t qb_ipc_shm_peek(struct qb_ipc_one_way *one_way, void **data_out, int32_t ms_timeout) { - ssize_t res = qb_rb_chunk_peek(one_way->u.shm.rb, - data_out, - ms_timeout); + ssize_t res; + + if (one_way->u.shm.rb == NULL) { + return -EIDRM; + } + res = qb_rb_chunk_peek(one_way->u.shm.rb, + data_out, + ms_timeout); if (res == -ETIMEDOUT) { return -EAGAIN; } @@ -105,7 +118,9 @@ static ssize_t qb_ipc_shm_peek(struct qb_ipc_one_way *one_way, void **data_out,
static void qb_ipc_shm_reclaim(struct qb_ipc_one_way *one_way) { - qb_rb_chunk_reclaim(one_way->u.shm.rb); + if (one_way->u.shm.rb != NULL) { + qb_rb_chunk_reclaim(one_way->u.shm.rb); + } }
static void qb_ipc_shm_fc_set(struct qb_ipc_one_way *one_way, @@ -125,6 +140,9 @@ static int32_t qb_ipc_shm_fc_get(struct qb_ipc_one_way *one_way)
static ssize_t qb_ipc_shm_q_len_get(struct qb_ipc_one_way *one_way) { + if (one_way->u.shm.rb == NULL) { + return -EIDRM; + } return qb_rb_chunks_used(one_way->u.shm.rb); }
diff --git a/lib/ipcs.c b/lib/ipcs.c index 1538d40..32ed22f 100644 --- a/lib/ipcs.c +++ b/lib/ipcs.c @@ -534,7 +534,7 @@ static ssize_t _request_q_len_get(struct qb_ipcs_connection *c) if (c->service->funcs.q_len_get) { q_len = c->service->funcs.q_len_get(&c->request); if (q_len < 0) { - q_len = 1; + return q_len; } q_len = QB_MIN(q_len, MAX_RECV_MSGS); if (c->service->poll_priority == QB_LOOP_MED) @@ -573,6 +573,7 @@ int32_t qb_ipcs_dispatch_connection_request(int32_t fd, int32_t revents, return 0; } avail = _request_q_len_get(c); + res = avail; /* in case error */ do { res = _process_request_(c, IPC_REQUEST_TIMEOUT); if (res > 0 || res == -ENOBUFS || res == -EINVAL) {
Signed-off-by: Angus Salkeld asalkeld@redhat.com --- lib/ipc_posix_mq.c | 2 +- lib/ipc_shm.c | 6 +++--- lib/ipc_sysv_mq.c | 2 +- lib/ipc_us.c | 16 ++++++++-------- lib/ipcs.c | 2 +- lib/util.c | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/lib/ipc_posix_mq.c b/lib/ipc_posix_mq.c index ad84d99..ef682d6 100644 --- a/lib/ipc_posix_mq.c +++ b/lib/ipc_posix_mq.c @@ -241,7 +241,7 @@ static void qb_ipcc_pmq_disconnect(struct qb_ipcc_connection *c) { struct qb_ipc_request_header hdr;
- qb_util_log(LOG_DEBUG, "%s()\n", __func__); + qb_util_log(LOG_DEBUG, "%s()", __func__); if (c->needs_sock_for_poll) { return; } diff --git a/lib/ipc_shm.c b/lib/ipc_shm.c index 114a317..024194b 100644 --- a/lib/ipc_shm.c +++ b/lib/ipc_shm.c @@ -197,7 +197,7 @@ int32_t qb_ipcc_shm_connect(struct qb_ipcc_connection *c, qb_rb_close(c->request.u.shm.rb);
return_error: - qb_util_log(LOG_ERR, "connection failed %s\n", + qb_util_log(LOG_ERR, "connection failed %s", strerror(-res));
return res; @@ -241,7 +241,7 @@ static int32_t qb_ipcs_shm_connect(struct qb_ipcs_service *s, { int32_t res;
- qb_util_log(LOG_DEBUG, "connecting to client [%d]\n", c->pid); + qb_util_log(LOG_DEBUG, "connecting to client [%d]", c->pid);
snprintf(r->request, NAME_MAX, "qb-%s-request-%d-%d", s->name, c->pid, c->setup.u.us.sock); snprintf(r->response, NAME_MAX, "qb-%s-response-%d-%d", s->name, c->pid, c->setup.u.us.sock); @@ -293,7 +293,7 @@ cleanup_request:
cleanup: r->hdr.error = res; - qb_util_log(LOG_ERR, "shm connection FAILED [%s]\n", + qb_util_log(LOG_ERR, "shm connection FAILED [%s]", strerror(-res));
return res; diff --git a/lib/ipc_sysv_mq.c b/lib/ipc_sysv_mq.c index 5b5f1b8..6e62840 100644 --- a/lib/ipc_sysv_mq.c +++ b/lib/ipc_sysv_mq.c @@ -229,7 +229,7 @@ static void qb_ipcc_smq_disconnect(struct qb_ipcc_connection *c) { struct qb_ipc_request_header hdr;
- qb_util_log(LOG_DEBUG, "%s()\n", __func__); + qb_util_log(LOG_DEBUG, "%s()", __func__); //if (c->needs_sock_for_poll) { // return; //} diff --git a/lib/ipc_us.c b/lib/ipc_us.c index c64cd71..231b475 100644 --- a/lib/ipc_us.c +++ b/lib/ipc_us.c @@ -436,7 +436,7 @@ int32_t qb_ipcs_us_publish(struct qb_ipcs_service * s) res = -errno; strerror_r(errno, error_str, 100); qb_util_log(LOG_ERR, - "Cannot create server socket: %s\n", error_str); + "Cannot create server socket: %s", error_str); return res; }
@@ -461,7 +461,7 @@ int32_t qb_ipcs_us_publish(struct qb_ipcs_service * s) if (res == -1 || (res == 0 && !S_ISDIR(stat_out.st_mode))) { res = -errno; qb_util_log(LOG_CRIT, - "Required directory not present %s\n", + "Required directory not present %s", SOCKETDIR); goto error_close; } @@ -477,7 +477,7 @@ int32_t qb_ipcs_us_publish(struct qb_ipcs_service * s) res = -errno; strerror_r(errno, error_str, 100); qb_util_log(LOG_CRIT, - "Could not bind AF_UNIX (%s): %s.\n", + "Could not bind AF_UNIX (%s): %s.", un_addr.sun_path, error_str); goto error_close; } @@ -491,7 +491,7 @@ int32_t qb_ipcs_us_publish(struct qb_ipcs_service * s) #endif if (listen(s->server_sock, SERVER_BACKLOG) == -1) { strerror_r(errno, error_str, 100); - qb_util_log(LOG_ERR, "listen failed: %s.\n", error_str); + qb_util_log(LOG_ERR, "listen failed: %s.", error_str); }
res = s->poll_fns.dispatch_add(s->poll_priority, s->server_sock, @@ -506,7 +506,7 @@ error_close:
int32_t qb_ipcs_us_withdraw(struct qb_ipcs_service * s) { - qb_util_log(LOG_INFO, "withdrawing server sockets\n"); + qb_util_log(LOG_INFO, "withdrawing server sockets"); shutdown(s->server_sock, SHUT_RDWR); close(s->server_sock); return 0; @@ -762,14 +762,14 @@ retry_accept: if (new_fd == -1 && errno == EBADF) { strerror_r(errno, error_str, 100); qb_util_log(LOG_ERR, - "Could not accept Library connection:(fd: %d) [%d] %s\n", + "Could not accept Library connection:(fd: %d) [%d] %s", fd, errno, error_str); return -1; } if (new_fd == -1) { res = -errno; qb_util_log(LOG_ERR, - "Could not accept Library connection: [%d] %s\n", + "Could not accept Library connection: [%d] %s", errno, strerror(-res)); return 0; /* This is an error, but -1 would indicate disconnect from poll loop */ } @@ -808,7 +808,7 @@ static int32_t qb_ipcs_us_connect(struct qb_ipcs_service *s, int32_t res = 0; struct ipc_us_control * ctl;
- qb_util_log(LOG_DEBUG, "connecting to client [%d]\n", c->pid); + qb_util_log(LOG_DEBUG, "connecting to client [%d]", c->pid);
snprintf(r->request, NAME_MAX, "qb-%s-control-%d-%d", s->name, c->pid, c->setup.u.us.sock); diff --git a/lib/ipcs.c b/lib/ipcs.c index 32ed22f..155b0e5 100644 --- a/lib/ipcs.c +++ b/lib/ipcs.c @@ -180,7 +180,7 @@ void qb_ipcs_unref(struct qb_ipcs_service *s) assert(s->ref_count > 0); free_it = qb_atomic_int_dec_and_test(&s->ref_count); if (free_it) { - qb_util_log(LOG_DEBUG, "%s() - destorying\n", __func__); + qb_util_log(LOG_DEBUG, "%s() - destorying", __func__); qb_list_for_each_safe(iter, iter_next, &s->connections) { c = qb_list_entry(iter, struct qb_ipcs_connection, list); if (c == NULL) { diff --git a/lib/util.c b/lib/util.c index 5238d4b..12be4e3 100644 --- a/lib/util.c +++ b/lib/util.c @@ -369,7 +369,7 @@ int32_t qb_util_fd_nonblock_cloexec_set(int32_t fd) res = -errno; strerror_r(errno, error_str, 100); qb_util_log(LOG_CRIT, - "Could not set close-on-exit operation on fd: %s\n", + "Could not set close-on-exit operation on fd: %s", error_str); return res; } @@ -379,7 +379,7 @@ int32_t qb_util_fd_nonblock_cloexec_set(int32_t fd) res = -errno; strerror_r(errno, error_str, 100); qb_util_log(LOG_CRIT, - "Could not set non-blocking operation on fd: %s\n", + "Could not set non-blocking operation on fd: %s", error_str); } return res;
quarterback-devel@lists.fedorahosted.org