summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/af-list.c2
-rw-r--r--src/basic/af-list.h2
-rw-r--r--src/basic/alloc-util.c2
-rw-r--r--src/basic/alloc-util.h2
-rw-r--r--src/basic/arphrd-list.c2
-rw-r--r--src/basic/arphrd-list.h2
-rw-r--r--src/basic/async.c2
-rw-r--r--src/basic/async.h2
-rw-r--r--src/basic/audit-util.c2
-rw-r--r--src/basic/audit-util.h2
-rw-r--r--src/basic/barrier.c2
-rw-r--r--src/basic/barrier.h2
-rw-r--r--src/basic/bitmap.c2
-rw-r--r--src/basic/bitmap.h2
-rw-r--r--src/basic/blkid-util.h2
-rw-r--r--src/basic/btrfs-ctree.h2
-rw-r--r--src/basic/btrfs-util.c2
-rw-r--r--src/basic/btrfs-util.h2
-rw-r--r--src/basic/build.h2
-rw-r--r--src/basic/bus-label.c2
-rw-r--r--src/basic/bus-label.h2
-rw-r--r--src/basic/calendarspec.c2
-rw-r--r--src/basic/calendarspec.h2
-rw-r--r--src/basic/cap-list.c2
-rw-r--r--src/basic/cap-list.h2
-rw-r--r--src/basic/capability-util.c2
-rw-r--r--src/basic/capability-util.h2
-rw-r--r--src/basic/cgroup-util.c3
-rw-r--r--src/basic/cgroup-util.h4
-rw-r--r--src/basic/chattr-util.c2
-rw-r--r--src/basic/chattr-util.h2
-rw-r--r--src/basic/clock-util.c16
-rw-r--r--src/basic/clock-util.h3
-rw-r--r--src/basic/conf-files.c2
-rw-r--r--src/basic/conf-files.h2
-rw-r--r--src/basic/copy.c2
-rw-r--r--src/basic/copy.h2
-rw-r--r--src/basic/cpu-set-util.c2
-rw-r--r--src/basic/cpu-set-util.h2
-rw-r--r--src/basic/def.h2
-rw-r--r--src/basic/device-nodes.c2
-rw-r--r--src/basic/device-nodes.h2
-rw-r--r--src/basic/dirent-util.c2
-rw-r--r--src/basic/dirent-util.h2
-rw-r--r--src/basic/env-util.c2
-rw-r--r--src/basic/env-util.h2
-rw-r--r--src/basic/errno-list.c2
-rw-r--r--src/basic/errno-list.h2
-rw-r--r--src/basic/escape.c2
-rw-r--r--src/basic/escape.h2
-rw-r--r--src/basic/ether-addr-util.c2
-rw-r--r--src/basic/ether-addr-util.h2
-rw-r--r--src/basic/exit-status.c5
-rw-r--r--src/basic/exit-status.h3
-rw-r--r--src/basic/extract-word.c2
-rw-r--r--src/basic/extract-word.h2
-rw-r--r--src/basic/fd-util.c2
-rw-r--r--src/basic/fd-util.h2
-rw-r--r--src/basic/fdset.c2
-rw-r--r--src/basic/fdset.h2
-rw-r--r--src/basic/fileio-label.c2
-rw-r--r--src/basic/fileio-label.h2
-rw-r--r--src/basic/fileio.c2
-rw-r--r--src/basic/fileio.h2
-rw-r--r--src/basic/fs-util.c2
-rw-r--r--src/basic/fs-util.h2
-rw-r--r--src/basic/glob-util.c2
-rw-r--r--src/basic/glob-util.h2
-rw-r--r--src/basic/hash-funcs.c2
-rw-r--r--src/basic/hash-funcs.h2
-rw-r--r--src/basic/hashmap.c2
-rw-r--r--src/basic/hashmap.h2
-rw-r--r--src/basic/hexdecoct.c2
-rw-r--r--src/basic/hexdecoct.h2
-rw-r--r--src/basic/hostname-util.c2
-rw-r--r--src/basic/hostname-util.h2
-rw-r--r--src/basic/in-addr-util.c2
-rw-r--r--src/basic/in-addr-util.h2
-rw-r--r--src/basic/io-util.c2
-rw-r--r--src/basic/io-util.h2
-rw-r--r--src/basic/json.c2
-rw-r--r--src/basic/json.h2
-rw-r--r--src/basic/label.c2
-rw-r--r--src/basic/label.h2
-rw-r--r--src/basic/list.h2
-rw-r--r--src/basic/locale-util.c2
-rw-r--r--src/basic/locale-util.h2
-rw-r--r--src/basic/lockfile-util.c2
-rw-r--r--src/basic/lockfile-util.h2
-rw-r--r--src/basic/log.c2
-rw-r--r--src/basic/log.h2
-rw-r--r--src/basic/login-util.c2
-rw-r--r--src/basic/login-util.h2
-rw-r--r--src/basic/macro.h2
-rw-r--r--src/basic/memfd-util.c2
-rw-r--r--src/basic/memfd-util.h2
-rw-r--r--src/basic/mempool.c2
-rw-r--r--src/basic/mempool.h2
-rw-r--r--src/basic/missing.h2
-rw-r--r--src/basic/mkdir-label.c2
-rw-r--r--src/basic/mkdir.c2
-rw-r--r--src/basic/mkdir.h2
-rw-r--r--src/basic/mount-util.c2
-rw-r--r--src/basic/mount-util.h2
-rw-r--r--src/basic/nss-util.h2
-rw-r--r--src/basic/ordered-set.h2
-rw-r--r--src/basic/parse-util.c2
-rw-r--r--src/basic/parse-util.h2
-rw-r--r--src/basic/path-util.c2
-rw-r--r--src/basic/path-util.h2
-rw-r--r--src/basic/prioq.c2
-rw-r--r--src/basic/prioq.h2
-rw-r--r--src/basic/proc-cmdline.c2
-rw-r--r--src/basic/proc-cmdline.h2
-rw-r--r--src/basic/ratelimit.c2
-rw-r--r--src/basic/ratelimit.h2
-rw-r--r--src/basic/refcnt.h2
-rw-r--r--src/basic/replace-var.c2
-rw-r--r--src/basic/replace-var.h2
-rw-r--r--src/basic/rlimit-util.c202
-rw-r--r--src/basic/rlimit-util.h7
-rw-r--r--src/basic/rm-rf.c2
-rw-r--r--src/basic/rm-rf.h2
-rw-r--r--src/basic/selinux-util.c2
-rw-r--r--src/basic/selinux-util.h2
-rw-r--r--src/basic/set.h2
-rw-r--r--src/basic/sigbus.c2
-rw-r--r--src/basic/sigbus.h2
-rw-r--r--src/basic/signal-util.c2
-rw-r--r--src/basic/signal-util.h2
-rw-r--r--src/basic/smack-util.c2
-rw-r--r--src/basic/smack-util.h2
-rw-r--r--src/basic/socket-label.c2
-rw-r--r--src/basic/socket-util.c5
-rw-r--r--src/basic/socket-util.h2
-rw-r--r--src/basic/special.h2
-rw-r--r--src/basic/stat-util.c2
-rw-r--r--src/basic/stat-util.h2
-rw-r--r--src/basic/stdio-util.h2
-rw-r--r--src/basic/strbuf.c2
-rw-r--r--src/basic/strbuf.h2
-rw-r--r--src/basic/string-table.c2
-rw-r--r--src/basic/string-table.h2
-rw-r--r--src/basic/string-util.c2
-rw-r--r--src/basic/string-util.h2
-rw-r--r--src/basic/strv.c2
-rw-r--r--src/basic/strv.h2
-rw-r--r--src/basic/strxcpyx.c2
-rw-r--r--src/basic/strxcpyx.h2
-rw-r--r--src/basic/syslog-util.c2
-rw-r--r--src/basic/syslog-util.h2
-rw-r--r--src/basic/time-util.c106
-rw-r--r--src/basic/time-util.h32
-rw-r--r--src/basic/umask-util.h2
-rw-r--r--src/basic/unaligned.h2
-rw-r--r--src/basic/unit-name.c2
-rw-r--r--src/basic/unit-name.h2
-rw-r--r--src/basic/user-util.c2
-rw-r--r--src/basic/user-util.h2
-rw-r--r--src/basic/utf8.c2
-rw-r--r--src/basic/utf8.h2
-rw-r--r--src/basic/util.c2
-rw-r--r--src/basic/util.h2
-rw-r--r--src/basic/verbs.c2
-rw-r--r--src/basic/verbs.h2
-rw-r--r--src/basic/virt.c2
-rw-r--r--src/basic/virt.h2
-rw-r--r--src/basic/web-util.c2
-rw-r--r--src/basic/web-util.h2
-rw-r--r--src/basic/xattr-util.c2
-rw-r--r--src/basic/xattr-util.h2
-rw-r--r--src/basic/xml.c2
-rw-r--r--src/basic/xml.h2
173 files changed, 296 insertions, 414 deletions
diff --git a/src/basic/af-list.c b/src/basic/af-list.c
index 606bb49a59..3fac9c508b 100644
--- a/src/basic/af-list.c
+++ b/src/basic/af-list.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/af-list.h b/src/basic/af-list.h
index e346ab87f5..135248dc64 100644
--- a/src/basic/af-list.h
+++ b/src/basic/af-list.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/alloc-util.c b/src/basic/alloc-util.c
index 0c6a15c958..b540dcddf5 100644
--- a/src/basic/alloc-util.c
+++ b/src/basic/alloc-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/alloc-util.h b/src/basic/alloc-util.h
index f5097ea117..679ba7f398 100644
--- a/src/basic/alloc-util.h
+++ b/src/basic/alloc-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/arphrd-list.c b/src/basic/arphrd-list.c
index c1fdbbd905..6792d1ee3f 100644
--- a/src/basic/arphrd-list.c
+++ b/src/basic/arphrd-list.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/arphrd-list.h b/src/basic/arphrd-list.h
index 5ca182c9e8..c0f8758dbe 100644
--- a/src/basic/arphrd-list.h
+++ b/src/basic/arphrd-list.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/async.c b/src/basic/async.c
index 42c66a762e..a1f163f27b 100644
--- a/src/basic/async.c
+++ b/src/basic/async.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/async.h b/src/basic/async.h
index 7f1ef79532..9bd13ff6e0 100644
--- a/src/basic/async.h
+++ b/src/basic/async.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/audit-util.c b/src/basic/audit-util.c
index e52ee24c05..5741fecdd6 100644
--- a/src/basic/audit-util.c
+++ b/src/basic/audit-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/audit-util.h b/src/basic/audit-util.h
index 026d3cd9b1..e048503991 100644
--- a/src/basic/audit-util.h
+++ b/src/basic/audit-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/barrier.c b/src/basic/barrier.c
index 26ae123341..2da633b311 100644
--- a/src/basic/barrier.c
+++ b/src/basic/barrier.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/barrier.h b/src/basic/barrier.h
index 722effe834..6347fddc4d 100644
--- a/src/basic/barrier.h
+++ b/src/basic/barrier.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/bitmap.c b/src/basic/bitmap.c
index 50078822a7..ad1fda0198 100644
--- a/src/basic/bitmap.c
+++ b/src/basic/bitmap.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/bitmap.h b/src/basic/bitmap.h
index d2726630f1..f5f8f2f018 100644
--- a/src/basic/bitmap.h
+++ b/src/basic/bitmap.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/blkid-util.h b/src/basic/blkid-util.h
index c689310324..7aa75eb091 100644
--- a/src/basic/blkid-util.h
+++ b/src/basic/blkid-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/btrfs-ctree.h b/src/basic/btrfs-ctree.h
index d3ae57331c..66bdf9736e 100644
--- a/src/basic/btrfs-ctree.h
+++ b/src/basic/btrfs-ctree.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
#include "macro.h"
diff --git a/src/basic/btrfs-util.c b/src/basic/btrfs-util.c
index 03c7609c92..359d85f2e8 100644
--- a/src/basic/btrfs-util.c
+++ b/src/basic/btrfs-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/btrfs-util.h b/src/basic/btrfs-util.h
index 31b9c02785..37802c2565 100644
--- a/src/basic/btrfs-util.h
+++ b/src/basic/btrfs-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/build.h b/src/basic/build.h
index 24873ab9d7..633c2aaccb 100644
--- a/src/basic/build.h
+++ b/src/basic/build.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/bus-label.c b/src/basic/bus-label.c
index d8d5863b03..d4531c7947 100644
--- a/src/basic/bus-label.c
+++ b/src/basic/bus-label.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/bus-label.h b/src/basic/bus-label.h
index f51153ce6d..62fb2c450c 100644
--- a/src/basic/bus-label.h
+++ b/src/basic/bus-label.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/calendarspec.c b/src/basic/calendarspec.c
index 8f83d9c142..775879076d 100644
--- a/src/basic/calendarspec.c
+++ b/src/basic/calendarspec.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/calendarspec.h b/src/basic/calendarspec.h
index 4e3aa9e1d8..f6472c1244 100644
--- a/src/basic/calendarspec.h
+++ b/src/basic/calendarspec.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/cap-list.c b/src/basic/cap-list.c
index 0e5cc452b9..3e773a06f5 100644
--- a/src/basic/cap-list.c
+++ b/src/basic/cap-list.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/cap-list.h b/src/basic/cap-list.h
index 9824fad70f..c1f6b94ad3 100644
--- a/src/basic/cap-list.h
+++ b/src/basic/cap-list.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/capability-util.c b/src/basic/capability-util.c
index 49c2d61afe..d4c5bd6937 100644
--- a/src/basic/capability-util.c
+++ b/src/basic/capability-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/capability-util.h b/src/basic/capability-util.h
index be41475441..35a896e229 100644
--- a/src/basic/capability-util.h
+++ b/src/basic/capability-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index f873fb89d3..6ef00d51df 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
@@ -2271,7 +2269,6 @@ static const char *cgroup_controller_table[_CGROUP_CONTROLLER_MAX] = {
[CGROUP_CONTROLLER_MEMORY] = "memory",
[CGROUP_CONTROLLER_DEVICES] = "devices",
[CGROUP_CONTROLLER_PIDS] = "pids",
- [CGROUP_CONTROLLER_NET_CLS] = "net_cls",
};
DEFINE_STRING_TABLE_LOOKUP(cgroup_controller, CGroupController);
diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h
index 661785784a..ad1edd9cdb 100644
--- a/src/basic/cgroup-util.h
+++ b/src/basic/cgroup-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
@@ -40,7 +38,6 @@ typedef enum CGroupController {
CGROUP_CONTROLLER_MEMORY,
CGROUP_CONTROLLER_DEVICES,
CGROUP_CONTROLLER_PIDS,
- CGROUP_CONTROLLER_NET_CLS,
_CGROUP_CONTROLLER_MAX,
_CGROUP_CONTROLLER_INVALID = -1,
} CGroupController;
@@ -55,7 +52,6 @@ typedef enum CGroupMask {
CGROUP_MASK_MEMORY = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_MEMORY),
CGROUP_MASK_DEVICES = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_DEVICES),
CGROUP_MASK_PIDS = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_PIDS),
- CGROUP_MASK_NET_CLS = CGROUP_CONTROLLER_TO_MASK(CGROUP_CONTROLLER_NET_CLS),
_CGROUP_MASK_ALL = CGROUP_CONTROLLER_TO_MASK(_CGROUP_CONTROLLER_MAX) - 1
} CGroupMask;
diff --git a/src/basic/chattr-util.c b/src/basic/chattr-util.c
index 438fc63c5c..2896a729af 100644
--- a/src/basic/chattr-util.c
+++ b/src/basic/chattr-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/chattr-util.h b/src/basic/chattr-util.h
index ba6b8eb5c1..960cf6d5b3 100644
--- a/src/basic/chattr-util.h
+++ b/src/basic/chattr-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/clock-util.c b/src/basic/clock-util.c
index 05788a360e..507e757ff0 100644
--- a/src/basic/clock-util.c
+++ b/src/basic/clock-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
@@ -146,3 +144,17 @@ int clock_reset_timewarp(void) {
return 0;
}
+
+#define TIME_EPOCH_USEC ((usec_t) TIME_EPOCH * USEC_PER_SEC)
+
+int clock_apply_epoch(void) {
+ struct timespec ts;
+
+ if (now(CLOCK_REALTIME) >= TIME_EPOCH_USEC)
+ return 0;
+
+ if (clock_settime(CLOCK_REALTIME, timespec_store(&ts, TIME_EPOCH_USEC)) < 0)
+ return -errno;
+
+ return 1;
+}
diff --git a/src/basic/clock-util.h b/src/basic/clock-util.h
index fef2d471a6..f471f2abcf 100644
--- a/src/basic/clock-util.h
+++ b/src/basic/clock-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
@@ -28,3 +26,4 @@ int clock_set_timezone(int *min);
int clock_reset_timewarp(void);
int clock_get_hwclock(struct tm *tm);
int clock_set_hwclock(const struct tm *tm);
+int clock_apply_epoch(void);
diff --git a/src/basic/conf-files.c b/src/basic/conf-files.c
index 5854caeb51..c781610e14 100644
--- a/src/basic/conf-files.c
+++ b/src/basic/conf-files.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/conf-files.h b/src/basic/conf-files.h
index d8aebc5e5b..e00e0e81fb 100644
--- a/src/basic/conf-files.h
+++ b/src/basic/conf-files.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/copy.c b/src/basic/copy.c
index 024712d290..519b412941 100644
--- a/src/basic/copy.c
+++ b/src/basic/copy.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/copy.h b/src/basic/copy.h
index b3fc2bb709..3e5eb52506 100644
--- a/src/basic/copy.h
+++ b/src/basic/copy.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/cpu-set-util.c b/src/basic/cpu-set-util.c
index 85b7519953..95ed6928ff 100644
--- a/src/basic/cpu-set-util.c
+++ b/src/basic/cpu-set-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/cpu-set-util.h b/src/basic/cpu-set-util.h
index 19b457a684..6f49d9afb0 100644
--- a/src/basic/cpu-set-util.h
+++ b/src/basic/cpu-set-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/def.h b/src/basic/def.h
index 0657ac7367..963343eb7d 100644
--- a/src/basic/def.h
+++ b/src/basic/def.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/device-nodes.c b/src/basic/device-nodes.c
index ec58cfdd4c..38c0628a90 100644
--- a/src/basic/device-nodes.c
+++ b/src/basic/device-nodes.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/device-nodes.h b/src/basic/device-nodes.h
index 9669c86970..94f385abcb 100644
--- a/src/basic/device-nodes.h
+++ b/src/basic/device-nodes.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/dirent-util.c b/src/basic/dirent-util.c
index 4ef5aba5a8..5fb535cb13 100644
--- a/src/basic/dirent-util.c
+++ b/src/basic/dirent-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/dirent-util.h b/src/basic/dirent-util.h
index 1ad5e4715a..6bf099b46c 100644
--- a/src/basic/dirent-util.h
+++ b/src/basic/dirent-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/env-util.c b/src/basic/env-util.c
index dd56545f12..7f5fddb700 100644
--- a/src/basic/env-util.c
+++ b/src/basic/env-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/env-util.h b/src/basic/env-util.h
index 3b83a63a78..b1fef704c2 100644
--- a/src/basic/env-util.h
+++ b/src/basic/env-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/errno-list.c b/src/basic/errno-list.c
index b4d080103b..31b66bad5e 100644
--- a/src/basic/errno-list.c
+++ b/src/basic/errno-list.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/errno-list.h b/src/basic/errno-list.h
index ba533294e6..4eec0cc786 100644
--- a/src/basic/errno-list.h
+++ b/src/basic/errno-list.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/escape.c b/src/basic/escape.c
index d59aa9f42f..01daf11ce7 100644
--- a/src/basic/escape.c
+++ b/src/basic/escape.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/escape.h b/src/basic/escape.h
index bc25646a3d..deaa4def28 100644
--- a/src/basic/escape.h
+++ b/src/basic/escape.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/ether-addr-util.c b/src/basic/ether-addr-util.c
index bc54f8f5f4..ded6d31f4b 100644
--- a/src/basic/ether-addr-util.c
+++ b/src/basic/ether-addr-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/ether-addr-util.h b/src/basic/ether-addr-util.h
index 008f3b893e..4487149efd 100644
--- a/src/basic/ether-addr-util.h
+++ b/src/basic/ether-addr-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/exit-status.c b/src/basic/exit-status.c
index 4c83731540..92fa5ace61 100644
--- a/src/basic/exit-status.c
+++ b/src/basic/exit-status.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
@@ -149,9 +147,6 @@ const char* exit_status_to_string(ExitStatus status, ExitStatusLevel level) {
case EXIT_MAKE_STARTER:
return "MAKE_STARTER";
- case EXIT_BUS_ENDPOINT:
- return "BUS_ENDPOINT";
-
case EXIT_SMACK_PROCESS_LABEL:
return "SMACK_PROCESS_LABEL";
}
diff --git a/src/basic/exit-status.h b/src/basic/exit-status.h
index 664222c1d6..1208c8feed 100644
--- a/src/basic/exit-status.h
+++ b/src/basic/exit-status.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
@@ -79,7 +77,6 @@ typedef enum ExitStatus {
EXIT_RUNTIME_DIRECTORY,
EXIT_MAKE_STARTER,
EXIT_CHOWN,
- EXIT_BUS_ENDPOINT,
EXIT_SMACK_PROCESS_LABEL,
} ExitStatus;
diff --git a/src/basic/extract-word.c b/src/basic/extract-word.c
index 6dcd4f9f5b..ee35d2a0ec 100644
--- a/src/basic/extract-word.c
+++ b/src/basic/extract-word.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/extract-word.h b/src/basic/extract-word.h
index 9606ab64b3..21db5ef33f 100644
--- a/src/basic/extract-word.h
+++ b/src/basic/extract-word.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c
index 9759cac23c..ec9560cd07 100644
--- a/src/basic/fd-util.c
+++ b/src/basic/fd-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
index 20890e3279..44528c6e35 100644
--- a/src/basic/fd-util.h
+++ b/src/basic/fd-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/fdset.c b/src/basic/fdset.c
index de9b723ab8..3674d3ed9d 100644
--- a/src/basic/fdset.c
+++ b/src/basic/fdset.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/fdset.h b/src/basic/fdset.h
index 615ba05661..12d0cef761 100644
--- a/src/basic/fdset.h
+++ b/src/basic/fdset.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/fileio-label.c b/src/basic/fileio-label.c
index 1cee87c9cd..66dbc0fe1e 100644
--- a/src/basic/fileio-label.c
+++ b/src/basic/fileio-label.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/fileio-label.h b/src/basic/fileio-label.h
index 9feb3cccb5..fe7543013d 100644
--- a/src/basic/fileio-label.h
+++ b/src/basic/fileio-label.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/fileio.c b/src/basic/fileio.c
index 3ff70310e1..e43ca6d29e 100644
--- a/src/basic/fileio.c
+++ b/src/basic/fileio.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/fileio.h b/src/basic/fileio.h
index 9e09574133..8084895ff3 100644
--- a/src/basic/fileio.h
+++ b/src/basic/fileio.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
index 61b651b573..3ef1b90edd 100644
--- a/src/basic/fs-util.c
+++ b/src/basic/fs-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
index 67ed214b51..0e2fcb21b9 100644
--- a/src/basic/fs-util.h
+++ b/src/basic/fs-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
index 811ab6ec36..007198c269 100644
--- a/src/basic/glob-util.c
+++ b/src/basic/glob-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h
index a0a5efe5b6..5d8fb47a26 100644
--- a/src/basic/glob-util.h
+++ b/src/basic/glob-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/hash-funcs.c b/src/basic/hash-funcs.c
index d4affaffee..c3a4a011b5 100644
--- a/src/basic/hash-funcs.c
+++ b/src/basic/hash-funcs.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/hash-funcs.h b/src/basic/hash-funcs.h
index c640eaf4d1..299189d143 100644
--- a/src/basic/hash-funcs.h
+++ b/src/basic/hash-funcs.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c
index dcd8ae412d..6f1a049d47 100644
--- a/src/basic/hashmap.c
+++ b/src/basic/hashmap.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/hashmap.h b/src/basic/hashmap.h
index fdba9c61ff..6d1ae48b21 100644
--- a/src/basic/hashmap.h
+++ b/src/basic/hashmap.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/hexdecoct.c b/src/basic/hexdecoct.c
index cbd97a1b69..d7ad8d41f2 100644
--- a/src/basic/hexdecoct.c
+++ b/src/basic/hexdecoct.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/hexdecoct.h b/src/basic/hexdecoct.h
index 243c5e921e..1ba2f69ebd 100644
--- a/src/basic/hexdecoct.h
+++ b/src/basic/hexdecoct.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c
index 795afb6d00..7bb23448ed 100644
--- a/src/basic/hostname-util.c
+++ b/src/basic/hostname-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/hostname-util.h b/src/basic/hostname-util.h
index d4f5bfe45e..d062eddea1 100644
--- a/src/basic/hostname-util.h
+++ b/src/basic/hostname-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/in-addr-util.c b/src/basic/in-addr-util.c
index 8609ffb3c9..245107ebb8 100644
--- a/src/basic/in-addr-util.c
+++ b/src/basic/in-addr-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/in-addr-util.h b/src/basic/in-addr-util.h
index f2b8865df5..17798ce816 100644
--- a/src/basic/in-addr-util.h
+++ b/src/basic/in-addr-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/io-util.c b/src/basic/io-util.c
index e83e7cec72..3ec8d61236 100644
--- a/src/basic/io-util.c
+++ b/src/basic/io-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/io-util.h b/src/basic/io-util.h
index 7d0d2bd810..142c940d92 100644
--- a/src/basic/io-util.h
+++ b/src/basic/io-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/json.c b/src/basic/json.c
index 3a3d1ad1e1..daa98fc815 100644
--- a/src/basic/json.c
+++ b/src/basic/json.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/json.h b/src/basic/json.h
index df3f62f206..a4509f680f 100644
--- a/src/basic/json.h
+++ b/src/basic/json.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/label.c b/src/basic/label.c
index f72a985967..f5ab855d32 100644
--- a/src/basic/label.c
+++ b/src/basic/label.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/label.h b/src/basic/label.h
index 8070bcb021..3e9251aa71 100644
--- a/src/basic/label.h
+++ b/src/basic/label.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/list.h b/src/basic/list.h
index 760abcdab3..c68185f587 100644
--- a/src/basic/list.h
+++ b/src/basic/list.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c
index 7784d02168..cda6b2895d 100644
--- a/src/basic/locale-util.c
+++ b/src/basic/locale-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/locale-util.h b/src/basic/locale-util.h
index c71d145139..b0f9679286 100644
--- a/src/basic/locale-util.h
+++ b/src/basic/locale-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/lockfile-util.c b/src/basic/lockfile-util.c
index 6ecfc2ec46..3ee4191e4d 100644
--- a/src/basic/lockfile-util.c
+++ b/src/basic/lockfile-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/lockfile-util.h b/src/basic/lockfile-util.h
index 3c514c9e62..22491ee8e1 100644
--- a/src/basic/lockfile-util.h
+++ b/src/basic/lockfile-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/log.c b/src/basic/log.c
index 18d4b82be2..d89e6f7274 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/log.h b/src/basic/log.h
index 8c7c5e4598..60ddead74c 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/login-util.c b/src/basic/login-util.c
index 4e08fe3895..339e94f12d 100644
--- a/src/basic/login-util.c
+++ b/src/basic/login-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/login-util.h b/src/basic/login-util.h
index be5bb64870..89a337d7c1 100644
--- a/src/basic/login-util.h
+++ b/src/basic/login-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/macro.h b/src/basic/macro.h
index c529c6ecad..2695d0edb7 100644
--- a/src/basic/macro.h
+++ b/src/basic/macro.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/memfd-util.c b/src/basic/memfd-util.c
index 789638f013..8c8cc78ebf 100644
--- a/src/basic/memfd-util.c
+++ b/src/basic/memfd-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/memfd-util.h b/src/basic/memfd-util.h
index 2a89361c4c..46d4989e4c 100644
--- a/src/basic/memfd-util.h
+++ b/src/basic/memfd-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/mempool.c b/src/basic/mempool.c
index 1822d3956f..f95e2beb0f 100644
--- a/src/basic/mempool.c
+++ b/src/basic/mempool.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/mempool.h b/src/basic/mempool.h
index 42f473bee1..fea7841bcf 100644
--- a/src/basic/mempool.h
+++ b/src/basic/mempool.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/missing.h b/src/basic/missing.h
index 48ca04a8a1..36b060496a 100644
--- a/src/basic/missing.h
+++ b/src/basic/missing.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/mkdir-label.c b/src/basic/mkdir-label.c
index c9e17f7680..aa6878cdf0 100644
--- a/src/basic/mkdir-label.c
+++ b/src/basic/mkdir-label.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c
index 9f9d52b5df..6b1a98402c 100644
--- a/src/basic/mkdir.c
+++ b/src/basic/mkdir.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/mkdir.h b/src/basic/mkdir.h
index 2392d1fd1b..d564a3547f 100644
--- a/src/basic/mkdir.h
+++ b/src/basic/mkdir.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/mount-util.c b/src/basic/mount-util.c
index 10a6536cfc..33f2ee96d8 100644
--- a/src/basic/mount-util.c
+++ b/src/basic/mount-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/mount-util.h b/src/basic/mount-util.h
index b37250f08e..bdb525d6b0 100644
--- a/src/basic/mount-util.h
+++ b/src/basic/mount-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/nss-util.h b/src/basic/nss-util.h
index 4be0136da6..df565a3593 100644
--- a/src/basic/nss-util.h
+++ b/src/basic/nss-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/ordered-set.h b/src/basic/ordered-set.h
index ab185c11aa..e1dfc86380 100644
--- a/src/basic/ordered-set.h
+++ b/src/basic/ordered-set.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
index d8de6f90ea..a3cb81b040 100644
--- a/src/basic/parse-util.c
+++ b/src/basic/parse-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/parse-util.h b/src/basic/parse-util.h
index af439cfaa7..d8dc26a36e 100644
--- a/src/basic/parse-util.h
+++ b/src/basic/parse-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/path-util.c b/src/basic/path-util.c
index 4837bb2d7d..822c09bfba 100644
--- a/src/basic/path-util.c
+++ b/src/basic/path-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/path-util.h b/src/basic/path-util.h
index 84472d38c7..2c2f87a9f2 100644
--- a/src/basic/path-util.h
+++ b/src/basic/path-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/prioq.c b/src/basic/prioq.c
index 86c5c0e9b4..d2ec516d29 100644
--- a/src/basic/prioq.c
+++ b/src/basic/prioq.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/prioq.h b/src/basic/prioq.h
index 6a2451387c..113c73d040 100644
--- a/src/basic/prioq.h
+++ b/src/basic/prioq.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
index 4e8eba10ab..3505fa9c9a 100644
--- a/src/basic/proc-cmdline.c
+++ b/src/basic/proc-cmdline.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/proc-cmdline.h b/src/basic/proc-cmdline.h
index ce6e84995a..452642a2f5 100644
--- a/src/basic/proc-cmdline.h
+++ b/src/basic/proc-cmdline.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/ratelimit.c b/src/basic/ratelimit.c
index b62f3da76b..3ca5625e4d 100644
--- a/src/basic/ratelimit.c
+++ b/src/basic/ratelimit.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/ratelimit.h b/src/basic/ratelimit.h
index 98c81f6b9e..9c8dddf5ad 100644
--- a/src/basic/ratelimit.h
+++ b/src/basic/ratelimit.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/refcnt.h b/src/basic/refcnt.h
index 8a39d69fe4..1d77a6445a 100644
--- a/src/basic/refcnt.h
+++ b/src/basic/refcnt.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/replace-var.c b/src/basic/replace-var.c
index 8c3279b376..6a204b9ec3 100644
--- a/src/basic/replace-var.c
+++ b/src/basic/replace-var.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/replace-var.h b/src/basic/replace-var.h
index 7eaee93a3e..78412910b2 100644
--- a/src/basic/replace-var.h
+++ b/src/basic/replace-var.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
index 44f885db16..7540b43215 100644
--- a/src/basic/rlimit-util.c
+++ b/src/basic/rlimit-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
@@ -22,10 +20,14 @@
#include <errno.h>
#include <sys/resource.h>
+#include "alloc-util.h"
+#include "extract-word.h"
+#include "formats-util.h"
#include "macro.h"
#include "missing.h"
#include "rlimit-util.h"
#include "string-table.h"
+#include "time-util.h"
int setrlimit_closest(int resource, const struct rlimit *rlim) {
struct rlimit highest, fixed;
@@ -51,6 +53,202 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
return 0;
}
+static int rlimit_parse_u64(const char *val, rlim_t *ret) {
+ uint64_t u;
+ int r;
+
+ assert(val);
+ assert(ret);
+
+ if (streq(val, "infinity")) {
+ *ret = RLIM_INFINITY;
+ return 0;
+ }
+
+ /* setrlimit(2) suggests rlim_t is always 64bit on Linux. */
+ assert_cc(sizeof(rlim_t) == sizeof(uint64_t));
+
+ r = safe_atou64(val, &u);
+ if (r < 0)
+ return r;
+ if (u >= (uint64_t) RLIM_INFINITY)
+ return -ERANGE;
+
+ *ret = (rlim_t) u;
+ return 0;
+}
+
+static int rlimit_parse_size(const char *val, rlim_t *ret) {
+ uint64_t u;
+ int r;
+
+ assert(val);
+ assert(ret);
+
+ if (streq(val, "infinity")) {
+ *ret = RLIM_INFINITY;
+ return 0;
+ }
+
+ r = parse_size(val, 1024, &u);
+ if (r < 0)
+ return r;
+ if (u >= (uint64_t) RLIM_INFINITY)
+ return -ERANGE;
+
+ *ret = (rlim_t) u;
+ return 0;
+}
+
+static int rlimit_parse_sec(const char *val, rlim_t *ret) {
+ uint64_t u;
+ usec_t t;
+ int r;
+
+ assert(val);
+ assert(ret);
+
+ if (streq(val, "infinity")) {
+ *ret = RLIM_INFINITY;
+ return 0;
+ }
+
+ r = parse_sec(val, &t);
+ if (r < 0)
+ return r;
+ if (t == USEC_INFINITY) {
+ *ret = RLIM_INFINITY;
+ return 0;
+ }
+
+ u = (uint64_t) DIV_ROUND_UP(t, USEC_PER_SEC);
+ if (u >= (uint64_t) RLIM_INFINITY)
+ return -ERANGE;
+
+ *ret = (rlim_t) u;
+ return 0;
+}
+
+static int rlimit_parse_usec(const char *val, rlim_t *ret) {
+ usec_t t;
+ int r;
+
+ assert(val);
+ assert(ret);
+
+ if (streq(val, "infinity")) {
+ *ret = RLIM_INFINITY;
+ return 0;
+ }
+
+ r = parse_time(val, &t, 1);
+ if (r < 0)
+ return r;
+ if (t == USEC_INFINITY) {
+ *ret = RLIM_INFINITY;
+ return 0;
+ }
+
+ *ret = (rlim_t) t;
+ return 0;
+}
+
+static int (*const rlimit_parse_table[_RLIMIT_MAX])(const char *val, rlim_t *ret) = {
+ [RLIMIT_CPU] = rlimit_parse_sec,
+ [RLIMIT_FSIZE] = rlimit_parse_size,
+ [RLIMIT_DATA] = rlimit_parse_size,
+ [RLIMIT_STACK] = rlimit_parse_size,
+ [RLIMIT_CORE] = rlimit_parse_size,
+ [RLIMIT_RSS] = rlimit_parse_size,
+ [RLIMIT_NOFILE] = rlimit_parse_u64,
+ [RLIMIT_AS] = rlimit_parse_size,
+ [RLIMIT_NPROC] = rlimit_parse_u64,
+ [RLIMIT_MEMLOCK] = rlimit_parse_size,
+ [RLIMIT_LOCKS] = rlimit_parse_u64,
+ [RLIMIT_SIGPENDING] = rlimit_parse_u64,
+ [RLIMIT_MSGQUEUE] = rlimit_parse_size,
+ [RLIMIT_NICE] = rlimit_parse_u64,
+ [RLIMIT_RTPRIO] = rlimit_parse_u64,
+ [RLIMIT_RTTIME] = rlimit_parse_usec,
+};
+
+int rlimit_parse_one(int resource, const char *val, rlim_t *ret) {
+ assert(val);
+ assert(ret);
+
+ if (resource < 0)
+ return -EINVAL;
+ if (resource >= _RLIMIT_MAX)
+ return -EINVAL;
+
+ return rlimit_parse_table[resource](val, ret);
+}
+
+int rlimit_parse(int resource, const char *val, struct rlimit *ret) {
+ _cleanup_free_ char *hard = NULL, *soft = NULL;
+ rlim_t hl, sl;
+ int r;
+
+ assert(val);
+ assert(ret);
+
+ r = extract_first_word(&val, &soft, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
+ if (r < 0)
+ return r;
+ if (r == 0)
+ return -EINVAL;
+
+ r = rlimit_parse_one(resource, soft, &sl);
+ if (r < 0)
+ return r;
+
+ r = extract_first_word(&val, &hard, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
+ if (r < 0)
+ return r;
+ if (!isempty(val))
+ return -EINVAL;
+ if (r == 0)
+ hl = sl;
+ else {
+ r = rlimit_parse_one(resource, hard, &hl);
+ if (r < 0)
+ return r;
+ if (sl > hl)
+ return -EILSEQ;
+ }
+
+ *ret = (struct rlimit) {
+ .rlim_cur = sl,
+ .rlim_max = hl,
+ };
+
+ return 0;
+}
+
+int rlimit_format(const struct rlimit *rl, char **ret) {
+ char *s = NULL;
+
+ assert(rl);
+ assert(ret);
+
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ s = strdup("infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+ (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+ (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+ (void) asprintf(&s, RLIM_FMT, rl->rlim_cur);
+ else
+ (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
+
+ if (!s)
+ return -ENOMEM;
+
+ *ret = s;
+ return 0;
+}
+
static const char* const rlimit_table[_RLIMIT_MAX] = {
[RLIMIT_CPU] = "LimitCPU",
[RLIMIT_FSIZE] = "LimitFSIZE",
diff --git a/src/basic/rlimit-util.h b/src/basic/rlimit-util.h
index 262f86dd04..d4594eccd6 100644
--- a/src/basic/rlimit-util.h
+++ b/src/basic/rlimit-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
@@ -30,4 +28,9 @@ int rlimit_from_string(const char *s) _pure_;
int setrlimit_closest(int resource, const struct rlimit *rlim);
+int rlimit_parse_one(int resource, const char *val, rlim_t *ret);
+int rlimit_parse(int resource, const char *val, struct rlimit *ret);
+
+int rlimit_format(const struct rlimit *rl, char **ret);
+
#define RLIMIT_MAKE_CONST(lim) ((struct rlimit) { lim, lim })
diff --git a/src/basic/rm-rf.c b/src/basic/rm-rf.c
index 4807561723..43816fd1bb 100644
--- a/src/basic/rm-rf.c
+++ b/src/basic/rm-rf.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/rm-rf.h b/src/basic/rm-rf.h
index 96579eb182..6d03268919 100644
--- a/src/basic/rm-rf.h
+++ b/src/basic/rm-rf.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c
index 5956c4fe43..6c63b9d652 100644
--- a/src/basic/selinux-util.c
+++ b/src/basic/selinux-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/selinux-util.h b/src/basic/selinux-util.h
index 0111f4c858..27e8edb41b 100644
--- a/src/basic/selinux-util.h
+++ b/src/basic/selinux-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/set.h b/src/basic/set.h
index 5fd7de08f9..2bff5062da 100644
--- a/src/basic/set.h
+++ b/src/basic/set.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/sigbus.c b/src/basic/sigbus.c
index fe2e2d1a28..0ce4f75684 100644
--- a/src/basic/sigbus.c
+++ b/src/basic/sigbus.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/sigbus.h b/src/basic/sigbus.h
index 23edc6d9cb..cce9eb201b 100644
--- a/src/basic/sigbus.h
+++ b/src/basic/sigbus.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/signal-util.c b/src/basic/signal-util.c
index 315efadd93..e3047b209b 100644
--- a/src/basic/signal-util.c
+++ b/src/basic/signal-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/signal-util.h b/src/basic/signal-util.h
index 5d94d1c363..72b10e8712 100644
--- a/src/basic/signal-util.h
+++ b/src/basic/signal-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c
index b9e4ff87d8..3a3df987df 100644
--- a/src/basic/smack-util.c
+++ b/src/basic/smack-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/smack-util.h b/src/basic/smack-util.h
index 1d85b52a33..f90ba0a027 100644
--- a/src/basic/smack-util.h
+++ b/src/basic/smack-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/socket-label.c b/src/basic/socket-label.c
index bd206586ce..35e9573aa4 100644
--- a/src/basic/socket-label.c
+++ b/src/basic/socket-label.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index f2bb3bab86..49e5f5b125 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
@@ -873,14 +871,13 @@ int send_one_fd_sa(
struct cmsghdr cmsghdr;
uint8_t buf[CMSG_SPACE(sizeof(int))];
} control = {};
- struct cmsghdr *cmsg;
-
struct msghdr mh = {
.msg_name = (struct sockaddr*) sa,
.msg_namelen = len,
.msg_control = &control,
.msg_controllen = sizeof(control),
};
+ struct cmsghdr *cmsg;
assert(transport_fd >= 0);
assert(fd >= 0);
diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h
index 2323ccf3ab..92edc1dc22 100644
--- a/src/basic/socket-util.h
+++ b/src/basic/socket-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/special.h b/src/basic/special.h
index f30458f25a..2fd03d9f75 100644
--- a/src/basic/special.h
+++ b/src/basic/special.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c
index 21a8fb77a1..309e84b93d 100644
--- a/src/basic/stat-util.c
+++ b/src/basic/stat-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h
index 8e031e6155..56d28f791e 100644
--- a/src/basic/stat-util.h
+++ b/src/basic/stat-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
index b36e8a947e..0a675571ff 100644
--- a/src/basic/stdio-util.h
+++ b/src/basic/stdio-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/strbuf.c b/src/basic/strbuf.c
index c9984bef08..77220c0251 100644
--- a/src/basic/strbuf.c
+++ b/src/basic/strbuf.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/strbuf.h b/src/basic/strbuf.h
index 69565f7e2c..a1632da0e8 100644
--- a/src/basic/strbuf.h
+++ b/src/basic/strbuf.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/string-table.c b/src/basic/string-table.c
index 4633a57f44..a1499ab126 100644
--- a/src/basic/string-table.c
+++ b/src/basic/string-table.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/string-table.h b/src/basic/string-table.h
index 588404ab5a..b180488fe8 100644
--- a/src/basic/string-table.h
+++ b/src/basic/string-table.h
@@ -1,6 +1,4 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/string-util.c b/src/basic/string-util.c
index cb75b09c74..0bde55f9d5 100644
--- a/src/basic/string-util.c
+++ b/src/basic/string-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/string-util.h b/src/basic/string-util.h
index 8ea18f45aa..ad0c813761 100644
--- a/src/basic/string-util.h
+++ b/src/basic/string-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/strv.c b/src/basic/strv.c
index 5532c53ad1..b5d4d8191b 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/strv.h b/src/basic/strv.h
index 560f90115c..7bfa54408d 100644
--- a/src/basic/strv.h
+++ b/src/basic/strv.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/strxcpyx.c b/src/basic/strxcpyx.c
index c454171de1..aaf11d21f6 100644
--- a/src/basic/strxcpyx.c
+++ b/src/basic/strxcpyx.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/strxcpyx.h b/src/basic/strxcpyx.h
index 02e22e6294..80ff58726b 100644
--- a/src/basic/strxcpyx.h
+++ b/src/basic/strxcpyx.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/syslog-util.c b/src/basic/syslog-util.c
index 7dc2761b6f..db3405154e 100644
--- a/src/basic/syslog-util.c
+++ b/src/basic/syslog-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/syslog-util.h b/src/basic/syslog-util.h
index eb79c6dbd8..5cb606a1bf 100644
--- a/src/basic/syslog-util.h
+++ b/src/basic/syslog-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
index bfc7cf870c..510f018d9b 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
@@ -42,10 +40,32 @@
#include "strv.h"
#include "time-util.h"
+static nsec_t timespec_load_nsec(const struct timespec *ts);
+
+static clockid_t map_clock_id(clockid_t c) {
+
+ /* Some more exotic archs (s390, ppc, …) lack the "ALARM" flavour of the clocks. Thus, clock_gettime() will
+ * fail for them. Since they are essentially the same as their non-ALARM pendants (their only difference is
+ * when timers are set on them), let's just map them accordingly. This way, we can get the correct time even on
+ * those archs. */
+
+ switch (c) {
+
+ case CLOCK_BOOTTIME_ALARM:
+ return CLOCK_BOOTTIME;
+
+ case CLOCK_REALTIME_ALARM:
+ return CLOCK_REALTIME;
+
+ default:
+ return c;
+ }
+}
+
usec_t now(clockid_t clock_id) {
struct timespec ts;
- assert_se(clock_gettime(clock_id, &ts) == 0);
+ assert_se(clock_gettime(map_clock_id(clock_id), &ts) == 0);
return timespec_load(&ts);
}
@@ -53,7 +73,7 @@ usec_t now(clockid_t clock_id) {
nsec_t now_nsec(clockid_t clock_id) {
struct timespec ts;
- assert_se(clock_gettime(clock_id, &ts) == 0);
+ assert_se(clock_gettime(map_clock_id(clock_id), &ts) == 0);
return timespec_load_nsec(&ts);
}
@@ -79,12 +99,7 @@ dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u) {
ts->realtime = u;
delta = (int64_t) now(CLOCK_REALTIME) - (int64_t) u;
- ts->monotonic = now(CLOCK_MONOTONIC);
-
- if ((int64_t) ts->monotonic > delta)
- ts->monotonic -= delta;
- else
- ts->monotonic = 0;
+ ts->monotonic = usec_sub(now(CLOCK_MONOTONIC), delta);
return ts;
}
@@ -100,12 +115,7 @@ dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u) {
ts->monotonic = u;
delta = (int64_t) now(CLOCK_MONOTONIC) - (int64_t) u;
-
- ts->realtime = now(CLOCK_REALTIME);
- if ((int64_t) ts->realtime > delta)
- ts->realtime -= delta;
- else
- ts->realtime = 0;
+ ts->realtime = usec_sub(now(CLOCK_REALTIME), delta);
return ts;
}
@@ -117,25 +127,15 @@ dual_timestamp* dual_timestamp_from_boottime_or_monotonic(dual_timestamp *ts, us
ts->realtime = ts->monotonic = USEC_INFINITY;
return ts;
}
- ts->realtime = now(CLOCK_REALTIME);
- ts->monotonic = now(CLOCK_MONOTONIC);
+ dual_timestamp_get(ts);
delta = (int64_t) now(clock_boottime_or_monotonic()) - (int64_t) u;
-
- if ((int64_t) ts->realtime > delta)
- ts->realtime -= delta;
- else
- ts->realtime = 0;
-
- if ((int64_t) ts->monotonic > delta)
- ts->monotonic -= delta;
- else
- ts->monotonic = 0;
+ ts->realtime = usec_sub(ts->realtime, delta);
+ ts->monotonic = usec_sub(ts->monotonic, delta);
return ts;
}
-
usec_t timespec_load(const struct timespec *ts) {
assert(ts);
@@ -151,7 +151,7 @@ usec_t timespec_load(const struct timespec *ts) {
(usec_t) ts->tv_nsec / NSEC_PER_USEC;
}
-nsec_t timespec_load_nsec(const struct timespec *ts) {
+static nsec_t timespec_load_nsec(const struct timespec *ts) {
assert(ts);
if (ts->tv_sec == (time_t) -1 &&
@@ -207,9 +207,11 @@ struct timeval *timeval_store(struct timeval *tv, usec_t u) {
return tv;
}
-static char *format_timestamp_internal(char *buf, size_t l, usec_t t, bool utc) {
+static char *format_timestamp_internal(char *buf, size_t l, usec_t t,
+ bool utc, bool us) {
struct tm tm;
time_t sec;
+ int k;
assert(buf);
assert(l > 0);
@@ -220,48 +222,36 @@ static char *format_timestamp_internal(char *buf, size_t l, usec_t t, bool utc)
sec = (time_t) (t / USEC_PER_SEC);
localtime_or_gmtime_r(&sec, &tm, utc);
- if (strftime(buf, l, "%a %Y-%m-%d %H:%M:%S %Z", &tm) <= 0)
+ if (us)
+ k = strftime(buf, l, "%a %Y-%m-%d %H:%M:%S", &tm);
+ else
+ k = strftime(buf, l, "%a %Y-%m-%d %H:%M:%S %Z", &tm);
+
+ if (k <= 0)
return NULL;
+ if (us) {
+ snprintf(buf + strlen(buf), l - strlen(buf), ".%06llu", (unsigned long long) (t % USEC_PER_SEC));
+ if (strftime(buf + strlen(buf), l - strlen(buf), " %Z", &tm) <= 0)
+ return NULL;
+ }
return buf;
}
char *format_timestamp(char *buf, size_t l, usec_t t) {
- return format_timestamp_internal(buf, l, t, false);
+ return format_timestamp_internal(buf, l, t, false, false);
}
char *format_timestamp_utc(char *buf, size_t l, usec_t t) {
- return format_timestamp_internal(buf, l, t, true);
-}
-
-static char *format_timestamp_internal_us(char *buf, size_t l, usec_t t, bool utc) {
- struct tm tm;
- time_t sec;
-
- assert(buf);
- assert(l > 0);
-
- if (t <= 0 || t == USEC_INFINITY)
- return NULL;
-
- sec = (time_t) (t / USEC_PER_SEC);
- localtime_or_gmtime_r(&sec, &tm, utc);
-
- if (strftime(buf, l, "%a %Y-%m-%d %H:%M:%S", &tm) <= 0)
- return NULL;
- snprintf(buf + strlen(buf), l - strlen(buf), ".%06llu", (unsigned long long) (t % USEC_PER_SEC));
- if (strftime(buf + strlen(buf), l - strlen(buf), " %Z", &tm) <= 0)
- return NULL;
-
- return buf;
+ return format_timestamp_internal(buf, l, t, true, false);
}
char *format_timestamp_us(char *buf, size_t l, usec_t t) {
- return format_timestamp_internal_us(buf, l, t, false);
+ return format_timestamp_internal(buf, l, t, false, true);
}
char *format_timestamp_us_utc(char *buf, size_t l, usec_t t) {
- return format_timestamp_internal_us(buf, l, t, true);
+ return format_timestamp_internal(buf, l, t, true, true);
}
char *format_timestamp_relative(char *buf, size_t l, usec_t t) {
diff --git a/src/basic/time-util.h b/src/basic/time-util.h
index 7321e3c670..9894e626c5 100644
--- a/src/basic/time-util.h
+++ b/src/basic/time-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
@@ -69,7 +67,7 @@ typedef struct dual_timestamp {
#define FORMAT_TIMESTAMP_RELATIVE_MAX 256
#define FORMAT_TIMESPAN_MAX 64
-#define TIME_T_MAX (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1)
+#define TIME_T_MAX (time_t)((UINTMAX_C(1) << ((sizeof(time_t) << 3) - 1)) - 1)
#define DUAL_TIMESTAMP_NULL ((struct dual_timestamp) { 0ULL, 0ULL })
@@ -92,8 +90,6 @@ struct timespec *timespec_store(struct timespec *ts, usec_t u);
usec_t timeval_load(const struct timeval *tv) _pure_;
struct timeval *timeval_store(struct timeval *tv, usec_t u);
-nsec_t timespec_load_nsec(const struct timespec *ts) _pure_;
-
char *format_timestamp(char *buf, size_t l, usec_t t);
char *format_timestamp_utc(char *buf, size_t l, usec_t t);
char *format_timestamp_us(char *buf, size_t l, usec_t t);
@@ -127,3 +123,29 @@ time_t mktime_or_timegm(struct tm *tm, bool utc);
struct tm *localtime_or_gmtime_r(const time_t *t, struct tm *tm, bool utc);
unsigned long usec_to_jiffies(usec_t usec);
+
+static inline usec_t usec_add(usec_t a, usec_t b) {
+ usec_t c;
+
+ /* Adds two time values, and makes sure USEC_INFINITY as input results as USEC_INFINITY in output, and doesn't
+ * overflow. */
+
+ c = a + b;
+ if (c < a || c < b) /* overflow check */
+ return USEC_INFINITY;
+
+ return c;
+}
+
+static inline usec_t usec_sub(usec_t timestamp, int64_t delta) {
+ if (delta < 0)
+ return usec_add(timestamp, (usec_t) (-delta));
+
+ if (timestamp == USEC_INFINITY) /* Make sure infinity doesn't degrade */
+ return USEC_INFINITY;
+
+ if (timestamp < (usec_t) delta)
+ return 0;
+
+ return timestamp - delta;
+}
diff --git a/src/basic/umask-util.h b/src/basic/umask-util.h
index 8ed34658b4..359d87d27c 100644
--- a/src/basic/umask-util.h
+++ b/src/basic/umask-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/unaligned.h b/src/basic/unaligned.h
index a8115eaa1f..79be645bed 100644
--- a/src/basic/unaligned.h
+++ b/src/basic/unaligned.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c
index d4a3062658..fe883b95c7 100644
--- a/src/basic/unit-name.c
+++ b/src/basic/unit-name.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/unit-name.h b/src/basic/unit-name.h
index 03c1a6e4ac..f209a84634 100644
--- a/src/basic/unit-name.h
+++ b/src/basic/unit-name.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index 70a6e1f5e4..19155bce53 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/user-util.h b/src/basic/user-util.h
index 6106e138be..c23f1d485d 100644
--- a/src/basic/user-util.h
+++ b/src/basic/user-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/utf8.c b/src/basic/utf8.c
index 3f024f7e58..629db123cd 100644
--- a/src/basic/utf8.c
+++ b/src/basic/utf8.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/utf8.h b/src/basic/utf8.h
index 3e2e35b967..12c272d66e 100644
--- a/src/basic/utf8.h
+++ b/src/basic/utf8.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/util.c b/src/basic/util.c
index 4434ecfdf6..ea1bed7ceb 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/util.h b/src/basic/util.h
index b7bad76212..e095254b57 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/verbs.c b/src/basic/verbs.c
index 6dded9fb77..d9cdb38d65 100644
--- a/src/basic/verbs.c
+++ b/src/basic/verbs.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/verbs.h b/src/basic/verbs.h
index 4132cad773..7b5e18510f 100644
--- a/src/basic/verbs.h
+++ b/src/basic/verbs.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/virt.c b/src/basic/virt.c
index 0ffc2769d2..19b6318e3d 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/virt.h b/src/basic/virt.h
index aca961867c..a538f07f6b 100644
--- a/src/basic/virt.h
+++ b/src/basic/virt.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/web-util.c b/src/basic/web-util.c
index 68ec04021b..595688ed93 100644
--- a/src/basic/web-util.c
+++ b/src/basic/web-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/web-util.h b/src/basic/web-util.h
index 40c1509eb8..e6bb6b53f5 100644
--- a/src/basic/web-util.h
+++ b/src/basic/web-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c
index 960209282f..8d7f14f382 100644
--- a/src/basic/xattr-util.c
+++ b/src/basic/xattr-util.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/xattr-util.h b/src/basic/xattr-util.h
index a5134cba89..6fa097bf7e 100644
--- a/src/basic/xattr-util.h
+++ b/src/basic/xattr-util.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***
diff --git a/src/basic/xml.c b/src/basic/xml.c
index b9976cf5f1..1dbeac7324 100644
--- a/src/basic/xml.c
+++ b/src/basic/xml.c
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
diff --git a/src/basic/xml.h b/src/basic/xml.h
index b256b0ba10..41cb69f0dc 100644
--- a/src/basic/xml.h
+++ b/src/basic/xml.h
@@ -1,5 +1,3 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
#pragma once
/***