AC_CHECK_SIZEOF(pid_t)
AC_CHECK_SIZEOF(uid_t)
AC_CHECK_SIZEOF(gid_t)
+AC_CHECK_SIZEOF(time_t)
+AC_CHECK_SIZEOF(rlim_t,,[
+ #include <sys/time.h>
+ #include <sys/resource.h>
+])
# ------------------------------------------------------------------------------
# we use python to build the man page index, and for systemd-python
cap_value_t value;
FILE *f;
char line[LINE_MAX];
- unsigned long long capabilities = (unsigned long long) -1;
+ unsigned long long capabilities = -1;
assert(c);
assert(c->parameter);
if (r < 0)
return r;
- unit_write_drop_in_format(UNIT(s), mode, name, "[Scope]\nTimeoutStopSec=%lluus\n", (unsigned long long) s->timeout_stop_usec);
+ unit_write_drop_in_format(UNIT(s), mode, name, "[Scope]\nTimeoutStopSec="USEC_FMT"us\n", s->timeout_stop_usec);
} else {
r = sd_bus_message_skip(message, "t");
if (r < 0)
return -ENOMEM;
our_env[n_env++] = x;
- if (asprintf(&x, "WATCHDOG_USEC=%llu", (unsigned long long) watchdog_usec) < 0)
+ if (asprintf(&x, "WATCHDOG_USEC="USEC_FMT, watchdog_usec) < 0)
return -ENOMEM;
our_env[n_env++] = x;
}
for (i = 0; i < RLIM_NLIMITS; i++)
if (c->rlimit[i])
- fprintf(f, "%s%s: %llu\n", prefix, rlimit_to_string(i), (unsigned long long) c->rlimit[i]->rlim_max);
+ fprintf(f, "%s%s: "RLIM_FMT"\n",
+ prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
if (c->ioprio_set) {
_cleanup_free_ char *class_str = NULL;
if (s->control_pid > 0)
fprintf(f,
- "%sControl PID: %lu\n",
- prefix, (unsigned long) s->control_pid);
+ "%sControl PID: "PID_FMT"\n",
+ prefix, s->control_pid);
if (s->bind_to_device)
fprintf(f,
unit_serialize_item_format(u, f, "n-accepted", "%u", s->n_accepted);
if (s->control_pid > 0)
- unit_serialize_item_format(u, f, "control-pid", "%lu", (unsigned long) s->control_pid);
+ unit_serialize_item_format(u, f, "control-pid", PID_FMT, s->control_pid);
if (s->control_command_id >= 0)
unit_serialize_item(u, f, "control-command", socket_exec_command_to_string(s->control_command_id));
if (s->control_pid > 0)
fprintf(f,
- "%sControl PID: %lu\n",
- prefix, (unsigned long) s->control_pid);
+ "%sControl PID: "PID_FMT"\n",
+ prefix, s->control_pid);
exec_context_dump(&s->exec_context, f, prefix);
kill_context_dump(&s->kill_context, f, prefix);
unit_serialize_item(u, f, "result", swap_result_to_string(s->result));
if (s->control_pid > 0)
- unit_serialize_item_format(u, f, "control-pid", "%lu", (unsigned long) s->control_pid);
+ unit_serialize_item_format(u, f, "control-pid", PID_FMT, s->control_pid);
if (s->control_command_id >= 0)
unit_serialize_item(u, f, "control-command", swap_exec_command_to_string(s->control_command_id));
if (r < 0)
return -ENODATA;
- asprintf(&printed, "%lu", (unsigned long) uid);
+ asprintf(&printed, UID_FMT, uid);
}
}
if (specifier == 'u')
printed = strdup(username);
else
- asprintf(&printed, "%lu", (unsigned long) uid);
+ asprintf(&printed, UID_FMT, uid);
}
if (!printed)
}
fprintf(f, "Environment=DBUS_STARTER_ADDRESS="KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT "\n",
- (unsigned long) getuid(), run);
+ getuid(), run);
}
}
if (server_init(&server, (unsigned) n) < 0)
return EXIT_FAILURE;
- log_debug("systemd-initctl running as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-initctl running as pid "PID_FMT, getpid());
sd_notify(false,
"READY=1\n"
r = EXIT_SUCCESS;
- log_debug("systemd-initctl stopped as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-initctl stopped as pid "PID_FMT, getpid());
fail:
sd_notify(false,
if (remoteserver_init(&s) < 0)
return EXIT_FAILURE;
- log_debug("%s running as pid %lu",
- program_invocation_short_name, (unsigned long) getpid());
+ log_debug("%s running as pid "PID_FMT,
+ program_invocation_short_name, getpid());
sd_notify(false,
"READY=1\n"
"STATUS=Processing requests...");
/* First: timestamp */
if (prefix_timestamp()) {
assert_se(clock_gettime(CLOCK_MONOTONIC, &ts) == 0);
- snprintf(tbuf, sizeof(tbuf), "[%5llu.%06llu] ",
- (unsigned long long) ts.tv_sec,
- (unsigned long long) ts.tv_nsec / 1000);
+ snprintf(tbuf, sizeof(tbuf), "[%5"PRI_TIME".%06ld] ",
+ ts.tv_sec,
+ ts.tv_nsec / 1000);
IOVEC_SET_STRING(iovec[n++], tbuf);
}
identifier = ident_buf;
}
- snprintf(header_pid, sizeof(header_pid), "[%lu]: ", (unsigned long) ucred->pid);
+ snprintf(header_pid, sizeof(header_pid), "["PID_FMT"]: ", ucred->pid);
char_array_0(header_pid);
if (identifier)
identifier = ident_buf;
}
- snprintf(header_pid, sizeof(header_pid), "[%lu]: ", (unsigned long) ucred->pid);
+ snprintf(header_pid, sizeof(header_pid), "["PID_FMT"]: ", ucred->pid);
char_array_0(header_pid);
if (identifier)
if (f)
return f;
- if (asprintf(&p, "/var/log/journal/" SD_ID128_FORMAT_STR "/user-%lu.journal",
- SD_ID128_FORMAT_VAL(machine), (unsigned long) uid) < 0)
+ if (asprintf(&p, "/var/log/journal/" SD_ID128_FORMAT_STR "/user-"UID_FMT".journal",
+ SD_ID128_FORMAT_VAL(machine), uid) < 0)
return s->system_journal;
while (hashmap_size(s->user_journals) >= USER_JOURNALS_MAX) {
if (ucred) {
realuid = ucred->uid;
- sprintf(pid, "_PID=%lu", (unsigned long) ucred->pid);
+ sprintf(pid, "_PID="PID_FMT, ucred->pid);
IOVEC_SET_STRING(iovec[n++], pid);
- sprintf(uid, "_UID=%lu", (unsigned long) ucred->uid);
+ sprintf(uid, "_UID="UID_FMT, ucred->uid);
IOVEC_SET_STRING(iovec[n++], uid);
- sprintf(gid, "_GID=%lu", (unsigned long) ucred->gid);
+ sprintf(gid, "_GID="GID_FMT, ucred->gid);
IOVEC_SET_STRING(iovec[n++], gid);
r = get_process_comm(ucred->pid, &t);
#ifdef HAVE_AUDIT
r = audit_session_from_pid(ucred->pid, &audit);
if (r >= 0) {
- sprintf(audit_session, "_AUDIT_SESSION=%lu", (unsigned long) audit);
+ sprintf(audit_session, "_AUDIT_SESSION=%"PRIu32, audit);
IOVEC_SET_STRING(iovec[n++], audit_session);
}
r = audit_loginuid_from_pid(ucred->pid, &loginuid);
if (r >= 0) {
- sprintf(audit_loginuid, "_AUDIT_LOGINUID=%lu", (unsigned long) loginuid);
+ sprintf(audit_loginuid, "_AUDIT_LOGINUID="UID_FMT, loginuid);
IOVEC_SET_STRING(iovec[n++], audit_loginuid);
}
#endif
if (cg_path_get_owner_uid(c, &owner) >= 0) {
owner_valid = true;
- sprintf(owner_uid, "_SYSTEMD_OWNER_UID=%lu", (unsigned long) owner);
+ sprintf(owner_uid, "_SYSTEMD_OWNER_UID="UID_FMT, owner);
IOVEC_SET_STRING(iovec[n++], owner_uid);
}
if (object_pid) {
r = get_process_uid(object_pid, &object_uid);
if (r >= 0) {
- sprintf(o_uid, "OBJECT_UID=%lu", (unsigned long) object_uid);
+ sprintf(o_uid, "OBJECT_UID="UID_FMT, object_uid);
IOVEC_SET_STRING(iovec[n++], o_uid);
}
r = get_process_gid(object_pid, &object_gid);
if (r >= 0) {
- sprintf(o_gid, "OBJECT_GID=%lu", (unsigned long) object_gid);
+ sprintf(o_gid, "OBJECT_GID="GID_FMT, object_gid);
IOVEC_SET_STRING(iovec[n++], o_gid);
}
#ifdef HAVE_AUDIT
r = audit_session_from_pid(object_pid, &audit);
if (r >= 0) {
- sprintf(o_audit_session, "OBJECT_AUDIT_SESSION=%lu", (unsigned long) audit);
+ sprintf(o_audit_session, "OBJECT_AUDIT_SESSION=%"PRIu32, audit);
IOVEC_SET_STRING(iovec[n++], o_audit_session);
}
r = audit_loginuid_from_pid(object_pid, &loginuid);
if (r >= 0) {
- sprintf(o_audit_loginuid, "OBJECT_AUDIT_LOGINUID=%lu", (unsigned long) loginuid);
+ sprintf(o_audit_loginuid, "OBJECT_AUDIT_LOGINUID="UID_FMT, loginuid);
IOVEC_SET_STRING(iovec[n++], o_audit_loginuid);
}
#endif
}
if (cg_path_get_owner_uid(c, &owner) >= 0) {
- sprintf(o_owner_uid, "OBJECT_SYSTEMD_OWNER_UID=%lu", (unsigned long) owner);
+ sprintf(o_owner_uid, "OBJECT_SYSTEMD_OWNER_UID="UID_FMT, owner);
IOVEC_SET_STRING(iovec[n++], o_owner_uid);
}
identifier = ident_buf;
}
- snprintf(header_pid, sizeof(header_pid), "[%lu]: ", (unsigned long) ucred->pid);
+ snprintf(header_pid, sizeof(header_pid), "["PID_FMT"]: ", ucred->pid);
char_array_0(header_pid);
if (identifier)
server_flush_to_var(&server);
server_flush_dev_kmsg(&server);
- log_debug("systemd-journald running as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-journald running as pid "PID_FMT, getpid());
server_driver_message(&server, SD_MESSAGE_JOURNAL_START, "Journal started");
sd_notify(false,
server_maybe_warn_forward_syslog_missed(&server);
}
- log_debug("systemd-journald stopped as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-journald stopped as pid "PID_FMT, getpid());
server_driver_message(&server, SD_MESSAGE_JOURNAL_STOP, "Journal stopped");
finish:
if (flags & SD_JOURNAL_CURRENT_USER) {
char prefix[5 + DECIMAL_STR_MAX(uid_t) + 1];
- assert_se(snprintf(prefix, sizeof(prefix), "user-%lu", (unsigned long) getuid())
+ assert_se(snprintf(prefix, sizeof(prefix), "user-"UID_FMT, getuid())
< (int) sizeof(prefix));
if (file_has_type_prefix(prefix, filename))
if (tid > 0 && (missing & SD_BUS_CREDS_TID_COMM)) {
_cleanup_free_ char *p = NULL;
- if (asprintf(&p, "/proc/%lu/task/%lu/comm", (unsigned long) pid, (unsigned long) tid) < 0)
+ if (asprintf(&p, "/proc/"PID_FMT"/task/"PID_FMT"/comm", pid, tid) < 0)
return -ENOMEM;
r = read_one_line_file(p, &c->tid_comm);
ansi_highlight_red(), strna(m->error.message), ansi_highlight_off());
if (m->monotonic != 0)
- fprintf(f, " Monotonic=%llu", (unsigned long long) m->monotonic);
+ fprintf(f, " Monotonic="USEC_FMT, m->monotonic);
if (m->realtime != 0)
- fprintf(f, " Realtime=%llu", (unsigned long long) m->realtime);
+ fprintf(f, " Realtime="USEC_FMT, m->realtime);
if (m->seqnum != 0)
- fprintf(f, " SequenceNumber=%llu", (unsigned long long) m->seqnum);
+ fprintf(f, " SequenceNumber=%"PRIu64, m->seqnum);
if (m->monotonic != 0 || m->realtime != 0 || m->seqnum != 0)
fputs("\n", f);
break;
case SD_BUS_TYPE_INT64:
- fprintf(f, "%sINT64 %s%lli%s;\n", prefix, ansi_highlight(), (long long) basic.s64, ansi_highlight_off());
+ fprintf(f, "%sINT64 %s%"PRIi64"%s;\n", prefix, ansi_highlight(), basic.s64, ansi_highlight_off());
break;
case SD_BUS_TYPE_UINT64:
- fprintf(f, "%sUINT64 %s%llu%s;\n", prefix, ansi_highlight(), (unsigned long long) basic.u64, ansi_highlight_off());
+ fprintf(f, "%sUINT64 %s%"PRIu64"%s;\n", prefix, ansi_highlight(), basic.u64, ansi_highlight_off());
break;
case SD_BUS_TYPE_DOUBLE:
f = stdout;
if (c->mask & SD_BUS_CREDS_PID)
- fprintf(f, " PID=%lu", (unsigned long) c->pid);
+ fprintf(f, " PID="PID_FMT, c->pid);
if (c->mask & SD_BUS_CREDS_PID_STARTTIME)
- fprintf(f, " PIDStartTime=%llu", (unsigned long long) c->pid_starttime);
+ fprintf(f, " PIDStartTime="USEC_FMT, c->pid_starttime);
if (c->mask & SD_BUS_CREDS_TID)
- fprintf(f, " TID=%lu", (unsigned long) c->tid);
+ fprintf(f, " TID="PID_FMT, c->tid);
if (c->mask & SD_BUS_CREDS_UID)
- fprintf(f, " UID=%lu", (unsigned long) c->uid);
+ fprintf(f, " UID="UID_FMT, c->uid);
r = sd_bus_creds_get_owner_uid(c, &owner);
if (r >= 0)
- fprintf(f, " OwnerUID=%lu", (unsigned long) owner);
+ fprintf(f, " OwnerUID="UID_FMT, owner);
if (c->mask & SD_BUS_CREDS_GID)
- fprintf(f, " GID=%lu", (unsigned long) c->gid);
+ fprintf(f, " GID="GID_FMT, c->gid);
if ((c->mask & (SD_BUS_CREDS_PID|SD_BUS_CREDS_PID_STARTTIME|SD_BUS_CREDS_TID|SD_BUS_CREDS_UID|SD_BUS_CREDS_GID)) || r >= 0)
fputs("\n", f);
if (sd_bus_creds_get_audit_login_uid(c, &audit_loginuid) >= 0) {
audit_loginuid_is_set = true;
- fprintf(f, " AuditLoginUID=%lu", (unsigned long) audit_loginuid);
+ fprintf(f, " AuditLoginUID="UID_FMT, audit_loginuid);
}
if (sd_bus_creds_get_audit_session_id(c, &audit_sessionid) >= 0) {
audit_sessionid_is_set = true;
- fprintf(f, " AuditSessionID=%lu", (unsigned long) audit_sessionid);
+ fprintf(f, " AuditSessionID=%"PRIu32, audit_sessionid);
}
if (audit_loginuid_is_set || audit_sessionid_is_set)
make->size += ALIGN8(n->size);
n = KDBUS_ITEM_NEXT(n);
- sprintf(n->str, "%lu-%s", (unsigned long) getuid(), name);
+ sprintf(n->str, UID_FMT"-%s", getuid(), name);
n->size = offsetof(struct kdbus_item, str) + strlen(n->str) + 1;
n->type = KDBUS_ITEM_MAKE_NAME;
make->size += ALIGN8(n->size);
assert(name);
p = alloca(strlen("/dev/kdbus/") + DECIMAL_STR_MAX(uid_t) + 1 + strlen(bus) + strlen("/bus") + 1);
- sprintf(p, "/dev/kdbus/%lu-%s/bus", (unsigned long) getuid(), bus);
+ sprintf(p, "/dev/kdbus/"UID_FMT"-%s/bus", getuid(), bus);
fd = open(p, O_RDWR|O_NOCTTY|O_CLOEXEC);
if (fd < 0)
assert(bus);
p = alloca(strlen("/dev/kdbus/") + DECIMAL_STR_MAX(uid_t) + 1 + strlen(bus) + strlen("/bus") + 1);
- sprintf(p, "/dev/kdbus/%lu-%s/bus", (unsigned long) getuid(), bus);
+ sprintf(p, "/dev/kdbus/"UID_FMT"-%s/bus", getuid(), bus);
fd = open(p, O_RDWR|O_NOCTTY|O_CLOEXEC);
if (fd < 0)
auth_prefix = "\0AUTH EXTERNAL ";
- snprintf(text, sizeof(text), "%lu", (unsigned long) geteuid());
+ snprintf(text, sizeof(text), UID_FMT, geteuid());
char_array_0(text);
l = strlen(text);
if (r < 0)
return r;
- if (asprintf(&bus->address, KERNEL_USER_BUS_FMT, (unsigned long) getuid()) < 0)
+ if (asprintf(&bus->address, KERNEL_USER_BUS_FMT, getuid()) < 0)
return -ENOMEM;
bus->bus_client = true;
return -ENOMEM;
#ifdef ENABLE_KDBUS
- asprintf(&b->address, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT, (unsigned long) getuid(), ee);
+ asprintf(&b->address, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT, getuid(), ee);
#else
asprintf(&b->address, UNIX_USER_BUS_FMT, ee);
#endif
} else {
#ifdef ENABLE_KDBUS
- asprintf(&b->address, KERNEL_USER_BUS_FMT, (unsigned long) getuid());
+ asprintf(&b->address, KERNEL_USER_BUS_FMT, getuid());
#else
return -ECONNREFUSED;
#endif
sd_bus_creds_get_pid(sd_bus_message_get_creds(m), &pid);
sd_bus_creds_get_selinux_context(sd_bus_message_get_creds(m), &label);
- log_info("Got message! member=%s pid=%lu label=%s",
+ log_info("Got message! member=%s pid="PID_FMT" label=%s",
strna(sd_bus_message_get_member(m)),
- (unsigned long) pid,
+ pid,
strna(label));
/* bus_message_dump(m); */
/* sd_bus_message_rewind(m, true); */
h = hexmem(buffer, sz);
assert_se(h);
- log_info("message size = %lu, contents =\n%s", (unsigned long) sz, h);
+ log_info("message size = %zu, contents =\n%s", sz, h);
free(h);
#ifdef HAVE_GLIB
assert_return(state, -EINVAL);
- if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) uid) < 0)
+ if (asprintf(&p, "/run/systemd/users/"UID_FMT, uid) < 0)
return -ENOMEM;
r = parse_env_file(p, NEWLINE, "STATE", &s, NULL);
if (!s)
return -EIO;
- if (asprintf(&t, "%lu", (unsigned long) uid) < 0)
+ if (asprintf(&t, UID_FMT, uid) < 0)
return -ENOMEM;
FOREACH_WORD(w, l, s, state) {
char **a;
int r;
- if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) uid) < 0)
+ if (asprintf(&p, "/run/systemd/users/"UID_FMT, uid) < 0)
return -ENOMEM;
r = parse_env_file(p, NEWLINE,
printf("session = %s\n", session);
assert_se(sd_pid_get_owner_uid(0, &u2) == 0);
- printf("user = %lu\n", (unsigned long) u2);
+ printf("user = "UID_FMT"\n", u2);
assert_se(socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == 0);
sd_peer_get_session(pair[0], &pp);
free(state);
assert_se(sd_session_get_uid(session, &u) >= 0);
- printf("uid = %lu\n", (unsigned long) u);
+ printf("uid = "UID_FMT"\n", u);
assert_se(u == u2);
assert_se(sd_session_get_type(session, &type) >= 0);
assert_se(sd_seat_get_active(seat, &session2, &u2) >= 0);
printf("session2 = %s\n", session2);
- printf("uid2 = %lu\n", (unsigned long) u2);
+ printf("uid2 = "UID_FMT"\n", u2);
r = sd_seat_get_sessions(seat, &sessions, &uids, &n);
assert_se(r >= 0);
free(t);
printf("uids =");
for (k = 0; k < (int) n; k++)
- printf(" %lu", (unsigned long) uids[k]);
+ printf(" "UID_FMT, uids[k]);
printf("\n");
free(uids);
printf("uids =");
for (k = 0; k < r; k++)
- printf(" %lu", (unsigned long) uids[k]);
+ printf(" "UID_FMT, uids[k]);
printf("\n");
free(uids);
}
if (udev_device_get_usec_initialized(udev_device) > 0)
- fprintf(f, "I:%llu\n", (unsigned long long)udev_device_get_usec_initialized(udev_device));
+ fprintf(f, "I:"USEC_FMT"\n", udev_device_get_usec_initialized(udev_device));
udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) {
if (!udev_list_entry_get_num(list_entry))
char num[32];
udev_device->usec_initialized = usec_initialized;
- snprintf(num, sizeof(num), "%llu", (unsigned long long)usec_initialized);
+ snprintf(num, sizeof(num), USEC_FMT, usec_initialized);
udev_device_add_property(udev_device, "USEC_INITIALIZED", num);
}
udev_dbg(udev, "=== trie on-disk ===\n");
udev_dbg(udev, "tool version: %"PRIu64, le64toh(hwdb->head->tool_version));
- udev_dbg(udev, "file size: %8llu bytes\n", (unsigned long long) hwdb->st.st_size);
+ udev_dbg(udev, "file size: %8zu bytes\n", hwdb->st.st_size);
udev_dbg(udev, "header size %8"PRIu64" bytes\n", le64toh(hwdb->head->header_size));
udev_dbg(udev, "strings %8"PRIu64" bytes\n", le64toh(hwdb->head->strings_len));
udev_dbg(udev, "nodes %8"PRIu64" bytes\n", le64toh(hwdb->head->nodes_len));
get_process_comm(pid, &comm);
u = uid_to_name(uid);
- printf(" Who: %s (UID %lu/%s, PID %lu/%s)\n"
+ printf(" Who: %s (UID "UID_FMT"/%s, PID "PID_FMT"/%s)\n"
" What: %s\n"
" Why: %s\n"
" Mode: %s\n\n",
- who, (unsigned long) uid, strna(u), (unsigned long) pid, strna(comm),
+ who, uid, strna(u), pid, strna(comm),
what,
why,
mode);
/* If this is just a recheck of the lid switch then don't warn about anything */
if (!is_edge) {
- log_debug("Refusing operation, %s is inhibited by UID %lu/%s, PID %lu/%s.",
+ log_debug("Refusing operation, %s is inhibited by UID "UID_FMT"/%s, PID "PID_FMT"/%s.",
inhibit_what_to_string(inhibit_operation),
- (unsigned long) offending->uid, strna(u),
- (unsigned long) offending->pid, strna(comm));
+ offending->uid, strna(u),
+ offending->pid, strna(comm));
return 0;
}
- log_error("Refusing operation, %s is inhibited by UID %lu/%s, PID %lu/%s.",
+ log_error("Refusing operation, %s is inhibited by UID "UID_FMT"/%s, PID "PID_FMT"/%s.",
inhibit_what_to_string(inhibit_operation),
- (unsigned long) offending->uid, strna(u),
- (unsigned long) offending->pid, strna(comm));
+ offending->uid, strna(u),
+ offending->pid, strna(comm));
warn_melody();
return -EPERM;
if (r < 0)
return r;
if (!session)
- return sd_bus_error_setf(error, BUS_ERROR_NO_SESSION_FOR_PID, "PID %lu does not belong to any known session", (unsigned long) pid);
+ return sd_bus_error_setf(error, BUS_ERROR_NO_SESSION_FOR_PID, "PID "PID_FMT" does not belong to any known session", pid);
p = session_bus_path(session);
if (!p)
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
- return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
+ return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user "UID_FMT" known or logged in", uid);
p = user_bus_path(user);
if (!p)
if (r < 0)
return r;
if (!user)
- return sd_bus_error_setf(error, BUS_ERROR_NO_USER_FOR_PID, "PID %lu does not belong to any known or logged in user", (unsigned long) pid);
+ return sd_bus_error_setf(error, BUS_ERROR_NO_USER_FOR_PID, "PID "PID_FMT" does not belong to any known or logged in user", pid);
p = user_bus_path(user);
if (!p)
if (audit_id > 0) {
/* Keep our session IDs and the audit session IDs in sync */
- if (asprintf(&id, "%lu", (unsigned long) audit_id) < 0)
+ if (asprintf(&id, "%"PRIu32, audit_id) < 0)
return -ENOMEM;
/* Wut? There's already a session by this name and we
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
- return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
+ return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user "UID_FMT" known or logged in", uid);
r = user_kill(user, signo);
if (r < 0)
user = hashmap_get(m->users, ULONG_TO_PTR((unsigned long) uid));
if (!user)
- return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user '%lu' known or logged in", (unsigned long) uid);
+ return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER, "No user "UID_FMT" known or logged in", uid);
r = user_stop(user, true);
if (r < 0)
if (manager->action_timestamp + manager->inhibit_delay_max > now(CLOCK_MONOTONIC))
return 0;
- log_info("Delay lock is active (UID %lu/%s, PID %lu/%s) but inhibitor timeout is reached.",
- (unsigned long) offending->uid, strna(u),
- (unsigned long) offending->pid, strna(comm));
+ log_info("Delay lock is active (UID "UID_FMT"/%s, PID "PID_FMT"/%s) but inhibitor timeout is reached.",
+ offending->uid, strna(u),
+ offending->pid, strna(comm));
}
/* Actually do the operation */
dual_timestamp_get(&i->since);
- log_debug("Inhibitor %s (%s) pid=%lu uid=%lu mode=%s started.",
+ log_debug("Inhibitor %s (%s) pid="PID_FMT" uid="UID_FMT" mode=%s started.",
strna(i->who), strna(i->why),
- (unsigned long) i->pid, (unsigned long) i->uid,
+ i->pid, i->uid,
inhibit_mode_to_string(i->mode));
inhibitor_save(i);
assert(i);
if (i->started)
- log_debug("Inhibitor %s (%s) pid=%lu uid=%lu mode=%s stopped.",
+ log_debug("Inhibitor %s (%s) pid="PID_FMT" uid="UID_FMT" mode=%s stopped.",
strna(i->who), strna(i->why),
- (unsigned long) i->pid, (unsigned long) i->uid,
+ i->pid, i->uid,
inhibit_mode_to_string(i->mode));
if (i->state_file)
MESSAGE_ID(SD_MESSAGE_SESSION_START),
"SESSION_ID=%s", s->id,
"USER_ID=%s", s->user->name,
- "LEADER=%lu", (unsigned long) s->leader,
+ "LEADER="PID_FMT, s->leader,
"MESSAGE=New session %s of user %s.", s->id, s->user->name,
NULL);
MESSAGE_ID(SD_MESSAGE_SESSION_STOP),
"SESSION_ID=%s", s->id,
"USER_ID=%s", s->user->name,
- "LEADER=%lu", (unsigned long) s->leader,
+ "LEADER="PID_FMT, s->leader,
"MESSAGE=Removed session %s.", s->id,
NULL);
assert(u);
- if (asprintf(&s, "/org/freedesktop/login1/user/_%llu", (unsigned long long) u->uid) < 0)
+ if (asprintf(&s, "/org/freedesktop/login1/user/_"UID_FMT, u->uid) < 0)
return NULL;
return s;
if (!u->name)
goto fail;
- if (asprintf(&u->state_file, "/run/systemd/users/%lu", (unsigned long) uid) < 0)
+ if (asprintf(&u->state_file, "/run/systemd/users/"UID_FMT, uid) < 0)
goto fail;
if (hashmap_put(m->users, ULONG_TO_PTR((unsigned long) uid), u) < 0)
if (!u->slice) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- char lu[DECIMAL_STR_MAX(unsigned long) + 1], *slice;
- sprintf(lu, "%lu", (unsigned long) u->uid);
+ char lu[DECIMAL_STR_MAX(uid_t) + 1], *slice;
+ sprintf(lu, UID_FMT, u->uid);
r = build_subslice(SPECIAL_USER_SLICE, lu, &slice);
if (r < 0)
assert(u);
if (!u->service) {
- char lu[DECIMAL_STR_MAX(unsigned long) + 1], *service;
- sprintf(lu, "%lu", (unsigned long) u->uid);
+ char lu[DECIMAL_STR_MAX(uid_t) + 1], *service;
+ sprintf(lu, UID_FMT, u->uid);
service = unit_name_build("user", lu, ".service");
if (!service)
goto finish;
}
- log_debug("systemd-logind running as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-logind running as pid "PID_FMT, getpid());
sd_notify(false,
"READY=1\n"
r = manager_run(m);
- log_debug("systemd-logind stopped as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-logind stopped as pid "PID_FMT, getpid());
finish:
sd_notify(false,
return PAM_SUCCESS;
if (asprintf(&s, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT,
- (unsigned long) uid, runtime) < 0) {
+ uid, runtime) < 0) {
pam_syslog(handle, LOG_ERR, "Failed to set bus variable.");
return PAM_BUF_ERR;
}
if (streq_ptr(service, "systemd-user")) {
_cleanup_free_ char *p = NULL, *rt = NULL;
- if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) pw->pw_uid) < 0)
+ if (asprintf(&p, "/run/systemd/users/"UID_FMT, pw->pw_uid) < 0)
return PAM_BUF_ERR;
r = parse_env_file(p, NEWLINE,
assert(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=<%lu> pid=<%lu>\n",
- what, who, why, mode, (unsigned long) uid, (unsigned long) pid);
+ printf("what=<%s> who=<%s> why=<%s> mode=<%s> uid=<"UID_FMT"> pid=<"PID_FMT">\n",
+ what, who, why, mode, uid, pid);
n++;
}
log_struct(LOG_INFO,
MESSAGE_ID(SD_MESSAGE_MACHINE_START),
"NAME=%s", m->name,
- "LEADER=%lu", (unsigned long) m->leader,
+ "LEADER="PID_FMT, m->leader,
"MESSAGE=New machine %s.", m->name,
NULL);
log_struct(LOG_INFO,
MESSAGE_ID(SD_MESSAGE_MACHINE_STOP),
"NAME=%s", m->name,
- "LEADER=%lu", (unsigned long) m->leader,
+ "LEADER="PID_FMT, m->leader,
"MESSAGE=Machine %s terminated.", m->name,
NULL);
if (r < 0)
return r;
if (!machine)
- return sd_bus_error_setf(error, BUS_ERROR_NO_MACHINE_FOR_PID, "PID %lu does not belong to any known machine", (unsigned long) pid);
+ return sd_bus_error_setf(error, BUS_ERROR_NO_MACHINE_FOR_PID, "PID "PID_FMT" does not belong to any known machine", pid);
p = machine_bus_path(machine);
if (!p)
goto finish;
}
- log_debug("systemd-machined running as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-machined running as pid "PID_FMT, getpid());
sd_notify(false,
"READY=1\n"
r = manager_run(m);
- log_debug("systemd-machined stopped as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-machined stopped as pid "PID_FMT, getpid());
finish:
sd_notify(false,
}
if (arg_pid > 0) {
- if (asprintf(&cpid, "MAINPID=%lu", (unsigned long) arg_pid) < 0) {
+ if (asprintf(&cpid, "MAINPID="PID_FMT, arg_pid) < 0) {
log_error("Failed to allocate MAINPID string.");
goto finish;
}
}
if (st->st_size <= 0 || st->st_size > file_size_max) {
- log_debug("Not preloading file %s with size out of bounds %llu", fn, (unsigned long long) st->st_size);
+ log_debug("Not preloading file %s with size out of bounds %zu", fn, st->st_size);
return 0;
}
Simply so that it is more unlikely that users end up picking this
value too so that we can recognize better whether the user changed
the value while we had it temporarily bumped. */
-#define BUMP_REQUEST_NR (20*1024)
+#define BUMP_REQUEST_NR (20*1024u)
int block_bump_request_nr(const char *p) {
struct stat st;
free(line);
line = NULL;
- if (asprintf(&line, "%lu", (unsigned long) BUMP_REQUEST_NR) < 0) {
+ if (asprintf(&line, "%u", BUMP_REQUEST_NR) < 0) {
r = -ENOMEM;
goto finish;
}
if (r < 0)
goto finish;
- log_info("Bumped block_nr parameter of %u:%u to %lu. This is a temporary hack and should be removed one day.", major(d), minor(d), (unsigned long) BUMP_REQUEST_NR);
+ log_info("Bumped block_nr parameter of %u:%u to %u. This is a temporary hack and should be removed one day.", major(d), minor(d), BUMP_REQUEST_NR);
r = 1;
finish:
goto finish;
}
- if (asprintf(&line, "%llu", (unsigned long long) bytes / 1024ULL) < 0) {
+ if (asprintf(&line, "%llu", bytes / 1024ULL) < 0) {
r = -ENOMEM;
goto finish;
}
if (arg_unit)
name = unit_name_mangle_with_suffix(arg_unit, MANGLE_NOGLOB, ".service");
else
- asprintf(&name, "run-%lu.service", (unsigned long) getpid());
+ asprintf(&name, "run-"PID_FMT".service", getpid());
if (!name)
return log_oom();
if (arg_unit)
name = unit_name_mangle_with_suffix(arg_unit, MANGLE_NOGLOB, ".scope");
else
- asprintf(&name, "run-%lu.scope", (unsigned long) getpid());
+ asprintf(&name, "run-"PID_FMT".scope", getpid());
if (!name)
return log_oom();
fprintf(f,
"[Ask]\n"
- "PID=%lu\n"
+ "PID="PID_FMT"\n"
"Socket=%s\n"
"AcceptCached=%i\n"
- "NotAfter=%llu\n",
- (unsigned long) getpid(),
+ "NotAfter="USEC_FMT"\n",
+ getpid(),
socket_name,
accept_cached ? 1 : 0,
- (unsigned long long) until);
+ until);
if (message)
fprintf(f, "Message=%s\n", message);
if (pid == 0)
pid = getpid();
- snprintf(c, sizeof(c), "%lu\n", (unsigned long) pid);
+ snprintf(c, sizeof(c), PID_FMT"\n", pid);
return write_string_file(fs, c);
}
#endif
#define UNIX_USER_BUS_FMT "unix:path=%s/bus"
-#define KERNEL_USER_BUS_FMT "kernel:path=/dev/kdbus/%lu-user/bus"
+#define KERNEL_USER_BUS_FMT "kernel:path=/dev/kdbus/"UID_FMT"-user/bus"
#ifndef TTY_GID
#define TTY_GID 5
if (strftime(header_time, sizeof(header_time), "%h %e %T ", tm) <= 0)
return -EINVAL;
- snprintf(header_pid, sizeof(header_pid), "[%lu]: ", (unsigned long) getpid());
+ snprintf(header_pid, sizeof(header_pid), "["PID_FMT"]: ", getpid());
char_array_0(header_pid);
IOVEC_SET_STRING(iovec[0], header_priority);
snprintf(header_priority, sizeof(header_priority), "<%i>", level);
char_array_0(header_priority);
- snprintf(header_pid, sizeof(header_pid), "[%lu]: ", (unsigned long) getpid());
+ snprintf(header_pid, sizeof(header_pid), "["PID_FMT"]: ", getpid());
char_array_0(header_pid);
IOVEC_SET_STRING(iovec[0], header_priority);
}
fprintf(f, "[%5llu.%06llu]",
- (unsigned long long) (t / USEC_PER_SEC),
- (unsigned long long) (t % USEC_PER_SEC));
+ t / USEC_PER_SEC,
+ t % USEC_PER_SEC);
n += 1 + 5 + 1 + 6 + 1;
fprintf(f,
"__CURSOR=%s\n"
- "__REALTIME_TIMESTAMP=%llu\n"
- "__MONOTONIC_TIMESTAMP=%llu\n"
+ "__REALTIME_TIMESTAMP="USEC_FMT"\n"
+ "__MONOTONIC_TIMESTAMP="USEC_FMT"\n"
"_BOOT_ID=%s\n",
cursor,
- (unsigned long long) realtime,
- (unsigned long long) monotonic,
+ realtime,
+ monotonic,
sd_id128_to_string(boot_id, sid));
JOURNAL_FOREACH_DATA_RETVAL(j, data, length, r) {
fprintf(f,
"{\n"
"\t\"__CURSOR\" : \"%s\",\n"
- "\t\"__REALTIME_TIMESTAMP\" : \"%llu\",\n"
- "\t\"__MONOTONIC_TIMESTAMP\" : \"%llu\",\n"
+ "\t\"__REALTIME_TIMESTAMP\" : \""USEC_FMT"\",\n"
+ "\t\"__MONOTONIC_TIMESTAMP\" : \""USEC_FMT"\",\n"
"\t\"_BOOT_ID\" : \"%s\"",
cursor,
- (unsigned long long) realtime,
- (unsigned long long) monotonic,
+ realtime,
+ monotonic,
sd_id128_to_string(boot_id, sid));
else {
if (mode == OUTPUT_JSON_SSE)
fprintf(f,
"{ \"__CURSOR\" : \"%s\", "
- "\"__REALTIME_TIMESTAMP\" : \"%llu\", "
- "\"__MONOTONIC_TIMESTAMP\" : \"%llu\", "
+ "\"__REALTIME_TIMESTAMP\" : \""USEC_FMT"\", "
+ "\"__MONOTONIC_TIMESTAMP\" : \""USEC_FMT"\", "
"\"_BOOT_ID\" : \"%s\"",
cursor,
- (unsigned long long) realtime,
- (unsigned long long) monotonic,
+ realtime,
+ monotonic,
sd_id128_to_string(boot_id, sid));
}
m2 = strappenda("USER_UNIT=", unit);
m3 = strappenda("COREDUMP_USER_UNIT=", unit);
m4 = strappenda("OBJECT_SYSTEMD_USER_UNIT=", unit);
- sprintf(muid, "_UID=%lu", (unsigned long) uid);
+ sprintf(muid, "_UID="UID_FMT, uid);
(void) (
/* Look for messages from the user service itself */
if (r < 0)
return r;
- if (asprintf(ret, "PID %lu/UID %lu", (unsigned long) ucred.pid, (unsigned long) ucred.uid) < 0)
+ if (asprintf(ret, "PID "PID_FMT"/UID "UID_FMT, ucred.pid, ucred.uid) < 0)
return -ENOMEM;
return 0;
if (d >= USEC_PER_YEAR)
snprintf(buf, l, "%llu years %llu months %s",
- (unsigned long long) (d / USEC_PER_YEAR),
- (unsigned long long) ((d % USEC_PER_YEAR) / USEC_PER_MONTH), s);
+ d / USEC_PER_YEAR,
+ (d % USEC_PER_YEAR) / USEC_PER_MONTH, s);
else if (d >= USEC_PER_MONTH)
snprintf(buf, l, "%llu months %llu days %s",
- (unsigned long long) (d / USEC_PER_MONTH),
- (unsigned long long) ((d % USEC_PER_MONTH) / USEC_PER_DAY), s);
+ d / USEC_PER_MONTH,
+ (d % USEC_PER_MONTH) / USEC_PER_DAY, s);
else if (d >= USEC_PER_WEEK)
snprintf(buf, l, "%llu weeks %llu days %s",
- (unsigned long long) (d / USEC_PER_WEEK),
- (unsigned long long) ((d % USEC_PER_WEEK) / USEC_PER_DAY), s);
+ d / USEC_PER_WEEK,
+ (d % USEC_PER_WEEK) / USEC_PER_DAY, s);
else if (d >= 2*USEC_PER_DAY)
- snprintf(buf, l, "%llu days %s", (unsigned long long) (d / USEC_PER_DAY), s);
+ snprintf(buf, l, "%llu days %s", d / USEC_PER_DAY, s);
else if (d >= 25*USEC_PER_HOUR)
snprintf(buf, l, "1 day %lluh %s",
- (unsigned long long) ((d - USEC_PER_DAY) / USEC_PER_HOUR), s);
+ (d - USEC_PER_DAY) / USEC_PER_HOUR, s);
else if (d >= 6*USEC_PER_HOUR)
snprintf(buf, l, "%lluh %s",
- (unsigned long long) (d / USEC_PER_HOUR), s);
+ d / USEC_PER_HOUR, s);
else if (d >= USEC_PER_HOUR)
snprintf(buf, l, "%lluh %llumin %s",
- (unsigned long long) (d / USEC_PER_HOUR),
- (unsigned long long) ((d % USEC_PER_HOUR) / USEC_PER_MINUTE), s);
+ d / USEC_PER_HOUR,
+ (d % USEC_PER_HOUR) / USEC_PER_MINUTE, s);
else if (d >= 5*USEC_PER_MINUTE)
snprintf(buf, l, "%llumin %s",
- (unsigned long long) (d / USEC_PER_MINUTE), s);
+ d / USEC_PER_MINUTE, s);
else if (d >= USEC_PER_MINUTE)
snprintf(buf, l, "%llumin %llus %s",
- (unsigned long long) (d / USEC_PER_MINUTE),
- (unsigned long long) ((d % USEC_PER_MINUTE) / USEC_PER_SEC), s);
+ d / USEC_PER_MINUTE,
+ (d % USEC_PER_MINUTE) / USEC_PER_SEC, s);
else if (d >= USEC_PER_SEC)
snprintf(buf, l, "%llus %s",
- (unsigned long long) (d / USEC_PER_SEC), s);
+ d / USEC_PER_SEC, s);
else if (d >= USEC_PER_MSEC)
snprintf(buf, l, "%llums %s",
- (unsigned long long) (d / USEC_PER_MSEC), s);
+ d / USEC_PER_MSEC, s);
else if (d > 0)
- snprintf(buf, l, "%lluus %s",
- (unsigned long long) d, s);
+ snprintf(buf, l, USEC_FMT"us %s",
+ d, s);
else
snprintf(buf, l, "now");
if (j > 0) {
k = snprintf(p, l,
- "%s%llu.%0*llu%s",
+ "%s"USEC_FMT".%0*llu%s",
p > buf ? " " : "",
- (unsigned long long) a,
+ a,
j,
(unsigned long long) b,
table[i].suffix);
/* No? Then let's show it normally */
if (!done) {
k = snprintf(p, l,
- "%s%llu%s",
+ "%s"USEC_FMT"%s",
p > buf ? " " : "",
- (unsigned long long) a,
+ a,
table[i].suffix);
t = b;
if (!dual_timestamp_is_set(t))
return;
- fprintf(f, "%s=%llu %llu\n",
+ fprintf(f, "%s="USEC_FMT" "USEC_FMT"\n",
name,
- (unsigned long long) t->realtime,
- (unsigned long long) t->monotonic);
+ t->realtime,
+ t->monotonic);
}
void dual_timestamp_deserialize(const char *value, dual_timestamp *t) {
if (getpwuid_r(uid, &pwbuf, buf, bufsize, &pw) == 0 && pw)
return strdup(pw->pw_name);
- if (asprintf(&name, "%lu", (unsigned long) uid) < 0)
+ if (asprintf(&name, UID_FMT, uid) < 0)
return NULL;
return name;
/* This is an ugly hack */
if (major(devnr) == 136) {
- asprintf(&b, "pts/%lu", (unsigned long) minor(devnr));
+ asprintf(&b, "pts/%u", minor(devnr));
goto finish;
}
if (p)
return strdup(p->pw_name);
- if (asprintf(&r, "%lu", (unsigned long) uid) < 0)
+ if (asprintf(&r, UID_FMT, uid) < 0)
return NULL;
return r;
if (p)
return strdup(p->gr_name);
- if (asprintf(&r, "%lu", (unsigned long) gid) < 0)
+ if (asprintf(&r, GID_FMT, gid) < 0)
return NULL;
return r;
# error Unknown gid_t size
#endif
+#if SIZEOF_TIME_T == 8
+# define PRI_TIME PRIu64
+#elif SIZEOF_GID_T == 4
+# define PRI_TIME PRIu32
+#else
+# error Unknown time_t size
+#endif
+
+#if SIZEOF_RLIM_T == 8
+# define RLIM_FMT "%" PRIu64
+#elif SIZEOF_RLIM_T == 4
+# define RLIM_FMT "%" PRIu32
+#else
+# error Unknown rlim_t size
+#endif
+
#include "macro.h"
#include "time-util.h"
}
}
- log_debug("systemd-shutdownd running as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-shutdownd running as pid "PID_FMT, getpid());
sd_notify(false,
"READY=1\n"
r = EXIT_SUCCESS;
- log_debug("systemd-shutdownd stopped as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-shutdownd stopped as pid "PID_FMT, getpid());
finish:
get_process_comm(pid, &comm);
user = uid_to_name(uid);
- log_warning("Operation inhibited by \"%s\" (PID %lu \"%s\", user %s), reason is \"%s\".",
- who, (unsigned long) pid, strna(comm), strna(user), why);
+ log_warning("Operation inhibited by \"%s\" (PID "PID_FMT" \"%s\", user %s), reason is \"%s\".",
+ who, pid, strna(comm), strna(user), why);
c++;
}
&reply,
"u", pid);
if (r < 0) {
- log_error("Failed to get unit for PID %lu: %s", (unsigned long) pid, bus_error_message(&error, r));
+ log_error("Failed to get unit for PID "PID_FMT": %s", pid, bus_error_message(&error, r));
return r;
}
cg_pid_get_machine_name(pid, &machine);
cg_pid_get_slice(pid, &slice);
- printf("%lu\t%s\t%s\t%lu\t%s\t%s\t%s\t%s\t%s\n",
- (unsigned long) pid,
+ printf(PID_FMT"\t%s\t%s\t"UID_FMT"\t%s\t%s\t%s\t%s\t%s\n",
+ pid,
path,
path_shifted,
- (unsigned long) uid,
+ uid,
session,
unit,
user_unit,
#include <unistd.h>
#include "log.h"
+#include "util.h"
int main(int argc, char* argv[]) {
log_open();
log_struct(LOG_INFO,
- "MESSAGE=Waldo PID=%lu", (unsigned long) getpid(),
+ "MESSAGE=Waldo PID="PID_FMT, getpid(),
"SERVICE=piepapo",
NULL);
log_open();
log_struct(LOG_INFO,
- "MESSAGE=Foobar PID=%lu", (unsigned long) getpid(),
+ "MESSAGE=Foobar PID="PID_FMT, getpid(),
"SERVICE=foobar",
NULL);
log_struct(LOG_INFO,
- "MESSAGE=Foobar PID=%lu", (unsigned long) getpid(),
+ "MESSAGE=Foobar PID="PID_FMT, getpid(),
"FORMAT_STR_TEST=1=%i A=%c 2=%hi 3=%li 4=%lli 1=%p foo=%s 2.5=%g 3.5=%g 4.5=%Lg",
(int) 1, 'A', (short) 2, (long int) 3, (long long int) 4, (void*) 1, "foo", (float) 2.5f, (double) 3.5, (long double) 4.5,
"SUFFIX=GOT IT",
char l[FORMAT_TIMESPAN_MAX];
usec_t y;
- log_info("%llu (at accuracy %llu)", (unsigned long long) x, (unsigned long long) accuracy);
+ log_info(USEC_FMT" (at accuracy "USEC_FMT")", x, accuracy);
r = format_timespan(l, sizeof(l), x, accuracy);
assert_se(r);
assert_se(parse_sec(l, &y) >= 0);
- log_info(" = %llu", (unsigned long long) y);
+ log_info(" = "USEC_FMT, y);
if (accuracy <= 0)
accuracy = 1;
log_info("pid1 cmdline truncated: '%s'", d);
assert_se(get_parent_of_pid(1, &e) >= 0);
- log_info("pid1 ppid: '%llu'", (unsigned long long) e);
+ log_info("pid1 ppid: "PID_FMT, e);
assert_se(e == 0);
assert_se(is_kernel_thread(1) == 0);
log_info("pid1 exe: '%s'", strna(f));
assert_se(get_process_uid(1, &u) == 0);
- log_info("pid1 uid: '%llu'", (unsigned long long) u);
+ log_info("pid1 uid: "UID_FMT, u);
assert_se(u == 0);
assert_se(get_process_gid(1, &g) == 0);
- log_info("pid1 gid: '%llu'", (unsigned long long) g);
+ log_info("pid1 gid: "GID_FMT, g);
assert_se(g == 0);
assert(get_ctty_devnr(1, &h) == -ENOENT);
log_struct(LOG_INFO,
MESSAGE_ID(SD_MESSAGE_TIME_CHANGE),
- "REALTIME=%llu", (unsigned long long) timespec_load(&ts),
+ "REALTIME="USEC_FMT, timespec_load(&ts),
"MESSAGE=Changed local time to %s", ctime(&ts.tv_sec),
NULL);
if (err < 0)
goto out;
- log_debug("probe %s %sraid offset=%llu",
+ log_debug("probe %s %sraid offset=%"PRIu64,
udev_device_get_devnode(dev),
- noraid ? "no" : "", (unsigned long long) offset);
+ noraid ? "no" : "", offset);
err = probe_superblocks(pr);
if (err < 0)
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
- printf("%-6s[%llu.%06u] %-8s %s (%s)\n",
+ printf("%-6s[%"PRI_TIME".%06ld] %-8s %s (%s)\n",
source,
- (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000,
+ ts.tv_sec, ts.tv_nsec/1000,
udev_device_get_action(device),
udev_device_get_devpath(device),
udev_device_get_subsystem(device));
goto finish;
}
- log_debug("systemd-update-utmp running as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-update-utmp running as pid "PID_FMT, getpid());
if (streq(argv[1], "reboot"))
r = on_reboot(&c);
r = -EINVAL;
}
- log_debug("systemd-update-utmp stopped as pid %lu", (unsigned long) getpid());
+ log_debug("systemd-update-utmp stopped as pid "PID_FMT, getpid());
finish:
#ifdef HAVE_AUDIT