diff options
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-control.c | 8 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-dump.c | 10 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-internal.h | 6 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-kernel.c | 22 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-message.c | 44 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-message.h | 8 | ||||
-rw-r--r-- | src/libsystemd-bus/libsystemd-bus.sym | 4 | ||||
-rw-r--r-- | src/libsystemd-bus/sd-bus.c | 74 | ||||
-rw-r--r-- | src/shared/capability.c | 2 | ||||
-rw-r--r-- | src/shared/install.c | 12 | ||||
-rw-r--r-- | src/shared/util.h | 2 | ||||
-rw-r--r-- | src/systemd/sd-bus.h | 12 |
13 files changed, 108 insertions, 100 deletions
diff --git a/configure.ac b/configure.ac index 9a32d9c8b6..86eebce684 100644 --- a/configure.ac +++ b/configure.ac @@ -127,6 +127,9 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\ -Winit-self \ -Wdeclaration-after-statement \ -Wfloat-equal \ + -Wsuggest-attribute=pure \ + -Wsuggest-attribute=const \ + -Wsuggest-attribute=noreturn \ -Wmissing-prototypes \ -Wstrict-prototypes \ -Wredundant-decls \ @@ -144,6 +147,7 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\ -Wno-unused-result \ -Werror=overflow \ -Wdate-time \ + -Wnested-externs \ -ffast-math \ -fno-common \ -fdiagnostics-show-option \ diff --git a/src/libsystemd-bus/bus-control.c b/src/libsystemd-bus/bus-control.c index 511ca20ee3..e7e9ba07b0 100644 --- a/src/libsystemd-bus/bus-control.c +++ b/src/libsystemd-bus/bus-control.c @@ -411,14 +411,14 @@ static int bus_get_owner_kdbus( m = (SD_BUS_CREDS_UID | SD_BUS_CREDS_GID | SD_BUS_CREDS_PID) & mask; if (m) { - c->uid = item->creds.uid; - c->pid = item->creds.pid; - c->gid = item->creds.gid; + c->uid = (uid_t) item->creds.uid; + c->pid = (pid_t) item->creds.pid; + c->gid = (gid_t) item->creds.gid; c->mask |= m; } if (mask & SD_BUS_CREDS_TID && item->creds.tid > 0) { - c->tid = item->creds.tid; + c->tid = (pid_t) item->creds.tid; c->mask |= SD_BUS_CREDS_TID; } diff --git a/src/libsystemd-bus/bus-dump.c b/src/libsystemd-bus/bus-dump.c index 7b614792ca..df7cf6893a 100644 --- a/src/libsystemd-bus/bus-dump.c +++ b/src/libsystemd-bus/bus-dump.c @@ -67,13 +67,13 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) { /* Display synthetic message serial number in a more readable * format than (uint32_t) -1 */ - if (BUS_MESSAGE_SERIAL(m) == 0xFFFFFFFFULL) - fprintf(f, " Serial=-1"); + if (BUS_MESSAGE_COOKIE(m) == 0xFFFFFFFFULL) + fprintf(f, " Cookie=-1"); else - fprintf(f, " Serial=%u", BUS_MESSAGE_SERIAL(m)); + fprintf(f, " Cookie=%lu", (unsigned long) BUS_MESSAGE_COOKIE(m)); - if (m->reply_serial != 0) - fprintf(f, " ReplySerial=%u", m->reply_serial); + if (m->reply_cookie != 0) + fprintf(f, " ReplyCookie=%lu", (unsigned long) m->reply_cookie); fputs("\n", f); diff --git a/src/libsystemd-bus/bus-internal.h b/src/libsystemd-bus/bus-internal.h index e4ef6e64ec..c73ceb4a06 100644 --- a/src/libsystemd-bus/bus-internal.h +++ b/src/libsystemd-bus/bus-internal.h @@ -42,7 +42,7 @@ struct reply_callback { sd_bus_message_handler_t callback; void *userdata; usec_t timeout; - uint64_t serial; + uint64_t cookie; unsigned prioq_idx; }; @@ -178,7 +178,7 @@ struct sd_bus { size_t windex; size_t wqueue_allocated; - uint64_t serial; + uint64_t cookie; char *unique_name; uint64_t unique_id; @@ -228,7 +228,7 @@ struct sd_bus { char *exec_path; char **exec_argv; - uint64_t hello_serial; + uint64_t hello_cookie; unsigned iteration_counter; void *kdbus_buffer; diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c index 7944f51383..fadb683094 100644 --- a/src/libsystemd-bus/bus-kernel.c +++ b/src/libsystemd-bus/bus-kernel.c @@ -175,10 +175,10 @@ static int bus_message_setup_bloom(sd_bus_message *m, void *bloom) { e = stpcpy(buf, "arg"); if (i < 10) - *(e++) = '0' + i; + *(e++) = '0' + (char) i; else { - *(e++) = '0' + (i / 10); - *(e++) = '0' + (i % 10); + *(e++) = '0' + (char) (i / 10); + *(e++) = '0' + (char) (i % 10); } *e = 0; @@ -259,7 +259,7 @@ static int bus_message_setup_kmsg(sd_bus *b, sd_bus_message *m) { m->kdbus->cookie = m->header->serial; if (m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) - m->kdbus->cookie_reply = m->reply_serial; + m->kdbus->cookie_reply = m->reply_cookie; else m->kdbus->timeout_ns = m->timeout * NSEC_PER_USEC; @@ -470,7 +470,7 @@ int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m) { r = bus_message_new_synthetic_error( bus, - BUS_MESSAGE_SERIAL(m), + BUS_MESSAGE_COOKIE(m), &error, &reply); @@ -798,9 +798,9 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { case KDBUS_ITEM_CREDS: /* UID/GID/PID are always valid */ - m->creds.uid = d->creds.uid; - m->creds.gid = d->creds.gid; - m->creds.pid = d->creds.pid; + m->creds.uid = (uid_t) d->creds.uid; + m->creds.gid = (gid_t) d->creds.gid; + m->creds.pid = (pid_t) d->creds.pid; m->creds.mask |= (SD_BUS_CREDS_UID|SD_BUS_CREDS_GID|SD_BUS_CREDS_PID) & bus->creds_mask; /* The PID starttime/TID might be missing @@ -815,7 +815,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { } if (d->creds.tid > 0) { - m->creds.tid = d->creds.tid; + m->creds.tid = (pid_t) d->creds.tid; m->creds.mask |= SD_BUS_CREDS_TID & bus->creds_mask; } break; @@ -861,8 +861,8 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { break; case KDBUS_ITEM_AUDIT: - m->creds.audit_session_id = d->audit.sessionid; - m->creds.audit_login_uid = d->audit.loginuid; + m->creds.audit_session_id = (uint32_t) d->audit.sessionid; + m->creds.audit_login_uid = (uid_t) d->audit.loginuid; m->creds.mask |= (SD_BUS_CREDS_AUDIT_SESSION_ID|SD_BUS_CREDS_AUDIT_LOGIN_UID) & bus->creds_mask; break; diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c index f09f0d682d..f16f92780b 100644 --- a/src/libsystemd-bus/bus-message.c +++ b/src/libsystemd-bus/bus-message.c @@ -615,9 +615,9 @@ static int message_new_reply( return -ENOMEM; t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED; - t->reply_serial = BUS_MESSAGE_SERIAL(call); + t->reply_cookie = BUS_MESSAGE_COOKIE(call); - r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, t->reply_serial); + r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, t->reply_cookie); if (r < 0) goto fail; @@ -735,7 +735,7 @@ _public_ int sd_bus_message_new_method_errnof( int bus_message_new_synthetic_error( sd_bus *bus, - uint64_t serial, + uint64_t cookie, const sd_bus_error *e, sd_bus_message **m) { @@ -750,9 +750,9 @@ int bus_message_new_synthetic_error( return -ENOMEM; t->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED; - t->reply_serial = serial; + t->reply_cookie = cookie; - r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, t->reply_serial); + r = message_append_field_uint32(t, BUS_MESSAGE_HEADER_REPLY_SERIAL, t->reply_cookie); if (r < 0) goto fail; @@ -813,21 +813,21 @@ _public_ int sd_bus_message_get_type(sd_bus_message *m, uint8_t *type) { return 0; } -_public_ int sd_bus_message_get_serial(sd_bus_message *m, uint64_t *serial) { +_public_ int sd_bus_message_get_cookie(sd_bus_message *m, uint64_t *cookie) { assert_return(m, -EINVAL); - assert_return(serial, -EINVAL); + assert_return(cookie, -EINVAL); assert_return(m->header->serial != 0, -ENOENT); - *serial = BUS_MESSAGE_SERIAL(m); + *cookie = BUS_MESSAGE_COOKIE(m); return 0; } -_public_ int sd_bus_message_get_reply_serial(sd_bus_message *m, uint64_t *serial) { +_public_ int sd_bus_message_get_reply_cookie(sd_bus_message *m, uint64_t *cookie) { assert_return(m, -EINVAL); - assert_return(serial, -EINVAL); - assert_return(m->reply_serial != 0, -ENOENT); + assert_return(cookie, -EINVAL); + assert_return(m->reply_cookie != 0, -ENOENT); - *serial = m->reply_serial; + *cookie = m->reply_cookie; return 0; } @@ -2707,7 +2707,7 @@ static int bus_message_close_header(sd_bus_message *m) { return 0; } -int bus_message_seal(sd_bus_message *m, uint64_t serial, usec_t timeout) { +int bus_message_seal(sd_bus_message *m, uint64_t cookie, usec_t timeout) { struct bus_body_part *part; size_t l, a; unsigned i; @@ -2753,7 +2753,7 @@ int bus_message_seal(sd_bus_message *m, uint64_t serial, usec_t timeout) { if (r < 0) return r; - m->header->serial = serial; + m->header->serial = (uint32_t) cookie; m->timeout = m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED ? 0 : timeout; /* Add padding at the end of the fields part, since we know @@ -5060,17 +5060,17 @@ int bus_message_parse_fields(sd_bus_message *m) { } case BUS_MESSAGE_HEADER_REPLY_SERIAL: - if (m->reply_serial != 0) + if (m->reply_cookie != 0) return -EBADMSG; if (!streq(signature, "u")) return -EBADMSG; - r = message_peek_field_uint32(m, &ri, item_size, &m->reply_serial); + r = message_peek_field_uint32(m, &ri, item_size, &m->reply_cookie); if (r < 0) return r; - if (m->reply_serial == 0) + if (m->reply_cookie == 0) return -EBADMSG; break; @@ -5121,13 +5121,13 @@ int bus_message_parse_fields(sd_bus_message *m) { case SD_BUS_MESSAGE_METHOD_RETURN: - if (m->reply_serial == 0) + if (m->reply_cookie == 0) return -EBADMSG; break; case SD_BUS_MESSAGE_METHOD_ERROR: - if (m->reply_serial == 0 || !m->error.name) + if (m->reply_cookie == 0 || !m->error.name) return -EBADMSG; break; } @@ -5472,8 +5472,8 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) { if (!n) return -ENOMEM; - n->reply_serial = (*m)->reply_serial; - r = message_append_field_uint32(n, BUS_MESSAGE_HEADER_REPLY_SERIAL, n->reply_serial); + n->reply_cookie = (*m)->reply_cookie; + r = message_append_field_uint32(n, BUS_MESSAGE_HEADER_REPLY_SERIAL, n->reply_cookie); if (r < 0) return r; @@ -5513,7 +5513,7 @@ int bus_message_remarshal(sd_bus *bus, sd_bus_message **m) { if (timeout == 0 && !((*m)->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED)) timeout = BUS_DEFAULT_TIMEOUT; - r = bus_message_seal(n, (*m)->header->serial, timeout); + r = bus_message_seal(n, BUS_MESSAGE_COOKIE(*m), timeout); if (r < 0) return r; diff --git a/src/libsystemd-bus/bus-message.h b/src/libsystemd-bus/bus-message.h index a973e9fd6c..5322375ef1 100644 --- a/src/libsystemd-bus/bus-message.h +++ b/src/libsystemd-bus/bus-message.h @@ -58,6 +58,10 @@ struct bus_header { uint8_t flags; uint8_t version; uint32_t body_size; + + /* Note that what the bus spec calls "serial" we'll call + "cookie" instead, because we don't want to imply that the + cookie was in any way monotonically increasing. */ uint32_t serial; uint32_t fields_size; } _packed_; @@ -80,7 +84,7 @@ struct sd_bus_message { sd_bus *bus; - uint32_t reply_serial; + uint32_t reply_cookie; const char *path; const char *interface; @@ -156,7 +160,7 @@ static inline uint64_t BUS_MESSAGE_BSWAP64(sd_bus_message *m, uint64_t u) { return BUS_MESSAGE_NEED_BSWAP(m) ? bswap_64(u) : u; } -static inline uint32_t BUS_MESSAGE_SERIAL(sd_bus_message *m) { +static inline uint32_t BUS_MESSAGE_COOKIE(sd_bus_message *m) { return BUS_MESSAGE_BSWAP32(m, m->header->serial); } diff --git a/src/libsystemd-bus/libsystemd-bus.sym b/src/libsystemd-bus/libsystemd-bus.sym index 3529b7942f..3031f1b2d6 100644 --- a/src/libsystemd-bus/libsystemd-bus.sym +++ b/src/libsystemd-bus/libsystemd-bus.sym @@ -80,8 +80,8 @@ global: sd_bus_message_unref; sd_bus_message_get_bus; sd_bus_message_get_type; - sd_bus_message_get_serial; - sd_bus_message_get_reply_serial; + sd_bus_message_get_cookie; + sd_bus_message_get_reply_cookie; sd_bus_message_get_no_reply; sd_bus_message_get_no_auto_start; sd_bus_message_get_signature; diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c index 9b93ff7e1b..fe2d329d9b 100644 --- a/src/libsystemd-bus/sd-bus.c +++ b/src/libsystemd-bus/sd-bus.c @@ -383,7 +383,7 @@ static int bus_send_hello(sd_bus *bus) { if (r < 0) return r; - return sd_bus_call_async(bus, m, hello_callback, NULL, 0, &bus->hello_serial); + return sd_bus_call_async(bus, m, hello_callback, NULL, 0, &bus->hello_cookie); } int bus_start_running(sd_bus *bus) { @@ -1323,16 +1323,16 @@ static int bus_seal_message(sd_bus *b, sd_bus_message *m, usec_t timeout) { if (m->sealed) { /* If we copy the same message to multiple - * destinations, avoid using the same serial + * destinations, avoid using the same cookie * numbers. */ - b->serial = MAX(b->serial, BUS_MESSAGE_SERIAL(m)); + b->cookie = MAX(b->cookie, BUS_MESSAGE_COOKIE(m)); return 0; } if (timeout == 0) timeout = BUS_DEFAULT_TIMEOUT; - return bus_message_seal(m, ++b->serial, timeout); + return bus_message_seal(m, ++b->cookie, timeout); } static int bus_remarshal_message(sd_bus *b, sd_bus_message **m) { @@ -1377,15 +1377,15 @@ static int bus_write_message(sd_bus *bus, sd_bus_message *m, size_t *idx) { return r; if (bus->is_kernel || bus->windex >= BUS_MESSAGE_SIZE(m)) - log_debug("Sent message type=%s sender=%s destination=%s object=%s interface=%s member=%s serial=%lu reply_serial=%lu error=%s", + log_debug("Sent message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%lu reply_cookie=%lu error=%s", bus_message_type_to_string(m->header->type), strna(sd_bus_message_get_sender(m)), strna(sd_bus_message_get_destination(m)), strna(sd_bus_message_get_path(m)), strna(sd_bus_message_get_interface(m)), strna(sd_bus_message_get_member(m)), - (unsigned long) m->header->serial, - (unsigned long) m->reply_serial, + (unsigned long) BUS_MESSAGE_COOKIE(m), + (unsigned long) m->reply_cookie, strna(m->error.message)); return r; @@ -1477,7 +1477,7 @@ static int dispatch_rqueue(sd_bus *bus, sd_bus_message **m) { } } -_public_ int sd_bus_send(sd_bus *bus, sd_bus_message *_m, uint64_t *serial) { +_public_ int sd_bus_send(sd_bus *bus, sd_bus_message *_m, uint64_t *cookie) { _cleanup_bus_message_unref_ sd_bus_message *m = sd_bus_message_ref(_m); int r; @@ -1494,9 +1494,9 @@ _public_ int sd_bus_send(sd_bus *bus, sd_bus_message *_m, uint64_t *serial) { return -ENOTSUP; } - /* If the serial number isn't kept, then we know that no reply + /* If the cookie number isn't kept, then we know that no reply * is expected */ - if (!serial && !m->sealed) + if (!cookie && !m->sealed) m->header->flags |= BUS_MESSAGE_NO_REPLY_EXPECTED; r = bus_seal_message(bus, m, 0); @@ -1511,7 +1511,7 @@ _public_ int sd_bus_send(sd_bus *bus, sd_bus_message *_m, uint64_t *serial) { /* If this is a reply and no reply was requested, then let's * suppress this, if we can */ - if (m->dont_send && !serial) + if (m->dont_send && !cookie) return 1; if ((bus->state == BUS_RUNNING || bus->state == BUS_HELLO) && bus->wqueue_size <= 0) { @@ -1545,13 +1545,13 @@ _public_ int sd_bus_send(sd_bus *bus, sd_bus_message *_m, uint64_t *serial) { bus->wqueue[bus->wqueue_size ++] = sd_bus_message_ref(m); } - if (serial) - *serial = BUS_MESSAGE_SERIAL(m); + if (cookie) + *cookie = BUS_MESSAGE_COOKIE(m); return 1; } -_public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destination, uint64_t *serial) { +_public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destination, uint64_t *cookie) { int r; assert_return(bus, -EINVAL); @@ -1569,7 +1569,7 @@ _public_ int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destinat return r; } - return sd_bus_send(bus, m, serial); + return sd_bus_send(bus, m, cookie); } static usec_t calc_elapse(uint64_t usec) { @@ -1603,7 +1603,7 @@ _public_ int sd_bus_call_async( sd_bus_message_handler_t callback, void *userdata, uint64_t usec, - uint64_t *serial) { + uint64_t *cookie) { _cleanup_bus_message_unref_ sd_bus_message *m = sd_bus_message_ref(_m); struct reply_callback *c; @@ -1639,10 +1639,10 @@ _public_ int sd_bus_call_async( c->callback = callback; c->userdata = userdata; - c->serial = BUS_MESSAGE_SERIAL(m); + c->cookie = BUS_MESSAGE_COOKIE(m); c->timeout = calc_elapse(m->timeout); - r = hashmap_put(bus->reply_callbacks, &c->serial, c); + r = hashmap_put(bus->reply_callbacks, &c->cookie, c); if (r < 0) { free(c); return r; @@ -1652,28 +1652,28 @@ _public_ int sd_bus_call_async( r = prioq_put(bus->reply_callbacks_prioq, c, &c->prioq_idx); if (r < 0) { c->timeout = 0; - sd_bus_call_async_cancel(bus, c->serial); + sd_bus_call_async_cancel(bus, c->cookie); return r; } } - r = sd_bus_send(bus, m, serial); + r = sd_bus_send(bus, m, cookie); if (r < 0) { - sd_bus_call_async_cancel(bus, c->serial); + sd_bus_call_async_cancel(bus, c->cookie); return r; } return r; } -_public_ int sd_bus_call_async_cancel(sd_bus *bus, uint64_t serial) { +_public_ int sd_bus_call_async_cancel(sd_bus *bus, uint64_t cookie) { struct reply_callback *c; assert_return(bus, -EINVAL); - assert_return(serial != 0, -EINVAL); + assert_return(cookie != 0, -EINVAL); assert_return(!bus_pid_changed(bus), -ECHILD); - c = hashmap_remove(bus->reply_callbacks, &serial); + c = hashmap_remove(bus->reply_callbacks, &cookie); if (!c) return 0; @@ -1718,7 +1718,7 @@ _public_ int sd_bus_call( _cleanup_bus_message_unref_ sd_bus_message *m = sd_bus_message_ref(_m); usec_t timeout; - uint64_t serial; + uint64_t cookie; unsigned i; int r; @@ -1744,7 +1744,7 @@ _public_ int sd_bus_call( if (r < 0) return r; - r = sd_bus_send(bus, m, &serial); + r = sd_bus_send(bus, m, &cookie); if (r < 0) return r; @@ -1758,7 +1758,7 @@ _public_ int sd_bus_call( incoming = bus->rqueue[i]; - if (incoming->reply_serial == serial) { + if (incoming->reply_cookie == cookie) { /* Found a match! */ memmove(bus->rqueue + i, bus->rqueue + i + 1, sizeof(sd_bus_message*) * (bus->rqueue_size - i - 1)); @@ -1780,7 +1780,7 @@ _public_ int sd_bus_call( sd_bus_message_unref(incoming); return r; - } else if (incoming->header->serial == serial && + } else if (BUS_MESSAGE_COOKIE(incoming) == cookie && bus->unique_name && incoming->sender && streq(bus->unique_name, incoming->sender)) { @@ -1930,7 +1930,7 @@ static int process_timeout(sd_bus *bus) { r = bus_message_new_synthetic_error( bus, - c->serial, + c->cookie, &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_NO_REPLY, "Method call timed out"), &m); if (r < 0) @@ -1943,7 +1943,7 @@ static int process_timeout(sd_bus *bus) { return r; assert_se(prioq_pop(bus->reply_callbacks_prioq) == c); - hashmap_remove(bus->reply_callbacks, &c->serial); + hashmap_remove(bus->reply_callbacks, &c->cookie); bus->current = m; bus->iteration_counter ++; @@ -1973,7 +1973,7 @@ static int process_hello(sd_bus *bus, sd_bus_message *m) { m->header->type != SD_BUS_MESSAGE_METHOD_ERROR) return -EIO; - if (m->reply_serial != bus->hello_serial) + if (m->reply_cookie != bus->hello_cookie) return -EIO; return 0; @@ -1991,7 +1991,7 @@ static int process_reply(sd_bus *bus, sd_bus_message *m) { m->header->type != SD_BUS_MESSAGE_METHOD_ERROR) return 0; - c = hashmap_remove(bus->reply_callbacks, &m->reply_serial); + c = hashmap_remove(bus->reply_callbacks, &m->reply_cookie); if (!c) return 0; @@ -2122,15 +2122,15 @@ static int process_message(sd_bus *bus, sd_bus_message *m) { bus->current = m; bus->iteration_counter++; - log_debug("Got message type=%s sender=%s destination=%s object=%s interface=%s member=%s serial=%lu reply_serial=%lu error=%s", + log_debug("Got message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%lu reply_cookie=%lu error=%s", bus_message_type_to_string(m->header->type), strna(sd_bus_message_get_sender(m)), strna(sd_bus_message_get_destination(m)), strna(sd_bus_message_get_path(m)), strna(sd_bus_message_get_interface(m)), strna(sd_bus_message_get_member(m)), - (unsigned long) m->header->serial, - (unsigned long) m->reply_serial, + (unsigned long) BUS_MESSAGE_COOKIE(m), + (unsigned long) m->reply_cookie, strna(m->error.message)); r = process_hello(bus, m); @@ -2235,7 +2235,7 @@ static int process_closing(sd_bus *bus, sd_bus_message **ret) { /* First, fail all outstanding method calls */ r = bus_message_new_synthetic_error( bus, - c->serial, + c->cookie, &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_NO_REPLY, "Connection terminated"), &m); if (r < 0) @@ -2248,7 +2248,7 @@ static int process_closing(sd_bus *bus, sd_bus_message **ret) { if (c->timeout != 0) prioq_remove(bus->reply_callbacks_prioq, c, &c->prioq_idx); - hashmap_remove(bus->reply_callbacks, &c->serial); + hashmap_remove(bus->reply_callbacks, &c->cookie); bus->current = m; bus->iteration_counter++; diff --git a/src/shared/capability.c b/src/shared/capability.c index f34f6ba6f6..72c671cf84 100644 --- a/src/shared/capability.c +++ b/src/shared/capability.c @@ -137,7 +137,7 @@ int capability_bounding_set_drop(uint64_t drop, bool right_now) { r = -errno; goto finish; } - v = i; + v = (cap_value_t) i; /* Also drop it from the inheritable set, so * that anything we exec() loses the diff --git a/src/shared/install.c b/src/shared/install.c index 5001ad43be..233d64b6e9 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1020,9 +1020,9 @@ static int unit_file_load( return r; return - strv_length(info->aliases) + - strv_length(info->wanted_by) + - strv_length(info->required_by); + (int) strv_length(info->aliases) + + (int) strv_length(info->wanted_by) + + (int) strv_length(info->required_by); } static int unit_file_search( @@ -1132,9 +1132,9 @@ static int unit_file_can_install( if (r >= 0) r = - strv_length(i->aliases) + - strv_length(i->wanted_by) + - strv_length(i->required_by); + (int) strv_length(i->aliases) + + (int) strv_length(i->wanted_by) + + (int) strv_length(i->required_by); return r; } diff --git a/src/shared/util.h b/src/shared/util.h index 57667ef895..b37072f24a 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -712,7 +712,7 @@ static inline void _reset_umask_(struct _umask_struct_ *s) { _saved_umask_.quit = true) static inline unsigned u64log2(uint64_t n) { - return (n > 1) ? __builtin_clzll(n) ^ 63U : 0; + return (n > 1) ? (unsigned) __builtin_clzll(n) ^ 63U : 0; } static inline bool logind_running(void) { diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index e757d1d45f..2e1fa964c9 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -126,11 +126,11 @@ int sd_bus_can_send(sd_bus *bus, char type); int sd_bus_get_server_id(sd_bus *bus, sd_id128_t *peer); int sd_bus_get_peer_creds(sd_bus *bus, uint64_t creds_mask, sd_bus_creds **ret); -int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *serial); -int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destination, uint64_t *serial); +int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *cookie); +int sd_bus_send_to(sd_bus *bus, sd_bus_message *m, const char *destination, uint64_t *cookie); int sd_bus_call(sd_bus *bus, sd_bus_message *m, uint64_t usec, sd_bus_error *ret_error, sd_bus_message **reply); -int sd_bus_call_async(sd_bus *bus, sd_bus_message *m, sd_bus_message_handler_t callback, void *userdata, uint64_t usec, uint64_t *serial); -int sd_bus_call_async_cancel(sd_bus *bus, uint64_t serial); +int sd_bus_call_async(sd_bus *bus, sd_bus_message *m, sd_bus_message_handler_t callback, void *userdata, uint64_t usec, uint64_t *cookie); +int sd_bus_call_async_cancel(sd_bus *bus, uint64_t cookie); int sd_bus_get_fd(sd_bus *bus); int sd_bus_get_events(sd_bus *bus); @@ -186,8 +186,8 @@ sd_bus_message* sd_bus_message_unref(sd_bus_message *m); sd_bus* sd_bus_message_get_bus(sd_bus_message *m); int sd_bus_message_get_type(sd_bus_message *m, uint8_t *type); -int sd_bus_message_get_serial(sd_bus_message *m, uint64_t *serial); -int sd_bus_message_get_reply_serial(sd_bus_message *m, uint64_t *serial); +int sd_bus_message_get_cookie(sd_bus_message *m, uint64_t *cookie); +int sd_bus_message_get_reply_cookie(sd_bus_message *m, uint64_t *cookie); int sd_bus_message_get_no_reply(sd_bus_message *m); int sd_bus_message_get_no_auto_start(sd_bus_message *m); |