summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRonny Chevalier <chevalier.ronny@gmail.com>2015-04-10 20:43:52 +0200
committerRonny Chevalier <chevalier.ronny@gmail.com>2015-04-10 23:54:48 +0200
commit6482f6269c87d2249e52e889a63adbdd50f2d691 (patch)
treec9ae27c01d1d1b1f451d3bbb0e9f512d32883312 /src
parent05a08cb60f02970e8476306074c70ee4e6a57fb3 (diff)
shared: add formats-util.h
Diffstat (limited to 'src')
-rw-r--r--src/bus-proxyd/bus-proxyd.c1
-rw-r--r--src/bus-proxyd/bus-xml-policy.c1
-rw-r--r--src/bus-proxyd/proxy.c1
-rw-r--r--src/bus-proxyd/stdio-bridge.c1
-rw-r--r--src/core/automount.c1
-rw-r--r--src/core/busname.c1
-rw-r--r--src/core/dbus-manager.c1
-rw-r--r--src/core/execute.c1
-rw-r--r--src/core/killall.c1
-rw-r--r--src/core/main.c1
-rw-r--r--src/core/mount.c1
-rw-r--r--src/core/service.c1
-rw-r--r--src/core/socket.c1
-rw-r--r--src/core/swap.c1
-rw-r--r--src/core/unit-printf.c1
-rw-r--r--src/core/unit.c1
-rw-r--r--src/initctl/initctl.c1
-rw-r--r--src/journal-remote/journal-upload.c1
-rw-r--r--src/journal/journald-console.c1
-rw-r--r--src/journal/journald-kmsg.c1
-rw-r--r--src/journal/journald-server.c1
-rw-r--r--src/journal/journald-syslog.c1
-rw-r--r--src/journal/journald-wall.c1
-rw-r--r--src/journal/journald.c1
-rw-r--r--src/journal/sd-journal.c1
-rw-r--r--src/journal/stacktrace.c1
-rw-r--r--src/libsystemd/sd-bus/bus-creds.c1
-rw-r--r--src/libsystemd/sd-bus/bus-dump.c1
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c1
-rw-r--r--src/libsystemd/sd-bus/bus-socket.c1
-rw-r--r--src/libsystemd/sd-bus/test-bus-chat.c1
-rw-r--r--src/libsystemd/sd-login/sd-login.c1
-rw-r--r--src/libsystemd/sd-login/test-login.c1
-rw-r--r--src/libsystemd/sd-rtnl/rtnl-message.c1
-rw-r--r--src/libudev/libudev-monitor.c1
-rw-r--r--src/login/inhibit.c1
-rw-r--r--src/login/logind-acl.c1
-rw-r--r--src/login/logind-action.c1
-rw-r--r--src/login/logind-dbus.c1
-rw-r--r--src/login/logind-inhibit.c1
-rw-r--r--src/login/logind-seat.c1
-rw-r--r--src/login/logind-session.c1
-rw-r--r--src/login/logind-user-dbus.c1
-rw-r--r--src/login/logind-user.c1
-rw-r--r--src/login/logind.c1
-rw-r--r--src/login/pam_systemd.c1
-rw-r--r--src/machine/machine-dbus.c1
-rw-r--r--src/machine/machine.c1
-rw-r--r--src/machine/machined-dbus.c1
-rw-r--r--src/machine/machined.c1
-rw-r--r--src/notify/notify.c1
-rw-r--r--src/nspawn/nspawn.c1
-rw-r--r--src/run/run.c1
-rw-r--r--src/shared/ask-password-api.c1
-rw-r--r--src/shared/cgroup-show.c1
-rw-r--r--src/shared/cgroup-util.c1
-rw-r--r--src/shared/clean-ipc.c1
-rw-r--r--src/shared/formats-util.h63
-rw-r--r--src/shared/install-printf.c1
-rw-r--r--src/shared/log.c1
-rw-r--r--src/shared/logs-show.c1
-rw-r--r--src/shared/socket-util.c1
-rw-r--r--src/shared/util.c1
-rw-r--r--src/shared/util.h42
-rw-r--r--src/shutdownd/shutdownd.c1
-rw-r--r--src/systemctl/systemctl.c1
-rw-r--r--src/sysusers/sysusers.c1
-rw-r--r--src/test/test-cgroup-util.c1
-rw-r--r--src/test/test-log.c1
-rw-r--r--src/test/test-tmpfiles.c1
-rw-r--r--src/tmpfiles/tmpfiles.c1
-rw-r--r--src/udev/udev-ctrl.c1
-rw-r--r--src/udev/udev-event.c1
-rw-r--r--src/udev/udev-node.c1
-rw-r--r--src/udev/udevadm-monitor.c1
-rw-r--r--src/udev/udevd.c1
-rw-r--r--src/update-utmp/update-utmp.c1
77 files changed, 139 insertions, 41 deletions
diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c
index d612816851..3e398b53e9 100644
--- a/src/bus-proxyd/bus-proxyd.c
+++ b/src/bus-proxyd/bus-proxyd.c
@@ -41,6 +41,7 @@
#include "capability.h"
#include "bus-xml-policy.h"
#include "proxy.h"
+#include "formats-util.h"
static char *arg_address = NULL;
static char **arg_configuration = NULL;
diff --git a/src/bus-proxyd/bus-xml-policy.c b/src/bus-proxyd/bus-xml-policy.c
index 497bce7b56..675d24485e 100644
--- a/src/bus-proxyd/bus-xml-policy.c
+++ b/src/bus-proxyd/bus-xml-policy.c
@@ -27,6 +27,7 @@
#include "bus-internal.h"
#include "bus-xml-policy.h"
#include "sd-login.h"
+#include "formats-util.h"
static void policy_item_free(PolicyItem *i) {
assert(i);
diff --git a/src/bus-proxyd/proxy.c b/src/bus-proxyd/proxy.c
index c689618853..aa5010c1ac 100644
--- a/src/bus-proxyd/proxy.c
+++ b/src/bus-proxyd/proxy.c
@@ -42,6 +42,7 @@
#include "driver.h"
#include "proxy.h"
#include "synthesize.h"
+#include "formats-util.h"
static int proxy_create_destination(Proxy *p, const char *destination, const char *local_sec, bool negotiate_fds) {
_cleanup_bus_close_unref_ sd_bus *b = NULL;
diff --git a/src/bus-proxyd/stdio-bridge.c b/src/bus-proxyd/stdio-bridge.c
index 35e69a5c01..61bc08ae33 100644
--- a/src/bus-proxyd/stdio-bridge.c
+++ b/src/bus-proxyd/stdio-bridge.c
@@ -37,6 +37,7 @@
#include "strv.h"
#include "def.h"
#include "proxy.h"
+#include "formats-util.h"
static char *arg_address = NULL;
static char *arg_command_line_buffer = NULL;
diff --git a/src/core/automount.c b/src/core/automount.c
index f6a6ad5bfd..e1ca2a48ca 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -40,6 +40,7 @@
#include "dbus-automount.h"
#include "bus-util.h"
#include "bus-error.h"
+#include "formats-util.h"
static const UnitActiveState state_translation_table[_AUTOMOUNT_STATE_MAX] = {
[AUTOMOUNT_DEAD] = UNIT_INACTIVE,
diff --git a/src/core/busname.c b/src/core/busname.c
index 0ca9678a14..b1b953aadf 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -30,6 +30,7 @@
#include "bus-policy.h"
#include "dbus-busname.h"
#include "busname.h"
+#include "formats-util.h"
static const UnitActiveState state_translation_table[_BUSNAME_STATE_MAX] = {
[BUSNAME_DEAD] = UNIT_INACTIVE,
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 1b26e5556a..8821cc7820 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -40,6 +40,7 @@
#include "dbus-snapshot.h"
#include "dbus-execute.h"
#include "bus-common-errors.h"
+#include "formats-util.h"
static int property_get_version(
sd_bus *bus,
diff --git a/src/core/execute.c b/src/core/execute.c
index 768a32b31f..c87e9004bb 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -76,6 +76,7 @@
#include "smack-util.h"
#include "bus-endpoint.h"
#include "cap-list.h"
+#include "formats-util.h"
#ifdef HAVE_APPARMOR
#include "apparmor-util.h"
diff --git a/src/core/killall.c b/src/core/killall.c
index c6f1ddfec8..504051467d 100644
--- a/src/core/killall.c
+++ b/src/core/killall.c
@@ -27,6 +27,7 @@
#include "util.h"
#include "killall.h"
#include "set.h"
+#include "formats-util.h"
#define TIMEOUT_USEC (10 * USEC_PER_SEC)
diff --git a/src/core/main.c b/src/core/main.c
index dd8b65083b..5d1aed8d3f 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -72,6 +72,7 @@
#include "ima-setup.h"
#include "smack-setup.h"
#include "kmod-setup.h"
+#include "formats-util.h"
static enum {
ACTION_RUN,
diff --git a/src/core/mount.c b/src/core/mount.c
index c4aa810d05..8bfbbed2c0 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -40,6 +40,7 @@
#include "special.h"
#include "exit-status.h"
#include "fstab-util.h"
+#include "formats-util.h"
#define RETRY_UMOUNT_MAX 32
diff --git a/src/core/service.c b/src/core/service.c
index d9385504e8..c6ea6554f0 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -45,6 +45,7 @@
#include "bus-error.h"
#include "bus-util.h"
#include "bus-kernel.h"
+#include "formats-util.h"
static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
[SERVICE_DEAD] = UNIT_INACTIVE,
diff --git a/src/core/socket.c b/src/core/socket.c
index c81fd66eef..dd805d51df 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -48,6 +48,7 @@
#include "dbus-socket.h"
#include "unit.h"
#include "socket.h"
+#include "formats-util.h"
static const UnitActiveState state_translation_table[_SOCKET_STATE_MAX] = {
[SOCKET_DEAD] = UNIT_INACTIVE,
diff --git a/src/core/swap.c b/src/core/swap.c
index 53f127484f..76660cc963 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -35,6 +35,7 @@
#include "virt.h"
#include "udev-util.h"
#include "fstab-util.h"
+#include "formats-util.h"
static const UnitActiveState state_translation_table[_SWAP_STATE_MAX] = {
[SWAP_DEAD] = UNIT_INACTIVE,
diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c
index 90cb5040c1..bb4aa2121d 100644
--- a/src/core/unit-printf.c
+++ b/src/core/unit-printf.c
@@ -26,6 +26,7 @@
#include "unit-printf.h"
#include "macro.h"
#include "cgroup-util.h"
+#include "formats-util.h"
static int specifier_prefix_and_instance(char specifier, void *data, void *userdata, char **ret) {
Unit *u = userdata;
diff --git a/src/core/unit.c b/src/core/unit.c
index 7660d6b367..4b9c406e2e 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -46,6 +46,7 @@
#include "dbus.h"
#include "execute.h"
#include "dropin.h"
+#include "formats-util.h"
const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = {
[UNIT_SERVICE] = &service_vtable,
diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c
index ecec7a16a7..19d6468fcc 100644
--- a/src/initctl/initctl.c
+++ b/src/initctl/initctl.c
@@ -36,6 +36,7 @@
#include "bus-util.h"
#include "bus-error.h"
#include "def.h"
+#include "formats-util.h"
#define SERVER_FD_MAX 16
#define TIMEOUT_MSEC ((int) (DEFAULT_EXIT_USEC/USEC_PER_MSEC))
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c
index 75bb434c08..ddbb8731e2 100644
--- a/src/journal-remote/journal-upload.c
+++ b/src/journal-remote/journal-upload.c
@@ -34,6 +34,7 @@
#include "conf-parser.h"
#include "sigbus.h"
#include "journal-upload.h"
+#include "formats-util.h"
#define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-upload.pem"
#define CERT_FILE CERTIFICATE_ROOT "/certs/journal-upload.pem"
diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c
index f7ea779f0b..4ccacd7a5f 100644
--- a/src/journal/journald-console.c
+++ b/src/journal/journald-console.c
@@ -26,6 +26,7 @@
#include "fileio.h"
#include "journald-server.h"
#include "journald-console.h"
+#include "formats-util.h"
static bool prefix_timestamp(void) {
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index 80bd9cd193..cb4bc38f2c 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -31,6 +31,7 @@
#include "journald-server.h"
#include "journald-kmsg.h"
#include "journald-syslog.h"
+#include "formats-util.h"
void server_forward_kmsg(
Server *s,
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 78d5b22ae1..7e20b961a9 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -50,6 +50,7 @@
#include "journald-audit.h"
#include "journald-server.h"
#include "acl-util.h"
+#include "formats-util.h"
#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
index 7d545ca31d..6c46a30359 100644
--- a/src/journal/journald-syslog.c
+++ b/src/journal/journald-syslog.c
@@ -31,6 +31,7 @@
#include "journald-kmsg.h"
#include "journald-console.h"
#include "journald-wall.h"
+#include "formats-util.h"
/* Warn once every 30s if we missed syslog message */
#define WARN_FORWARD_SYSLOG_MISSED_USEC (30 * USEC_PER_SEC)
diff --git a/src/journal/journald-wall.c b/src/journal/journald-wall.c
index e3201674d4..b4e07179ac 100644
--- a/src/journal/journald-wall.c
+++ b/src/journal/journald-wall.c
@@ -22,6 +22,7 @@
#include "utmp-wtmp.h"
#include "journald-server.h"
#include "journald-wall.h"
+#include "formats-util.h"
void server_forward_wall(
Server *s,
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 28a423326e..b2624c6d28 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -30,6 +30,7 @@
#include "journald-syslog.h"
#include "sigbus.h"
+#include "formats-util.h"
int main(int argc, char *argv[]) {
Server server;
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 9b9e8ac859..9f0f71aa81 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -42,6 +42,7 @@
#include "catalog.h"
#include "replace-var.h"
#include "fileio.h"
+#include "formats-util.h"
#define JOURNAL_FILES_MAX 7168
diff --git a/src/journal/stacktrace.c b/src/journal/stacktrace.c
index 6b9d2729f5..706c08eac7 100644
--- a/src/journal/stacktrace.c
+++ b/src/journal/stacktrace.c
@@ -25,6 +25,7 @@
#include "util.h"
#include "macro.h"
#include "stacktrace.h"
+#include "formats-util.h"
#define FRAMES_MAX 64
#define THREADS_MAX 64
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index cd1c5e232a..4141cc3331 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -23,6 +23,7 @@
#include <linux/capability.h>
#include "util.h"
+#include "formats-util.h"
#include "capability.h"
#include "cgroup-util.h"
#include "fileio.h"
diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c
index 4bc896549a..d722680ee5 100644
--- a/src/libsystemd/sd-bus/bus-dump.c
+++ b/src/libsystemd/sd-bus/bus-dump.c
@@ -24,6 +24,7 @@
#include "strv.h"
#include "macro.h"
#include "cap-list.h"
+#include "formats-util.h"
#include "bus-message.h"
#include "bus-internal.h"
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 35c2aa6bee..0062e66d39 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -39,6 +39,7 @@
#include "memfd-util.h"
#include "capability.h"
#include "fileio.h"
+#include "formats-util.h"
#include "bus-internal.h"
#include "bus-message.h"
diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c
index 873aede65e..f97e15d5d2 100644
--- a/src/libsystemd/sd-bus/bus-socket.c
+++ b/src/libsystemd/sd-bus/bus-socket.c
@@ -29,6 +29,7 @@
#include "missing.h"
#include "utf8.h"
#include "sd-daemon.h"
+#include "formats-util.h"
#include "sd-bus.h"
#include "bus-socket.h"
diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c
index 7f49fe90fa..ab2ec27889 100644
--- a/src/libsystemd/sd-bus/test-bus-chat.c
+++ b/src/libsystemd/sd-bus/test-bus-chat.c
@@ -27,6 +27,7 @@
#include "log.h"
#include "util.h"
#include "macro.h"
+#include "formats-util.h"
#include "sd-bus.h"
#include "bus-error.h"
diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c
index 072191e43f..7b8f0636e5 100644
--- a/src/libsystemd/sd-login/sd-login.c
+++ b/src/libsystemd/sd-login/sd-login.c
@@ -31,6 +31,7 @@
#include "strv.h"
#include "fileio.h"
#include "login-shared.h"
+#include "formats-util.h"
#include "sd-login.h"
_public_ int sd_pid_get_session(pid_t pid, char **session) {
diff --git a/src/libsystemd/sd-login/test-login.c b/src/libsystemd/sd-login/test-login.c
index 2802e8246d..05affa442d 100644
--- a/src/libsystemd/sd-login/test-login.c
+++ b/src/libsystemd/sd-login/test-login.c
@@ -26,6 +26,7 @@
#include "util.h"
#include "strv.h"
+#include "formats-util.h"
static void test_login(void) {
_cleanup_close_pair_ int pair[2] = { -1, -1 };
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c
index c938471fe3..4f994a10d3 100644
--- a/src/libsystemd/sd-rtnl/rtnl-message.c
+++ b/src/libsystemd/sd-rtnl/rtnl-message.c
@@ -24,6 +24,7 @@
#include <unistd.h>
#include "util.h"
+#include "formats-util.h"
#include "refcnt.h"
#include "missing.h"
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index c48ac78908..e9d403c239 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -32,6 +32,7 @@
#include "libudev-private.h"
#include "socket-util.h"
#include "missing.h"
+#include "formats-util.h"
/**
* SECTION:libudev-monitor
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index 9f349b7c73..1f78e4b883 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -31,6 +31,7 @@
#include "util.h"
#include "build.h"
#include "strv.h"
+#include "formats-util.h"
static const char* arg_what = "idle:sleep:shutdown";
static const char* arg_who = NULL;
diff --git a/src/login/logind-acl.c b/src/login/logind-acl.c
index d2b3337788..466225d69c 100644
--- a/src/login/logind-acl.c
+++ b/src/login/logind-acl.c
@@ -23,6 +23,7 @@
#include <string.h>
#include "util.h"
+#include "formats-util.h"
#include "acl-util.h"
#include "set.h"
#include "logind-acl.h"
diff --git a/src/login/logind-action.c b/src/login/logind-action.c
index 281e3c7569..d7ae175bd3 100644
--- a/src/login/logind-action.c
+++ b/src/login/logind-action.c
@@ -27,6 +27,7 @@
#include "bus-util.h"
#include "bus-error.h"
#include "logind-action.h"
+#include "formats-util.h"
int manager_handle_action(
Manager *m,
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 9ba85d80a1..45aedad594 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -40,6 +40,7 @@
#include "selinux-util.h"
#include "efivars.h"
#include "logind.h"
+#include "formats-util.h"
int manager_get_session_from_creds(Manager *m, sd_bus_message *message, const char *name, sd_bus_error *error, Session **ret) {
_cleanup_bus_creds_unref_ sd_bus_creds *creds = NULL;
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index 5eb1a2ea65..68304a1610 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -28,6 +28,7 @@
#include "mkdir.h"
#include "logind-inhibit.h"
#include "fileio.h"
+#include "formats-util.h"
Inhibitor* inhibitor_new(Manager *m, const char* id) {
Inhibitor *i;
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c
index 49808c928b..4c0bebd18c 100644
--- a/src/login/logind-seat.c
+++ b/src/login/logind-seat.c
@@ -29,6 +29,7 @@
#include "logind-acl.h"
#include "util.h"
#include "mkdir.h"
+#include "formats-util.h"
Seat *seat_new(Manager *m, const char *id) {
Seat *s;
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index 59f765782a..cebc90ce54 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -37,6 +37,7 @@
#include "bus-util.h"
#include "bus-error.h"
#include "logind-session.h"
+#include "formats-util.h"
#define RELEASE_USEC (20*USEC_PER_SEC)
diff --git a/src/login/logind-user-dbus.c b/src/login/logind-user-dbus.c
index f7af8ff9b2..03c33708fc 100644
--- a/src/login/logind-user-dbus.c
+++ b/src/login/logind-user-dbus.c
@@ -26,6 +26,7 @@
#include "bus-util.h"
#include "logind.h"
#include "logind-user.h"
+#include "formats-util.h"
static int property_get_display(
sd_bus *bus,
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index cba9cb60aa..b00e9b17dc 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -38,6 +38,7 @@
#include "clean-ipc.h"
#include "logind-user.h"
#include "smack-util.h"
+#include "formats-util.h"
User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name) {
User *u;
diff --git a/src/login/logind.c b/src/login/logind.c
index e7880743a0..707d528fbb 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -32,6 +32,7 @@
#include "bus-error.h"
#include "logind.h"
#include "udev-util.h"
+#include "formats-util.h"
Manager *manager_new(void) {
Manager *m;
diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
index d7a708fd0a..a0fabfee67 100644
--- a/src/login/pam_systemd.c
+++ b/src/login/pam_systemd.c
@@ -40,6 +40,7 @@
#include "socket-util.h"
#include "fileio.h"
#include "bus-error.h"
+#include "formats-util.h"
static int parse_argv(
pam_handle_t *handle,
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
index d6b8c90090..6cc46afbdd 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
@@ -42,6 +42,7 @@
#include "bus-internal.h"
#include "machine.h"
#include "machine-dbus.h"
+#include "formats-util.h"
static int property_get_id(
sd_bus *bus,
diff --git a/src/machine/machine.c b/src/machine/machine.c
index 048607fb7f..dd073addec 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -35,6 +35,7 @@
#include "bus-error.h"
#include "machine.h"
#include "machine-dbus.h"
+#include "formats-util.h"
Machine* machine_new(Manager *manager, const char *name) {
Machine *m;
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index 4d7409321b..066a8da918 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -35,6 +35,7 @@
#include "image-dbus.h"
#include "machined.h"
#include "machine-dbus.h"
+#include "formats-util.h"
static int property_get_pool_path(
sd_bus *bus,
diff --git a/src/machine/machined.c b/src/machine/machined.c
index f91f067135..7980293f8b 100644
--- a/src/machine/machined.c
+++ b/src/machine/machined.c
@@ -30,6 +30,7 @@
#include "label.h"
#include "machine-image.h"
#include "machined.h"
+#include "formats-util.h"
Manager *manager_new(void) {
Manager *m;
diff --git a/src/notify/notify.c b/src/notify/notify.c
index 00db75314e..c920b29297 100644
--- a/src/notify/notify.c
+++ b/src/notify/notify.c
@@ -32,6 +32,7 @@
#include "log.h"
#include "build.h"
#include "env-util.h"
+#include "formats-util.h"
static bool arg_ready = false;
static pid_t arg_pid = 0;
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 6789281d81..8ec6743702 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -91,6 +91,7 @@
#include "in-addr-util.h"
#include "fw-util.h"
#include "local-addresses.h"
+#include "formats-util.h"
#ifdef HAVE_SECCOMP
#include "seccomp-util.h"
diff --git a/src/run/run.c b/src/run/run.c
index 3ded2c7e66..156824e0a5 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -34,6 +34,7 @@
#include "bus-error.h"
#include "calendarspec.h"
#include "ptyfwd.h"
+#include "formats-util.h"
static bool arg_scope = false;
static bool arg_remain_after_exit = false;
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index 44ebc58491..dfc89d23fd 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -32,6 +32,7 @@
#include <sys/signalfd.h>
#include "util.h"
+#include "formats-util.h"
#include "mkdir.h"
#include "strv.h"
diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c
index cbd94e86d9..fed72ac175 100644
--- a/src/shared/cgroup-show.c
+++ b/src/shared/cgroup-show.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include "util.h"
+#include "formats-util.h"
#include "macro.h"
#include "path-util.h"
#include "cgroup-util.h"
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index b6fa386e90..481708f19e 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -33,6 +33,7 @@
#include "set.h"
#include "macro.h"
#include "util.h"
+#include "formats-util.h"
#include "path-util.h"
#include "unit-name.h"
#include "fileio.h"
diff --git a/src/shared/clean-ipc.c b/src/shared/clean-ipc.c
index ea781f5dea..48b10865da 100644
--- a/src/shared/clean-ipc.c
+++ b/src/shared/clean-ipc.c
@@ -29,6 +29,7 @@
#include <mqueue.h>
#include "util.h"
+#include "formats-util.h"
#include "strv.h"
#include "clean-ipc.h"
diff --git a/src/shared/formats-util.h b/src/shared/formats-util.h
new file mode 100644
index 0000000000..ce516b117d
--- /dev/null
+++ b/src/shared/formats-util.h
@@ -0,0 +1,63 @@
+#pragma once
+
+/***
+ This file is part of systemd.
+
+ Copyright 2015 Ronny Chevalier
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include <inttypes.h>
+
+#if SIZEOF_PID_T == 4
+# define PID_PRI PRIi32
+#elif SIZEOF_PID_T == 2
+# define PID_PRI PRIi16
+#else
+# error Unknown pid_t size
+#endif
+#define PID_FMT "%" PID_PRI
+
+#if SIZEOF_UID_T == 4
+# define UID_FMT "%" PRIu32
+#elif SIZEOF_UID_T == 2
+# define UID_FMT "%" PRIu16
+#else
+# error Unknown uid_t size
+#endif
+
+#if SIZEOF_GID_T == 4
+# define GID_FMT "%" PRIu32
+#elif SIZEOF_GID_T == 2
+# define GID_FMT "%" PRIu16
+#else
+# error Unknown gid_t size
+#endif
+
+#if SIZEOF_TIME_T == 8
+# define PRI_TIME PRIi64
+#elif SIZEOF_TIME_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
diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c
index f62a0321e6..9996649424 100644
--- a/src/shared/install-printf.c
+++ b/src/shared/install-printf.c
@@ -25,6 +25,7 @@
#include "unit-name.h"
#include "util.h"
#include "install-printf.h"
+#include "formats-util.h"
static int specifier_prefix_and_instance(char specifier, void *data, void *userdata, char **ret) {
InstallInfo *i = userdata;
diff --git a/src/shared/log.c b/src/shared/log.c
index 646a1d6389..32ec581d8d 100644
--- a/src/shared/log.c
+++ b/src/shared/log.c
@@ -34,6 +34,7 @@
#include "missing.h"
#include "macro.h"
#include "socket-util.h"
+#include "formats-util.h"
#define SNDBUF_SIZE (8*1024*1024)
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 4e1b87814b..e179b8a7b4 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -31,6 +31,7 @@
#include "utf8.h"
#include "hashmap.h"
#include "journal-internal.h"
+#include "formats-util.h"
/* up to three lines (each up to 100 characters),
or 300 characters, whichever is less */
diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c
index 4a6bf50b17..94a0663345 100644
--- a/src/shared/socket-util.c
+++ b/src/shared/socket-util.c
@@ -35,6 +35,7 @@
#include "socket-util.h"
#include "missing.h"
#include "fileio.h"
+#include "formats-util.h"
int socket_address_parse(SocketAddress *a, const char *s) {
char *e, *n;
diff --git a/src/shared/util.c b/src/shared/util.c
index df5f8d1088..7321f1bcbb 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -92,6 +92,7 @@
#include "virt.h"
#include "def.h"
#include "sparse-endian.h"
+#include "formats-util.h"
/* Put this test here for a lack of better place */
assert_cc(EAGAIN == EWOULDBLOCK);
diff --git a/src/shared/util.h b/src/shared/util.h
index 56e11c7961..d17b987f33 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -43,50 +43,10 @@
#include <sys/inotify.h>
#include <sys/statfs.h>
-#if SIZEOF_PID_T == 4
-# define PID_PRI PRIi32
-#elif SIZEOF_PID_T == 2
-# define PID_PRI PRIi16
-#else
-# error Unknown pid_t size
-#endif
-#define PID_FMT "%" PID_PRI
-
-#if SIZEOF_UID_T == 4
-# define UID_FMT "%" PRIu32
-#elif SIZEOF_UID_T == 2
-# define UID_FMT "%" PRIu16
-#else
-# error Unknown uid_t size
-#endif
-
-#if SIZEOF_GID_T == 4
-# define GID_FMT "%" PRIu32
-#elif SIZEOF_GID_T == 2
-# define GID_FMT "%" PRIu16
-#else
-# error Unknown gid_t size
-#endif
-
-#if SIZEOF_TIME_T == 8
-# define PRI_TIME PRIi64
-#elif SIZEOF_TIME_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 "missing.h"
#include "time-util.h"
+#include "formats-util.h"
/* What is interpreted as whitespace? */
#define WHITESPACE " \t\n\r"
diff --git a/src/shutdownd/shutdownd.c b/src/shutdownd/shutdownd.c
index 6e4511ecea..a05cddceb2 100644
--- a/src/shutdownd/shutdownd.c
+++ b/src/shutdownd/shutdownd.c
@@ -35,6 +35,7 @@
#include "utmp-wtmp.h"
#include "mkdir.h"
#include "fileio.h"
+#include "formats-util.h"
union shutdown_buffer {
struct sd_shutdown_command command;
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 9cb351de51..915482f6d4 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -69,6 +69,7 @@
#include "mkdir.h"
#include "dropin.h"
#include "efivars.h"
+#include "formats-util.h"
static char **arg_types = NULL;
static char **arg_states = NULL;
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index e549df6d3e..cc4c7ef53f 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -38,6 +38,7 @@
#include "fileio-label.h"
#include "uid-range.h"
#include "selinux-util.h"
+#include "formats-util.h"
typedef enum ItemType {
ADD_USER = 'u',
diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c
index 9834a6a130..c0f4abe866 100644
--- a/src/test/test-cgroup-util.c
+++ b/src/test/test-cgroup-util.c
@@ -23,6 +23,7 @@
#include "util.h"
#include "cgroup-util.h"
#include "test-helper.h"
+#include "formats-util.h"
static void check_p_d_u(const char *path, int code, const char *result) {
_cleanup_free_ char *unit = NULL;
diff --git a/src/test/test-log.c b/src/test/test-log.c
index ca64004b4c..9dcfa2f274 100644
--- a/src/test/test-log.c
+++ b/src/test/test-log.c
@@ -24,6 +24,7 @@
#include "log.h"
#include "util.h"
+#include "formats-util.h"
int main(int argc, char* argv[]) {
diff --git a/src/test/test-tmpfiles.c b/src/test/test-tmpfiles.c
index 90e49d4542..221dd67eb2 100644
--- a/src/test/test-tmpfiles.c
+++ b/src/test/test-tmpfiles.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include "util.h"
+#include "formats-util.h"
int main(int argc, char** argv) {
const char *p = argv[1] ?: "/tmp";
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index ad5f3f6c6e..ef13dcb749 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -56,6 +56,7 @@
#include "selinux-util.h"
#include "btrfs-util.h"
#include "acl-util.h"
+#include "formats-util.h"
/* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
* them in the file system. This is intended to be used to create
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index 61d3c5b557..0f357ba6c2 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -19,6 +19,7 @@
#include <sys/un.h>
#include "socket-util.h"
+#include "formats-util.h"
#include "udev.h"
/* wire protocol magic must match */
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 3a165b0b4f..bda06385ea 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -32,6 +32,7 @@
#include "udev.h"
#include "rtnl-util.h"
+#include "formats-util.h"
struct udev_event *udev_event_new(struct udev_device *dev) {
struct udev *udev = udev_device_get_udev(dev);
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index debf9ea88b..d824172b89 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -28,6 +28,7 @@
#include "udev.h"
#include "smack-util.h"
#include "selinux-util.h"
+#include "formats-util.h"
static int node_symlink(struct udev_device *dev, const char *node, const char *slink) {
struct stat stats;
diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c
index 7ef2e68233..5e93955186 100644
--- a/src/udev/udevadm-monitor.c
+++ b/src/udev/udevadm-monitor.c
@@ -27,6 +27,7 @@
#include "udev.h"
#include "udev-util.h"
+#include "formats-util.h"
static bool udev_exit;
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 830aedd0fe..a3f17c4b09 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -48,6 +48,7 @@
#include "selinux-util.h"
#include "udev.h"
#include "udev-util.h"
+#include "formats-util.h"
static struct udev_rules *rules;
static struct udev_ctrl *udev_ctrl;
diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c
index 33535ebd7f..ea9b0c9c84 100644
--- a/src/update-utmp/update-utmp.c
+++ b/src/update-utmp/update-utmp.c
@@ -37,6 +37,7 @@
#include "bus-util.h"
#include "bus-error.h"
#include "unit-name.h"
+#include "formats-util.h"
typedef struct Context {
sd_bus *bus;