diff options
Diffstat (limited to 'src')
37 files changed, 93 insertions, 92 deletions
diff --git a/src/bus-proxyd/bus-xml-policy.c b/src/bus-proxyd/bus-xml-policy.c index f7f3388ba9..f6ac0c0093 100644 --- a/src/bus-proxyd/bus-xml-policy.c +++ b/src/bus-proxyd/bus-xml-policy.c @@ -1129,7 +1129,7 @@ static void dump_items(PolicyItem *items, const char *prefix) { user = uid_to_name(i->uid); - printf("%sUser: %s (%d)\n", + printf("%sUser: %s ("UID_FMT")\n", prefix, strna(user), i->uid); } @@ -1138,7 +1138,7 @@ static void dump_items(PolicyItem *items, const char *prefix) { group = gid_to_name(i->gid); - printf("%sGroup: %s (%d)\n", + printf("%sGroup: %s ("GID_FMT")\n", prefix, strna(group), i->gid); } printf("%s-\n", prefix); diff --git a/src/core/automount.c b/src/core/automount.c index 90beb4daaa..51f7373f77 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -758,7 +758,7 @@ static int automount_dispatch_io(sd_event_source *s, int fd, uint32_t events, vo get_process_comm(packet.v5_packet.pid, &p); log_unit_info(UNIT(a)->id, - "Got automount request for %s, triggered by "PID_FMT" (%s)", + "Got automount request for %s, triggered by %"PRIu32" (%s)", a->where, packet.v5_packet.pid, strna(p)); } else log_unit_debug(UNIT(a)->id, "Got direct mount request on %s", a->where); diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 6181ba8248..8ba665dc3d 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -407,7 +407,7 @@ static int method_get_unit_by_pid(sd_bus *bus, sd_bus_message *message, void *us u = manager_get_unit_by_pid(m, pid); if (!u) - return sd_bus_error_setf(error, BUS_ERROR_NO_UNIT_FOR_PID, "PID %u does not belong to any loaded unit.", pid); + return sd_bus_error_setf(error, BUS_ERROR_NO_UNIT_FOR_PID, "PID "PID_FMT" does not belong to any loaded unit.", pid); r = mac_selinux_unit_access_check(u, message, "status", error); if (r < 0) diff --git a/src/core/manager.c b/src/core/manager.c index 64ff4644a8..947d431035 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2215,7 +2215,7 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool switching_root) { m->n_reloading ++; - fprintf(f, "current-job-id=%i\n", m->current_job_id); + fprintf(f, "current-job-id=%"PRIu32"\n", m->current_job_id); fprintf(f, "taint-usr=%s\n", yes_no(m->taint_usr)); fprintf(f, "n-installed-jobs=%u\n", m->n_installed_jobs); fprintf(f, "n-failed-jobs=%u\n", m->n_failed_jobs); diff --git a/src/hwdb/hwdb.c b/src/hwdb/hwdb.c index 4fce30da05..ff1220886c 100644 --- a/src/hwdb/hwdb.c +++ b/src/hwdb/hwdb.c @@ -420,7 +420,7 @@ static int trie_store(struct trie *trie, const char *filename) { } log_debug("=== trie on-disk ==="); - log_debug("size: %8"PRIu64" bytes", size); + log_debug("size: %8"PRIi64" bytes", size); log_debug("header: %8zu bytes", sizeof(struct trie_header_f)); log_debug("nodes: %8"PRIu64" bytes (%8"PRIu64")", t.nodes_count * sizeof(struct trie_node_f), t.nodes_count); diff --git a/src/journal-remote/journal-remote-parse.c b/src/journal-remote/journal-remote-parse.c index 76407f711b..d9dea8deb0 100644 --- a/src/journal-remote/journal-remote-parse.c +++ b/src/journal-remote/journal-remote-parse.c @@ -37,7 +37,7 @@ void source_free(RemoteSource *source) { free(source->buf); iovw_free_contents(&source->iovw); - log_debug("Writer ref count %u", source->writer->n_ref); + log_debug("Writer ref count %i", source->writer->n_ref); writer_unref(source->writer); sd_event_source_unref(source->event); @@ -125,8 +125,8 @@ static int get_line(RemoteSource *source, char **line, size_t *size) { source->size - source->filled); if (n < 0) { if (errno != EAGAIN && errno != EWOULDBLOCK) - log_error_errno(errno, "read(%d, ..., %zd): %m", source->fd, - source->size - source->filled); + log_error_errno(errno, "read(%d, ..., %zu): %m", source->fd, + source->size - source->filled); return -errno; } else if (n == 0) return 0; @@ -186,8 +186,8 @@ static int fill_fixed_size(RemoteSource *source, void **data, size_t size) { source->size - source->filled); if (n < 0) { if (errno != EAGAIN && errno != EWOULDBLOCK) - log_error_errno(errno, "read(%d, ..., %zd): %m", source->fd, - source->size - source->filled); + log_error_errno(errno, "read(%d, ..., %zu): %m", source->fd, + source->size - source->filled); return -errno; } else if (n == 0) return 0; diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 5050616d84..244d83d363 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -1021,7 +1021,7 @@ static int dispatch_raw_source_event(sd_event_source *event, if (remaining > 0) log_warning("Premature EOF. %zu bytes lost.", remaining); remove_source(s, source->fd); - log_info("%zd active sources remaining", s->active); + log_info("%zu active sources remaining", s->active); return 0; } else if (r == -E2BIG) { log_error("Entry too big, skipped"); diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 50332edcc7..75bb434c08 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -296,7 +296,7 @@ static size_t fd_input_callback(void *buf, size_t size, size_t nmemb, void *user return 0; r = read(u->input, buf, size * nmemb); - log_debug("%s: allowed %zu, read %zu", __func__, size*nmemb, r); + log_debug("%s: allowed %zu, read %zd", __func__, size*nmemb, r); if (r > 0) return r; @@ -505,15 +505,15 @@ static int perform_upload(Uploader *u) { } if (status >= 300) { - log_error("Upload to %s failed with code %lu: %s", + log_error("Upload to %s failed with code %ld: %s", u->url, status, strna(u->answer)); return -EIO; } else if (status < 200) { - log_error("Upload to %s finished with unexpected code %lu: %s", + log_error("Upload to %s finished with unexpected code %ld: %s", u->url, status, strna(u->answer)); return -EIO; } else - log_debug("Upload finished successfully with code %lu: %s", + log_debug("Upload finished successfully with code %ld: %s", status, strna(u->answer)); free(u->last_cursor); diff --git a/src/journal/compress.c b/src/journal/compress.c index 9440fcd60e..6923753f89 100644 --- a/src/journal/compress.c +++ b/src/journal/compress.c @@ -356,7 +356,7 @@ int compress_stream_xz(int fdf, int fdt, off_t max_bytes) { ret = lzma_easy_encoder(&s, LZMA_PRESET_DEFAULT, LZMA_CHECK_CRC64); if (ret != LZMA_OK) { - log_error("Failed to initialize XZ encoder: code %d", ret); + log_error("Failed to initialize XZ encoder: code %u", ret); return -EINVAL; } @@ -391,7 +391,7 @@ int compress_stream_xz(int fdf, int fdt, off_t max_bytes) { ret = lzma_code(&s, action); if (ret != LZMA_OK && ret != LZMA_STREAM_END) { - log_error("Compression failed: code %d", ret); + log_error("Compression failed: code %u", ret); return -EBADMSG; } @@ -512,7 +512,7 @@ int decompress_stream_xz(int fdf, int fdt, off_t max_bytes) { ret = lzma_stream_decoder(&s, UINT64_MAX, 0); if (ret != LZMA_OK) { - log_error("Failed to initialize XZ decoder: code %d", ret); + log_error("Failed to initialize XZ decoder: code %u", ret); return -ENOMEM; } @@ -538,7 +538,7 @@ int decompress_stream_xz(int fdf, int fdt, off_t max_bytes) { ret = lzma_code(&s, action); if (ret != LZMA_OK && ret != LZMA_STREAM_END) { - log_error("Decompression failed: code %d", ret); + log_error("Decompression failed: code %u", ret); return -EBADMSG; } diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c index 56a96c55dd..65fefd25ac 100644 --- a/src/journal/journal-send.c +++ b/src/journal/journal-send.c @@ -384,7 +384,7 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove memcpy(buffer + 8 + k - 2, ": ", 2); } - snprintf(error, sizeof(error), "ERRNO=%u", _saved_errno_); + snprintf(error, sizeof(error), "ERRNO=%i", _saved_errno_); char_array_0(error); IOVEC_SET_STRING(iov[skip+0], "PRIORITY=3"); diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c index 9d21738439..c2f1545cc9 100644 --- a/src/journal/journald-audit.c +++ b/src/journal/journald-audit.c @@ -360,7 +360,7 @@ static void process_audit_string(Server *s, int type, const char *data, size_t s if (!p) return; - if (sscanf(p, "(%" PRIi64 ".%" PRIi64 ":%" PRIi64 "):%n", + if (sscanf(p, "(%" PRIu64 ".%" PRIu64 ":%" PRIu64 "):%n", &seconds, &msec, &id, diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index dbecad4d9c..65e888adf2 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -1613,7 +1613,7 @@ int sd_dhcp_client_start(sd_dhcp_client *client) { r = client_start(client); if (r >= 0) - log_dhcp_client(client, "STARTED on ifindex %u", client->index); + log_dhcp_client(client, "STARTED on ifindex %i", client->index); return r; } diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c index afdf52fed4..8fba7ac679 100644 --- a/src/libsystemd/sd-bus/bus-dump.c +++ b/src/libsystemd/sd-bus/bus-dump.c @@ -69,7 +69,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) { if (flags & BUS_MESSAGE_DUMP_WITH_HEADER) { fprintf(f, - "%s%s%s Type=%s%s%s Endian=%c Flags=%u Version=%u Priority=%lli", + "%s%s%s Type=%s%s%s Endian=%c Flags=%u Version=%u Priority=%"PRIi64, m->header->type == SD_BUS_MESSAGE_METHOD_ERROR ? ansi_highlight_red() : m->header->type == SD_BUS_MESSAGE_METHOD_RETURN ? ansi_highlight_green() : m->header->type != SD_BUS_MESSAGE_SIGNAL ? ansi_highlight() : "", draw_special_char(DRAW_TRIANGULAR_BULLET), ansi_highlight_off(), @@ -77,7 +77,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) { m->header->endian, m->header->flags, m->header->version, - (long long) m->priority); + m->priority); /* Display synthetic message serial number in a more readable * format than (uint32_t) -1 */ diff --git a/src/libsystemd/sd-hwdb/sd-hwdb.c b/src/libsystemd/sd-hwdb/sd-hwdb.c index a16807f9d5..61c7b446b3 100644 --- a/src/libsystemd/sd-hwdb/sd-hwdb.c +++ b/src/libsystemd/sd-hwdb/sd-hwdb.c @@ -324,7 +324,7 @@ _public_ int sd_hwdb_new(sd_hwdb **ret) { log_debug("=== trie on-disk ==="); log_debug("tool version: %"PRIu64, le64toh(hwdb->head->tool_version)); - log_debug("file size: %8"PRIu64" bytes", hwdb->st.st_size); + log_debug("file size: %8"PRIi64" bytes", hwdb->st.st_size); log_debug("header size %8"PRIu64" bytes", le64toh(hwdb->head->header_size)); log_debug("strings %8"PRIu64" bytes", le64toh(hwdb->head->strings_len)); log_debug("nodes %8"PRIu64" bytes", le64toh(hwdb->head->nodes_len)); diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index 484613351d..1f44c341aa 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -1366,7 +1366,7 @@ static int socket_recv_message(int fd, struct iovec *iov, uint32_t *_group, bool if (ucred->pid == 0) auth = true; else - log_debug("rtnl: ignoring message from pid %u", ucred->pid); + log_debug("rtnl: ignoring message from PID "PID_FMT, ucred->pid); } else if (cmsg->cmsg_level == SOL_NETLINK && cmsg->cmsg_type == NETLINK_PKTINFO && cmsg->cmsg_len == CMSG_LEN(sizeof(struct nl_pktinfo))) { diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c index 825a0e10f4..a7446bff77 100644 --- a/src/libudev/libudev-device.c +++ b/src/libudev/libudev-device.c @@ -1686,7 +1686,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device) udev_device->id_filename = NULL; } else if (udev_device_get_ifindex(udev_device) > 0) { /* use netdev ifindex -- n3 */ - if (asprintf(&udev_device->id_filename, "n%u", udev_device_get_ifindex(udev_device)) < 0) + if (asprintf(&udev_device->id_filename, "n%i", udev_device_get_ifindex(udev_device)) < 0) udev_device->id_filename = NULL; } else { /* diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c index da2b63473f..4cfb2f617c 100644 --- a/src/libudev/libudev-monitor.c +++ b/src/libudev/libudev-monitor.c @@ -620,8 +620,8 @@ retry: } } else if (snl.nl.nl_groups == UDEV_MONITOR_KERNEL) { if (snl.nl.nl_pid > 0) { - log_debug("multicast kernel netlink message from pid %d ignored", - snl.nl.nl_pid); + log_debug("multicast kernel netlink message from PID %"PRIu32" ignored", + snl.nl.nl_pid); return NULL; } } @@ -634,7 +634,7 @@ retry: cred = (struct ucred *)CMSG_DATA(cmsg); if (cred->uid != 0) { - log_debug("sender uid=%d, message ignored", cred->uid); + log_debug("sender uid="UID_FMT", message ignored", cred->uid); return NULL; } diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 8eb5e3ee0a..197138c4e0 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -201,7 +201,7 @@ int seat_preallocate_vts(Seat *s) { q = vt_allocate(i); if (q < 0) { - log_error_errno(q, "Failed to preallocate VT %i: %m", i); + log_error_errno(q, "Failed to preallocate VT %u: %m", i); r = q; } } diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c index d5b29c8af4..d7a708fd0a 100644 --- a/src/login/pam_systemd.c +++ b/src/login/pam_systemd.c @@ -344,7 +344,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( } if (seat && !streq(seat, "seat0") && vtnr != 0) { - pam_syslog(handle, LOG_DEBUG, "Ignoring vtnr %d for %s which is not seat0", vtnr, seat); + pam_syslog(handle, LOG_DEBUG, "Ignoring vtnr %"PRIu32" for %s which is not seat0", vtnr, seat); vtnr = 0; } @@ -367,7 +367,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( if (debug) pam_syslog(handle, LOG_DEBUG, "Asking logind to create session: " - "uid=%u pid=%u service=%s type=%s class=%s desktop=%s seat=%s vtnr=%u tty=%s display=%s remote=%s remote_user=%s remote_host=%s", + "uid="UID_FMT" pid="PID_FMT" service=%s type=%s class=%s desktop=%s seat=%s vtnr=%"PRIu32" tty=%s display=%s remote=%s remote_user=%s remote_host=%s", pw->pw_uid, getpid(), strempty(service), type, class, strempty(desktop), diff --git a/src/login/test-inhibit.c b/src/login/test-inhibit.c index 5379ffcaa1..274687d20f 100644 --- a/src/login/test-inhibit.c +++ b/src/login/test-inhibit.c @@ -73,7 +73,7 @@ static void print_inhibitors(sd_bus *bus) { assert_se(r >= 0); while ((r = sd_bus_message_read(reply, "(ssssuu)", &what, &who, &why, &mode, &uid, &pid)) > 0) { - printf("what=<%s> who=<%s> why=<%s> mode=<%s> uid=<"UID_FMT"> pid=<"PID_FMT">\n", + printf("what=<%s> who=<%s> why=<%s> mode=<%s> uid=<%"PRIu32"> pid=<%"PRIu32">\n", what, who, why, mode, uid, pid); n++; diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c index 1ee1243f4d..d853f17772 100644 --- a/src/shared/install-printf.c +++ b/src/shared/install-printf.c @@ -103,7 +103,7 @@ static int specifier_user_name(char specifier, void *data, void *userdata, char if (r < 0) return r; - if (asprintf(&printed, "%d", uid) < 0) + if (asprintf(&printed, UID_FMT, uid) < 0) return -ENOMEM; break; }} diff --git a/src/shared/log.c b/src/shared/log.c index f8c16de777..a870415a00 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -330,7 +330,7 @@ static int write_to_console( highlight = LOG_PRI(level) <= LOG_ERR && show_color; if (show_location) { - snprintf(location, sizeof(location), "(%s:%u) ", file, line); + snprintf(location, sizeof(location), "(%s:%i) ", file, line); char_array_0(location); IOVEC_SET_STRING(iovec[n++], location); } @@ -1050,7 +1050,7 @@ void log_received_signal(int level, const struct signalfd_siginfo *si) { get_process_comm(si->ssi_pid, &p); log_full(level, - "Received SIG%s from PID "PID_FMT" (%s).", + "Received SIG%s from PID %"PRIu32" (%s).", signal_to_string(si->ssi_signo), si->ssi_pid, strna(p)); } else diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index ae14c6bd4d..1064fd5cbd 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -167,7 +167,7 @@ int can_sleep_disk(char **types) { static int hibernation_partition_size(size_t *size, size_t *used) { _cleanup_fclose_ FILE *f; - int i; + unsigned i; assert(size); assert(used); @@ -190,8 +190,8 @@ static int hibernation_partition_size(size_t *size, size_t *used) { k = fscanf(f, "%ms " /* device/file */ "%ms " /* type of swap */ - "%zd " /* swap size */ - "%zd " /* used */ + "%zu " /* swap size */ + "%zu " /* used */ "%*i\n", /* priority */ &dev, &type, &size_field, &used_field); if (k != 4) { diff --git a/src/shared/util.h b/src/shared/util.h index 2d03ac8fd0..179c9615f9 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -69,7 +69,7 @@ #endif #if SIZEOF_TIME_T == 8 -# define PRI_TIME PRIu64 +# define PRI_TIME PRIi64 #elif SIZEOF_TIME_T == 4 # define PRI_TIME PRIu32 #else diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index c02a76c6cd..cdc1a50e1a 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -3399,7 +3399,7 @@ static void print_status_info( continue; argv = strv_join(p->argv, " "); - printf(" Process: %u %s=%s ", p->pid, p->name, strna(argv)); + printf(" Process: "PID_FMT" %s=%s ", p->pid, p->name, strna(argv)); good = is_clean_exit_lsb(p->code, p->status, NULL); if (!good) { @@ -4292,7 +4292,7 @@ static int get_unit_dbus_path_by_pid( &reply, "u", pid); if (r < 0) { - log_error("Failed to get unit for PID "PID_FMT": %s", pid, bus_error_message(&error, r)); + log_error("Failed to get unit for PID %"PRIu32": %s", pid, bus_error_message(&error, r)); return r; } diff --git a/src/test/test-strxcpyx.c b/src/test/test-strxcpyx.c index cb2309210f..a7c8e1267d 100644 --- a/src/test/test-strxcpyx.c +++ b/src/test/test-strxcpyx.c @@ -48,7 +48,7 @@ static void test_strpcpyf(void) { size_t space_left; space_left = sizeof(target); - space_left = strpcpyf(&s, space_left, "space left: %zd. ", space_left); + space_left = strpcpyf(&s, space_left, "space left: %zu. ", space_left); space_left = strpcpyf(&s, space_left, "foo%s", "bar"); assert_se(streq(target, "space left: 25. foobar")); diff --git a/src/test/test-util.c b/src/test/test-util.c index 8471d310b2..a37316b9cb 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -603,7 +603,7 @@ static void test_get_process_comm(void) { r = get_process_environ(me, &env); assert_se(r >= 0 || r == -EACCES); - log_info("self strlen(environ): '%zd'", strlen(env)); + log_info("self strlen(environ): '%zu'", strlen(env)); if (!detect_container(NULL)) assert_se(get_ctty_devnr(1, &h) == -ENOENT); diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c index 548985ef70..03e3dc2867 100644 --- a/src/udev/udev-builtin-blkid.c +++ b/src/udev/udev-builtin-blkid.c @@ -273,7 +273,7 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t if (err < 0) goto out; - log_debug("probe %s %sraid offset=%"PRIu64, + log_debug("probe %s %sraid offset=%"PRIi64, udev_device_get_devnode(dev), noraid ? "no" : "", offset); diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c index 26c723225d..46f1c539d2 100644 --- a/src/udev/udev-builtin-input_id.c +++ b/src/udev/udev-builtin-input_id.c @@ -111,7 +111,7 @@ static void get_cap_mask(struct udev_device *dev, if (test) { /* printf pattern with the right unsigned long number of hex chars */ - snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2 * sizeof(unsigned long)); + snprintf(text, sizeof(text), " bit %%4u: %%0%zulX\n", 2 * sizeof(unsigned long)); log_debug("%s decoded bit map:", attr); val = bitmask_size / sizeof (unsigned long); /* skip over leading zeros */ diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c index 118e797c96..d8ee4cbb61 100644 --- a/src/udev/udev-builtin-keyboard.c +++ b/src/udev/udev-builtin-keyboard.c @@ -28,17 +28,17 @@ #include "udev.h" -static const struct key *keyboard_lookup_key(const char *str, unsigned int len); +static const struct key *keyboard_lookup_key(const char *str, unsigned len); #include "keyboard-keys-from-name.h" #include "keyboard-keys-to-name.h" -static int install_force_release(struct udev_device *dev, const unsigned int *release, unsigned int release_count) { +static int install_force_release(struct udev_device *dev, const unsigned *release, unsigned release_count) { struct udev_device *atkbd; const char *cur; char codes[4096]; char *s; size_t l; - unsigned int i; + unsigned i; int ret; atkbd = udev_device_get_parent_with_subsystem_devtype(dev, "serio", NULL); @@ -57,7 +57,7 @@ static int install_force_release(struct udev_device *dev, const unsigned int *re /* append new codes */ for (i = 0; i < release_count; i++) - l = strpcpyf(&s, l, ",%d", release[i]); + l = strpcpyf(&s, l, ",%u", release[i]); log_debug("keyboard: updating force-release list with '%s'", codes); ret = udev_device_set_sysattr_value(atkbd, "force_release", codes); @@ -69,16 +69,16 @@ static int install_force_release(struct udev_device *dev, const unsigned int *re static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev_list_entry *entry; struct { - unsigned int scan; - unsigned int key; + unsigned scan; + unsigned key; } map[1024]; - unsigned int map_count = 0; - unsigned int release[1024]; - unsigned int release_count = 0; + unsigned map_count = 0; + unsigned release[1024]; + unsigned release_count = 0; udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) { const char *key; - unsigned int scancode, keycode_num; + unsigned scancode, keycode_num; char *endptr; const char *keycode; const struct key *k; @@ -130,7 +130,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo if (map_count > 0 || release_count > 0) { const char *node; int fd; - unsigned int i; + unsigned i; node = udev_device_get_devnode(dev); if (!node) { diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 2e08467019..c310111eb9 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -191,12 +191,12 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { s = names->pci_path; l = sizeof(names->pci_path); if (domain > 0) - l = strpcpyf(&s, l, "P%d", domain); - l = strpcpyf(&s, l, "p%ds%d", bus, slot); + l = strpcpyf(&s, l, "P%u", domain); + l = strpcpyf(&s, l, "p%us%u", bus, slot); if (func > 0 || is_pci_multifunction(names->pcidev)) - l = strpcpyf(&s, l, "f%d", func); + l = strpcpyf(&s, l, "f%u", func); if (dev_port > 0) - l = strpcpyf(&s, l, "d%d", dev_port); + l = strpcpyf(&s, l, "d%u", dev_port); if (l == 0) names->pci_path[0] = '\0'; diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index 9cece4a85d..538b342865 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -198,7 +198,7 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) { goto err; } if (ucred.uid > 0) { - log_error("sender uid=%i, message ignored", ucred.uid); + log_error("sender uid="UID_FMT", message ignored", ucred.uid); goto err; } @@ -386,7 +386,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) { } if (cred->uid != 0) { - log_error("sender uid=%i, message ignored", cred->uid); + log_error("sender uid="UID_FMT", message ignored", cred->uid); goto err; } diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index 6b184303d8..beb09439c7 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -218,14 +218,14 @@ subst: case SUBST_MAJOR: { char num[UTIL_PATH_SIZE]; - sprintf(num, "%d", major(udev_device_get_devnum(dev))); + sprintf(num, "%u", major(udev_device_get_devnum(dev))); l = strpcpy(&s, l, num); break; } case SUBST_MINOR: { char num[UTIL_PATH_SIZE]; - sprintf(num, "%d", minor(udev_device_get_devnum(dev))); + sprintf(num, "%u", minor(udev_device_get_devnum(dev))); l = strpcpy(&s, l, num); break; } @@ -509,7 +509,7 @@ static void spawn_read(struct udev_event *event, memcpy(&result[respos], buf, count); respos += count; } else { - log_error("'%s' ressize %zd too short", cmd, ressize); + log_error("'%s' ressize %zu too short", cmd, ressize); } } @@ -580,7 +580,7 @@ static int spawn_wait(struct udev_event *event, goto out; } if (fdcount == 0) { - log_warning("slow: '%s' [%u]", cmd, pid); + log_warning("slow: '%s' ["PID_FMT"]", cmd, pid); fdcount = poll(pfd, 1, timeout); if (fdcount < 0) { @@ -591,7 +591,7 @@ static int spawn_wait(struct udev_event *event, goto out; } if (fdcount == 0) { - log_error("timeout: killing '%s' [%u]", cmd, pid); + log_error("timeout: killing '%s' ["PID_FMT"]", cmd, pid); kill(pid, SIGKILL); } } @@ -613,20 +613,20 @@ static int spawn_wait(struct udev_event *event, if (waitpid(pid, &status, WNOHANG) < 0) break; if (WIFEXITED(status)) { - log_debug("'%s' [%u] exit with return code %i", cmd, pid, WEXITSTATUS(status)); + log_debug("'%s' ["PID_FMT"] exit with return code %i", cmd, pid, WEXITSTATUS(status)); if (WEXITSTATUS(status) != 0) err = -1; } else if (WIFSIGNALED(status)) { - log_error("'%s' [%u] terminated by signal %i (%s)", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status))); + log_error("'%s' ["PID_FMT"] terminated by signal %i (%s)", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status))); err = -1; } else if (WIFSTOPPED(status)) { - log_error("'%s' [%u] stopped", cmd, pid); + log_error("'%s' ["PID_FMT"] stopped", cmd, pid); err = -1; } else if (WIFCONTINUED(status)) { - log_error("'%s' [%u] continued", cmd, pid); + log_error("'%s' ["PID_FMT"] continued", cmd, pid); err = -1; } else { - log_error("'%s' [%u] exit with status 0x%04x", cmd, pid, status); + log_error("'%s' ["PID_FMT"] exit with status 0x%04x", cmd, pid, status); err = -1; } pid = 0; diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c index 499feefceb..793b48469d 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -341,7 +341,7 @@ void udev_node_add(struct udev_device *dev, bool apply, char filename[UTIL_PATH_SIZE]; struct udev_list_entry *list_entry; - log_debug("handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d", + log_debug("handling device node '%s', devnum=%s, mode=%#o, uid="UID_FMT", gid="GID_FMT, udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid); if (node_permissions_apply(dev, apply, mode, uid, gid, seclabel_list) < 0) diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index 7a2114a3a1..d65e40c011 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -401,7 +401,7 @@ static int trie_store(struct trie *trie, const char *filename) { } log_debug("=== trie on-disk ==="); - log_debug("size: %8"PRIu64" bytes", size); + log_debug("size: %8"PRIi64" bytes", size); log_debug("header: %8zu bytes", sizeof(struct trie_header_f)); log_debug("nodes: %8"PRIu64" bytes (%8"PRIu64")", t.nodes_count * sizeof(struct trie_node_f), t.nodes_count); diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c index f52a03dfd0..0bab01a234 100644 --- a/src/udev/udevadm-info.c +++ b/src/udev/udevadm-info.c @@ -162,12 +162,12 @@ static int stat_device(const char *name, bool export, const char *prefix) { if (export) { if (prefix == NULL) prefix = "INFO_"; - printf("%sMAJOR=%d\n" - "%sMINOR=%d\n", + printf("%sMAJOR=%u\n" + "%sMINOR=%u\n", prefix, major(statbuf.st_dev), prefix, minor(statbuf.st_dev)); } else - printf("%d:%d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); + printf("%u:%u\n", major(statbuf.st_dev), minor(statbuf.st_dev)); return 0; } diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 009e39523c..009e2fed75 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -158,7 +158,7 @@ static void worker_unref(struct worker *worker) { worker->refcount--; if (worker->refcount > 0) return; - log_debug("worker [%u] cleaned up", worker->pid); + log_debug("worker ["PID_FMT"] cleaned up", worker->pid); worker_cleanup(worker); } @@ -414,7 +414,7 @@ out: event->state = EVENT_RUNNING; udev_list_node_append(&worker->node, &worker_list); children++; - log_debug("seq %llu forked new worker [%u]", udev_device_get_seqnum(event->dev), pid); + log_debug("seq %llu forked new worker ["PID_FMT"]", udev_device_get_seqnum(event->dev), pid); break; } } @@ -431,7 +431,8 @@ static void event_run(struct event *event) { count = udev_monitor_send_device(monitor, worker->monitor, event->dev); if (count < 0) { - log_error_errno(errno, "worker [%u] did not accept message %zi (%m), kill it", worker->pid, count); + log_error_errno(errno, "worker ["PID_FMT"] did not accept message %zi (%m), kill it", + worker->pid, count); kill(worker->pid, SIGKILL); worker->state = WORKER_KILLED; continue; @@ -869,26 +870,26 @@ static void handle_signal(struct udev *udev, int signo) { if (worker->pid != pid) continue; - log_debug("worker [%u] exit", pid); + log_debug("worker ["PID_FMT"] exit", pid); if (WIFEXITED(status)) { if (WEXITSTATUS(status) != 0) - log_error("worker [%u] exit with return code %i", + log_error("worker ["PID_FMT"] exit with return code %i", pid, WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { - log_error("worker [%u] terminated by signal %i (%s)", + log_error("worker ["PID_FMT"] terminated by signal %i (%s)", pid, WTERMSIG(status), strsignal(WTERMSIG(status))); } else if (WIFSTOPPED(status)) { - log_error("worker [%u] stopped", pid); + log_error("worker ["PID_FMT"] stopped", pid); } else if (WIFCONTINUED(status)) { - log_error("worker [%u] continued", pid); + log_error("worker ["PID_FMT"] continued", pid); } else { - log_error("worker [%u] exit with status 0x%04x", pid, status); + log_error("worker ["PID_FMT"] exit with status 0x%04x", pid, status); } if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { if (worker->event) { - log_error("worker [%u] failed while handling '%s'", + log_error("worker ["PID_FMT"] failed while handling '%s'", pid, worker->event->devpath); worker->event->exitcode = -32; event_queue_delete(worker->event); @@ -1409,7 +1410,7 @@ int main(int argc, char *argv[]) { if ((ts - worker->event_start_usec) > arg_event_timeout_warn_usec) { if ((ts - worker->event_start_usec) > arg_event_timeout_usec) { - log_error("worker [%u] %s timeout; kill it", worker->pid, worker->event->devpath); + log_error("worker ["PID_FMT"] %s timeout; kill it", worker->pid, worker->event->devpath); kill(worker->pid, SIGKILL); worker->state = WORKER_KILLED; @@ -1420,7 +1421,7 @@ int main(int argc, char *argv[]) { event_queue_delete(worker->event); worker->event = NULL; } else if (!worker->event_warned) { - log_warning("worker [%u] %s is taking a long time", worker->pid, worker->event->devpath); + log_warning("worker ["PID_FMT"] %s is taking a long time", worker->pid, worker->event->devpath); worker->event_warned = true; } } |