summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journal-remote.c4
-rw-r--r--src/journal/journald-console.c8
-rw-r--r--src/journal/journald-kmsg.c2
-rw-r--r--src/journal/journald-server.c26
-rw-r--r--src/journal/journald-syslog.c2
-rw-r--r--src/journal/journald.c4
-rw-r--r--src/journal/sd-journal.c2
7 files changed, 24 insertions, 24 deletions
diff --git a/src/journal/journal-remote.c b/src/journal/journal-remote.c
index ec4054f2f5..9adad7aabc 100644
--- a/src/journal/journal-remote.c
+++ b/src/journal/journal-remote.c
@@ -1210,8 +1210,8 @@ int main(int argc, char **argv) {
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...");
diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c
index 3db5fc50a1..6ec2528d74 100644
--- a/src/journal/journald-console.c
+++ b/src/journal/journald-console.c
@@ -67,9 +67,9 @@ void server_forward_console(
/* 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);
}
@@ -80,7 +80,7 @@ void server_forward_console(
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)
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index 35948ea754..12992e7d78 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -71,7 +71,7 @@ void server_forward_kmsg(
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)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 6da81e7cde..0439caf909 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -269,8 +269,8 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
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) {
@@ -576,13 +576,13 @@ static void dispatch_message_real(
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);
@@ -616,13 +616,13 @@ static void dispatch_message_real(
#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
@@ -644,7 +644,7 @@ static void dispatch_message_real(
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);
}
@@ -703,13 +703,13 @@ static void dispatch_message_real(
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);
}
@@ -737,13 +737,13 @@ static void dispatch_message_real(
#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
@@ -761,7 +761,7 @@ static void dispatch_message_real(
}
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);
}
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
index fee7d91572..434eac428f 100644
--- a/src/journal/journald-syslog.c
+++ b/src/journal/journald-syslog.c
@@ -159,7 +159,7 @@ void server_forward_syslog(Server *s, int priority, const char *identifier, cons
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)
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 766500917b..886ac92a79 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -57,7 +57,7 @@ int main(int argc, char *argv[]) {
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,
@@ -112,7 +112,7 @@ int main(int argc, char *argv[]) {
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:
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 7587211506..11de8ef45e 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -1273,7 +1273,7 @@ static bool file_type_wanted(int flags, const char *filename) {
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))