summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS56
-rw-r--r--src/backlight/backlight.c3
-rw-r--r--src/basic/async.c4
-rw-r--r--src/basic/fd-util.h4
-rw-r--r--src/basic/fdset.c4
-rw-r--r--src/basic/hashmap.c2
-rw-r--r--src/basic/siphash24.c106
-rw-r--r--src/basic/siphash24.h16
-rw-r--r--src/basic/util.c6
-rw-r--r--src/bus-proxyd/bus-xml-policy.c14
-rw-r--r--src/core/cgroup.c24
-rw-r--r--src/core/device.c3
-rw-r--r--src/core/swap.c3
-rw-r--r--src/core/umount.c3
-rw-r--r--src/gpt-auto-generator/gpt-auto-generator.c2
-rw-r--r--src/import/curl-util.c18
-rw-r--r--src/import/pull-common.c2
-rw-r--r--src/journal/coredump-vacuum.c15
-rw-r--r--src/journal/journalctl.c3
-rw-r--r--src/journal/journald-kmsg.c2
-rw-r--r--src/journal/journald-rate-limit.c4
-rw-r--r--src/journal/journald-server.c12
-rw-r--r--src/journal/mmap-cache.c13
-rw-r--r--src/libsystemd-network/dhcp-identifier.c10
-rw-r--r--src/libsystemd-network/network-internal.c2
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c2
-rw-r--r--src/libsystemd-network/sd-ipv4ll.c9
-rw-r--r--src/libsystemd-network/test-dhcp-server.c4
-rw-r--r--src/libsystemd/sd-bus/bus-bloom.c2
-rw-r--r--src/libsystemd/sd-event/sd-event.c7
-rw-r--r--src/libudev/libudev-device-private.c3
-rw-r--r--src/libudev/libudev-device.c2
-rw-r--r--src/libudev/libudev-enumerate.c2
-rw-r--r--src/libudev/libudev-monitor.c3
-rw-r--r--src/libudev/libudev-util.c3
-rw-r--r--src/libudev/libudev.c3
-rw-r--r--src/login/logind-session-device.c3
-rw-r--r--src/login/logind.c2
-rw-r--r--src/login/pam_systemd.c2
-rw-r--r--src/login/sysfs-show.c3
-rw-r--r--src/machine/machine.c5
-rw-r--r--src/machine/machined-dbus.c2
-rw-r--r--src/network/networkd-netdev.c2
-rw-r--r--src/nspawn/nspawn-network.c4
-rw-r--r--src/nspawn/nspawn.c6
-rw-r--r--src/remount-fs/remount-fs.c66
-rw-r--r--src/rfkill/rfkill.c2
-rw-r--r--src/test/test-libudev.c1
-rw-r--r--src/test/test-siphash24.c6
-rw-r--r--src/udev/ata_id/ata_id.c3
-rw-r--r--src/udev/cdrom_id/cdrom_id.c3
-rw-r--r--src/udev/scsi_id/scsi_id.c3
-rw-r--r--src/udev/scsi_id/scsi_serial.c3
-rw-r--r--src/udev/udevd.c8
54 files changed, 271 insertions, 224 deletions
diff --git a/NEWS b/NEWS
index 18c5e66012..49862b352d 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,10 @@ CHANGES WITH 228:
possible to pass in a set of file descriptors to use as
STDIN/STDOUT/STDERR for the invoked process.
+ * Slice units may now be created transiently via the bus APIs,
+ similar to the way service and scope units may already be
+ created transiently.
+
* Wherever systemd expects a calendar timestamp specification
(like in journalctl's --since= and --until= switches) UTC
timestamps are now supported. Timestamps suffixed with "UTC"
@@ -34,6 +38,13 @@ CHANGES WITH 228:
hierarchy when used on a btrfs file system with quota
enabled.
+ * tmpfiles' "v", "q" and "Q" will now create a plain directory
+ instead of a subvolume (even on a btrfs file system) if the
+ root directory is a plain directory, and not a
+ subvolume. This should simplify things with certain chroot()
+ environments which are not aware of the concept of btrfs
+ subvolumes.
+
* systemd-detect-virt gained a new --chroot switch to detect
whether execution takes place in a chroot() environment.
@@ -46,6 +57,28 @@ CHANGES WITH 228:
limit settings understand the usual min, h, day, ...
suffixes now.
+ * There's a new system.conf setting DefaultTasksMax= to
+ control the default TasksMax= setting for services and
+ scopes running on the system. (TasksMax= is the primary
+ setting that exposes the "pids" cgroup controller on systemd
+ and was introduced in the previous systemd release.) The
+ setting now defaults to 512, which means services that are
+ not explicitly configured otherwise will only be able to
+ create 512 processes or threads at maximum, from this
+ version on. Note that this means that thread- or
+ process-heavy services might need to be reconfigured to set
+ TasksMax= to a higher value. It is sufficient to set
+ TasksMax= in these specific unit files to a higher value, or
+ even "infinity". Similar, there's now a logind.conf setting
+ UserTasksMax= that defaults to 4096 and limits the total
+ number of processes or tasks each user may own
+ concurrently. nspawn containers also have the TasksMax=
+ value set by default now, to 8192. Note that all of this
+ only has an effect if the "pids" cgroup controller is
+ enabled in the kernel. The general benefit of these changes
+ should be a more robust and safer system, that provides a
+ certain amount of per-service fork() bomb protection.
+
* systemd-nspawn gained the new --network-veth-extra= switch
to define additional and arbitrarily-named virtual Ethernet
links between the host and the container.
@@ -142,17 +175,18 @@ CHANGES WITH 228:
Contributions from: Andrew Jones, Beniamino Galvani, Boyuan
Yang, Daniel Machon, Daniel Mack, David Herrmann, David
Reynolds, David Strauss, Dongsu Park, Evgeny Vereshchagin,
- Filipe Brandenburger, Franck Bui, Hristo Venev, Iago López
- Galeiras, Jan Engelhardt, Jan Janssen, Jan Synacek, Jesus
- Ornelas Aguayo, Karel Zak, kayrus, Kay Sievers, Lennart
- Poettering, Mantas Mikulėnas, Marcel Holtmann, Marcin Bachry,
- Marcos Alano, Marcos Mello, Mark Theunissen, Martin Pitt,
- Michael Marineau, Michael Olbrich, Michal Schmidt, Michal
- Sekletar, Mirco Tischler, Nick Owens, Nicolas Cornu, Patrik
- Flykt, Peter Hutterer, reverendhomer, Ronny Chevalier,
- Sangjung Woo, Seong-ho Cho, Shawn Landden, Susant Sahani,
- Thomas Haller, Thomas Hindoe Paaboel Andersen, Tom Gundersen,
- Torstein Husebø, Vito Caputo, Zbigniew Jędrzejewski-Szmek
+ Felipe Sateler, Filipe Brandenburger, Franck Bui, Hristo
+ Venev, Iago López Galeiras, Jan Engelhardt, Jan Janssen, Jan
+ Synacek, Jesus Ornelas Aguayo, Karel Zak, kayrus, Kay Sievers,
+ Lennart Poettering, Liu Yuan Yuan, Mantas Mikulėnas, Marcel
+ Holtmann, Marcin Bachry, Marcos Alano, Marcos Mello, Mark
+ Theunissen, Martin Pitt, Michael Marineau, Michael Olbrich,
+ Michal Schmidt, Michal Sekletar, Mirco Tischler, Nick Owens,
+ Nicolas Cornu, Patrik Flykt, Peter Hutterer, reverendhomer,
+ Ronny Chevalier, Sangjung Woo, Seong-ho Cho, Shawn Landden,
+ Susant Sahani, Thomas Haller, Thomas Hindoe Paaboel Andersen,
+ Tom Gundersen, Torstein Husebø, Vito Caputo, Zbigniew
+ Jędrzejewski-Szmek
-- Berlin, 2015-11-XX
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
index a2da976bb6..b0fa079fec 100644
--- a/src/backlight/backlight.c
+++ b/src/backlight/backlight.c
@@ -19,11 +19,12 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "libudev.h"
+
#include "alloc-util.h"
#include "def.h"
#include "escape.h"
#include "fileio.h"
-#include "libudev.h"
#include "mkdir.h"
#include "parse-util.h"
#include "proc-cmdline.h"
diff --git a/src/basic/async.c b/src/basic/async.c
index c3135f0efe..cfc5d224e1 100644
--- a/src/basic/async.c
+++ b/src/basic/async.c
@@ -68,7 +68,7 @@ int asynchronous_sync(void) {
}
static void *close_thread(void *p) {
- assert_se(close_nointr(PTR_TO_INT(p)) != -EBADF);
+ assert_se(close_nointr(PTR_TO_FD(p)) != -EBADF);
return NULL;
}
@@ -84,7 +84,7 @@ int asynchronous_close(int fd) {
if (fd >= 0) {
PROTECT_ERRNO;
- r = asynchronous_job(close_thread, INT_TO_PTR(fd));
+ r = asynchronous_job(close_thread, FD_TO_PTR(fd));
if (r < 0)
assert_se(close_nointr(fd) != -EBADF);
}
diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
index 1ca10f0383..0e9182d75b 100644
--- a/src/basic/fd-util.h
+++ b/src/basic/fd-util.h
@@ -28,6 +28,10 @@
#include "macro.h"
+/* Make sure we can distinguish fd 0 and NULL */
+#define FD_TO_PTR(fd) INT_TO_PTR((fd)+1)
+#define PTR_TO_FD(p) (PTR_TO_INT(p)-1)
+
int close_nointr(int fd);
int safe_close(int fd);
void safe_close_pair(int p[]);
diff --git a/src/basic/fdset.c b/src/basic/fdset.c
index fd2e1149f5..e5452f3bb0 100644
--- a/src/basic/fdset.c
+++ b/src/basic/fdset.c
@@ -36,10 +36,6 @@
#define MAKE_SET(s) ((Set*) s)
#define MAKE_FDSET(s) ((FDSet*) s)
-/* Make sure we can distinguish fd 0 and NULL */
-#define FD_TO_PTR(fd) INT_TO_PTR((fd)+1)
-#define PTR_TO_FD(p) (PTR_TO_INT(p)-1)
-
FDSet *fdset_new(void) {
return MAKE_FDSET(set_new(NULL));
}
diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c
index d88ceb40aa..6e501ef6ff 100644
--- a/src/basic/hashmap.c
+++ b/src/basic/hashmap.c
@@ -380,7 +380,7 @@ static unsigned base_bucket_hash(HashmapBase *h, const void *p) {
h->hash_ops->hash(p, &state);
- siphash24_finalize(&hash, &state);
+ hash = siphash24_finalize(&state);
return (unsigned) (hash % n_buckets(h));
}
diff --git a/src/basic/siphash24.c b/src/basic/siphash24.c
index 485e0059cb..10fc56da69 100644
--- a/src/basic/siphash24.c
+++ b/src/basic/siphash24.c
@@ -53,37 +53,40 @@ void siphash24_init(struct siphash *state, const uint8_t k[16]) {
assert(state);
assert(k);
- k0 = le64toh(*(le64_t*) k);
- k1 = le64toh(*(le64_t*) (k + 8));
-
- /* "somepseudorandomlygeneratedbytes" */
- state->v0 = 0x736f6d6570736575ULL ^ k0;
- state->v1 = 0x646f72616e646f6dULL ^ k1;
- state->v2 = 0x6c7967656e657261ULL ^ k0;
- state->v3 = 0x7465646279746573ULL ^ k1;
- state->padding = 0;
- state->inlen = 0;
+ k0 = unaligned_read_le64(k);
+ k1 = unaligned_read_le64(k + 8);
+
+ *state = (struct siphash) {
+ /* "somepseudorandomlygeneratedbytes" */
+ .v0 = 0x736f6d6570736575ULL ^ k0,
+ .v1 = 0x646f72616e646f6dULL ^ k1,
+ .v2 = 0x6c7967656e657261ULL ^ k0,
+ .v3 = 0x7465646279746573ULL ^ k1,
+ .padding = 0,
+ .inlen = 0,
+ };
}
void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) {
- uint64_t m;
+
const uint8_t *in = _in;
const uint8_t *end = in + inlen;
- unsigned left = state->inlen & 7;
+ size_t left = state->inlen & 7;
+ uint64_t m;
assert(in);
assert(state);
- /* update total length */
+ /* Update total length */
state->inlen += inlen;
- /* if padding exists, fill it out */
+ /* If padding exists, fill it out */
if (left > 0) {
- for ( ; in < end && left < 8; in ++, left ++ )
- state->padding |= ( ( uint64_t )*in ) << (left * 8);
+ for ( ; in < end && left < 8; in ++, left ++)
+ state->padding |= ((uint64_t) *in) << (left * 8);
if (in == end && left < 8)
- /* we did not have enough input to fill out the padding completely */
+ /* We did not have enough input to fill out the padding completely */
return;
#ifdef DEBUG
@@ -93,6 +96,7 @@ void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) {
printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3);
printf("(%3zu) compress padding %08x %08x\n", state->inlen, (uint32_t) (state->padding >> 32), (uint32_t)state->padding);
#endif
+
state->v3 ^= state->padding;
sipround(state);
sipround(state);
@@ -101,9 +105,9 @@ void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) {
state->padding = 0;
}
- end -= ( state->inlen % sizeof (uint64_t) );
+ end -= (state->inlen % sizeof(uint64_t));
- for ( ; in < end; in += 8 ) {
+ for ( ; in < end; in += 8) {
m = unaligned_read_le64(in);
#ifdef DEBUG
printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
@@ -119,38 +123,41 @@ void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) {
}
left = state->inlen & 7;
-
- switch(left)
- {
- case 7: state->padding |= ((uint64_t) in[6]) << 48;
-
- case 6: state->padding |= ((uint64_t) in[5]) << 40;
-
- case 5: state->padding |= ((uint64_t) in[4]) << 32;
-
- case 4: state->padding |= ((uint64_t) in[3]) << 24;
-
- case 3: state->padding |= ((uint64_t) in[2]) << 16;
-
- case 2: state->padding |= ((uint64_t) in[1]) << 8;
-
- case 1: state->padding |= ((uint64_t) in[0]); break;
-
- case 0: break;
+ switch (left) {
+ case 7:
+ state->padding |= ((uint64_t) in[6]) << 48;
+ case 6:
+ state->padding |= ((uint64_t) in[5]) << 40;
+ case 5:
+ state->padding |= ((uint64_t) in[4]) << 32;
+ case 4:
+ state->padding |= ((uint64_t) in[3]) << 24;
+ case 3:
+ state->padding |= ((uint64_t) in[2]) << 16;
+ case 2:
+ state->padding |= ((uint64_t) in[1]) << 8;
+ case 1:
+ state->padding |= ((uint64_t) in[0]);
+ case 0:
+ break;
}
}
-void siphash24_finalize(uint64_t *out, struct siphash *state) {
+uint64_t siphash24_finalize(struct siphash *state) {
uint64_t b;
- b = state->padding | (( ( uint64_t )state->inlen ) << 56);
+ assert(state);
+
+ b = state->padding | (((uint64_t) state->inlen) << 56);
+
#ifdef DEBUG
- printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t)state->v0);
- printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t)state->v1);
- printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t)state->v2);
- printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t)state->v3);
+ printf("(%3zu) v0 %08x %08x\n", state->inlen, (uint32_t) (state->v0 >> 32), (uint32_t) state->v0);
+ printf("(%3zu) v1 %08x %08x\n", state->inlen, (uint32_t) (state->v1 >> 32), (uint32_t) state->v1);
+ printf("(%3zu) v2 %08x %08x\n", state->inlen, (uint32_t) (state->v2 >> 32), (uint32_t) state->v2);
+ printf("(%3zu) v3 %08x %08x\n", state->inlen, (uint32_t) (state->v3 >> 32), (uint32_t) state->v3);
printf("(%3zu) padding %08x %08x\n", state->inlen, (uint32_t) (state->padding >> 32), (uint32_t) state->padding);
#endif
+
state->v3 ^= b;
sipround(state);
sipround(state);
@@ -169,14 +176,17 @@ void siphash24_finalize(uint64_t *out, struct siphash *state) {
sipround(state);
sipround(state);
- *(le64_t*)out = htole64(state->v0 ^ state->v1 ^ state->v2 ^ state->v3);
+ return state->v0 ^ state->v1 ^ state->v2 ^ state->v3;
}
-/* SipHash-2-4 */
-void siphash24(uint64_t *out, const void *_in, size_t inlen, const uint8_t k[16]) {
+uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[16]) {
struct siphash state;
+ assert(in);
+ assert(k);
+
siphash24_init(&state, k);
- siphash24_compress(_in, inlen, &state);
- siphash24_finalize(out, &state);
+ siphash24_compress(in, inlen, &state);
+
+ return siphash24_finalize(&state);
}
diff --git a/src/basic/siphash24.h b/src/basic/siphash24.h
index dc08077d53..ba4f7d01b6 100644
--- a/src/basic/siphash24.h
+++ b/src/basic/siphash24.h
@@ -4,16 +4,16 @@
#include <sys/types.h>
struct siphash {
- uint64_t v0;
- uint64_t v1;
- uint64_t v2;
- uint64_t v3;
- uint64_t padding;
- size_t inlen;
+ uint64_t v0;
+ uint64_t v1;
+ uint64_t v2;
+ uint64_t v3;
+ uint64_t padding;
+ size_t inlen;
};
void siphash24_init(struct siphash *state, const uint8_t k[16]);
void siphash24_compress(const void *in, size_t inlen, struct siphash *state);
-void siphash24_finalize(uint64_t *out, struct siphash *state);
+uint64_t siphash24_finalize(struct siphash *state);
-void siphash24(uint64_t *out, const void *in, size_t inlen, const uint8_t k[16]);
+uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[16]);
diff --git a/src/basic/util.c b/src/basic/util.c
index 3e4ec42a28..58617b354a 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -206,7 +206,7 @@ static int do_execute(char **directories, usec_t timeout, char *argv[]) {
log_debug("Spawned %s as " PID_FMT ".", path, pid);
- r = hashmap_put(pids, UINT_TO_PTR(pid), path);
+ r = hashmap_put(pids, PID_TO_PTR(pid), path);
if (r < 0)
return log_oom();
path = NULL;
@@ -224,10 +224,10 @@ static int do_execute(char **directories, usec_t timeout, char *argv[]) {
_cleanup_free_ char *path = NULL;
pid_t pid;
- pid = PTR_TO_UINT(hashmap_first_key(pids));
+ pid = PTR_TO_PID(hashmap_first_key(pids));
assert(pid > 0);
- path = hashmap_remove(pids, UINT_TO_PTR(pid));
+ path = hashmap_remove(pids, PID_TO_PTR(pid));
assert(path);
wait_for_terminate_and_warn(path, pid, true);
diff --git a/src/bus-proxyd/bus-xml-policy.c b/src/bus-proxyd/bus-xml-policy.c
index f0834e9525..debd58ce8b 100644
--- a/src/bus-proxyd/bus-xml-policy.c
+++ b/src/bus-proxyd/bus-xml-policy.c
@@ -392,11 +392,11 @@ static int file_load(Policy *p, const char *path) {
} else {
PolicyItem *first;
- first = hashmap_get(p->user_items, UINT32_TO_PTR(i->uid));
+ first = hashmap_get(p->user_items, UID_TO_PTR(i->uid));
item_append(i, &first);
i->uid_valid = true;
- r = hashmap_replace(p->user_items, UINT32_TO_PTR(i->uid), first);
+ r = hashmap_replace(p->user_items, UID_TO_PTR(i->uid), first);
if (r < 0) {
LIST_REMOVE(items, first, i);
return log_oom();
@@ -424,11 +424,11 @@ static int file_load(Policy *p, const char *path) {
} else {
PolicyItem *first;
- first = hashmap_get(p->group_items, UINT32_TO_PTR(i->gid));
+ first = hashmap_get(p->group_items, GID_TO_PTR(i->gid));
item_append(i, &first);
i->gid_valid = true;
- r = hashmap_replace(p->group_items, UINT32_TO_PTR(i->gid), first);
+ r = hashmap_replace(p->group_items, GID_TO_PTR(i->gid), first);
if (r < 0) {
LIST_REMOVE(items, first, i);
return log_oom();
@@ -787,7 +787,7 @@ static int policy_check(Policy *p, const struct policy_check_filter *filter) {
verdict = check_policy_items(p->default_items, filter);
if (filter->gid != GID_INVALID) {
- items = hashmap_get(p->group_items, UINT32_TO_PTR(filter->gid));
+ items = hashmap_get(p->group_items, GID_TO_PTR(filter->gid));
if (items) {
v = check_policy_items(items, filter);
if (v != DUNNO)
@@ -796,7 +796,7 @@ static int policy_check(Policy *p, const struct policy_check_filter *filter) {
}
if (filter->uid != UID_INVALID) {
- items = hashmap_get(p->user_items, UINT32_TO_PTR(filter->uid));
+ items = hashmap_get(p->user_items, UID_TO_PTR(filter->uid));
if (items) {
v = check_policy_items(items, filter);
if (v != DUNNO)
@@ -1155,7 +1155,7 @@ static void dump_hashmap_items(Hashmap *h) {
void *k;
HASHMAP_FOREACH_KEY(i, k, h, j) {
- printf("\t%s Item for %u:\n", draw_special_char(DRAW_ARROW), PTR_TO_UINT(k));
+ printf("\t%s Item for " UID_FMT ":\n", draw_special_char(DRAW_ARROW), PTR_TO_UID(k));
dump_items(i, "\t\t");
}
}
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index bed01fde21..d122175417 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -217,7 +217,7 @@ static int whitelist_device(const char *path, const char *node, const char *acc)
r = cg_set_attribute("devices", path, "devices.allow", buf);
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EINVAL) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EINVAL, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set devices.allow on %s: %m", path);
return r;
@@ -288,7 +288,7 @@ static int whitelist_major(const char *path, const char *name, char type, const
r = cg_set_attribute("devices", path, "devices.allow", buf);
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EINVAL) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EINVAL, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set devices.allow on %s: %m", path);
}
@@ -328,13 +328,13 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, u
c->cpu_shares != CGROUP_CPU_SHARES_INVALID ? c->cpu_shares : CGROUP_CPU_SHARES_DEFAULT);
r = cg_set_attribute("cpu", path, "cpu.shares", buf);
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set cpu.shares on %s: %m", path);
sprintf(buf, USEC_FMT "\n", CGROUP_CPU_QUOTA_PERIOD_USEC);
r = cg_set_attribute("cpu", path, "cpu.cfs_period_us", buf);
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set cpu.cfs_period_us on %s: %m", path);
if (c->cpu_quota_per_sec_usec != USEC_INFINITY) {
@@ -343,7 +343,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, u
} else
r = cg_set_attribute("cpu", path, "cpu.cfs_quota_us", "-1");
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set cpu.cfs_quota_us on %s: %m", path);
}
@@ -359,7 +359,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, u
c->blockio_weight != CGROUP_BLKIO_WEIGHT_INVALID ? c->blockio_weight : CGROUP_BLKIO_WEIGHT_DEFAULT);
r = cg_set_attribute("blkio", path, "blkio.weight", buf);
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set blkio.weight on %s: %m", path);
/* FIXME: no way to reset this list */
@@ -373,7 +373,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, u
sprintf(buf, "%u:%u %" PRIu64 "\n", major(dev), minor(dev), w->weight);
r = cg_set_attribute("blkio", path, "blkio.weight_device", buf);
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set blkio.weight_device on %s: %m", path);
}
}
@@ -392,7 +392,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, u
sprintf(buf, "%u:%u %" PRIu64 "\n", major(dev), minor(dev), b->bandwidth);
r = cg_set_attribute("blkio", path, a, buf);
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set %s on %s: %m", a, path);
}
}
@@ -416,7 +416,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, u
}
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set memory.limit_in_bytes/memory.max on %s: %m", path);
}
@@ -432,7 +432,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, u
else
r = cg_set_attribute("devices", path, "devices.allow", "a");
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EINVAL) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EINVAL, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to reset devices.list on %s: %m", path);
if (c->device_policy == CGROUP_CLOSED ||
@@ -494,7 +494,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, u
r = cg_set_attribute("pids", path, "pids.max", "max");
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set pids.max on %s: %m", path);
}
@@ -505,7 +505,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupMask mask, const char *path, u
r = cg_set_attribute("net_cls", path, "net_cls.classid", buf);
if (r < 0)
- log_full_errno(IN_SET(r, -ENOENT, -EROFS) ? LOG_DEBUG : LOG_WARNING, r,
+ log_full_errno(IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
"Failed to set net_cls.classid on %s: %m", path);
}
}
diff --git a/src/core/device.c b/src/core/device.c
index 5b7130ba97..bcd4d1146b 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -22,10 +22,11 @@
#include <errno.h>
#include <sys/epoll.h>
+#include "libudev.h"
+
#include "alloc-util.h"
#include "dbus-device.h"
#include "device.h"
-#include "libudev.h"
#include "log.h"
#include "parse-util.h"
#include "path-util.h"
diff --git a/src/core/swap.c b/src/core/swap.c
index f9e1ebad49..ee0838e676 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -24,6 +24,8 @@
#include <sys/stat.h>
#include <unistd.h>
+#include "libudev.h"
+
#include "alloc-util.h"
#include "dbus-swap.h"
#include "escape.h"
@@ -31,7 +33,6 @@
#include "fd-util.h"
#include "formats-util.h"
#include "fstab-util.h"
-#include "libudev.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
diff --git a/src/core/umount.c b/src/core/umount.c
index 954e50528d..9d1f7660db 100644
--- a/src/core/umount.c
+++ b/src/core/umount.c
@@ -27,11 +27,12 @@
#include <sys/mount.h>
#include <sys/swap.h>
+#include "libudev.h"
+
#include "alloc-util.h"
#include "escape.h"
#include "fd-util.h"
#include "fstab-util.h"
-#include "libudev.h"
#include "list.h"
#include "mount-setup.h"
#include "path-util.h"
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index c32bf1c9d6..ce8cecc5cb 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -24,6 +24,7 @@
#include <sys/statfs.h>
#include <unistd.h>
+#include "libudev.h"
#include "sd-id128.h"
#include "alloc-util.h"
@@ -36,7 +37,6 @@
#include "fstab-util.h"
#include "generator.h"
#include "gpt.h"
-#include "libudev.h"
#include "missing.h"
#include "mkdir.h"
#include "mount-util.h"
diff --git a/src/import/curl-util.c b/src/import/curl-util.c
index 4278466df1..8e531a64fa 100644
--- a/src/import/curl-util.c
+++ b/src/import/curl-util.c
@@ -48,9 +48,7 @@ static int curl_glue_on_io(sd_event_source *s, int fd, uint32_t revents, void *u
assert(s);
assert(g);
- translated_fd = PTR_TO_INT(hashmap_get(g->translate_fds, INT_TO_PTR(fd+1)));
- assert(translated_fd > 0);
- translated_fd--;
+ translated_fd = PTR_TO_FD(hashmap_get(g->translate_fds, FD_TO_PTR(fd)));
if ((revents & (EPOLLIN|EPOLLOUT)) == (EPOLLIN|EPOLLOUT))
action = CURL_POLL_INOUT;
@@ -79,7 +77,7 @@ static int curl_glue_socket_callback(CURLM *curl, curl_socket_t s, int action, v
assert(curl);
assert(g);
- io = hashmap_get(g->ios, INT_TO_PTR(s+1));
+ io = hashmap_get(g->ios, FD_TO_PTR(s));
if (action == CURL_POLL_REMOVE) {
if (io) {
@@ -91,8 +89,8 @@ static int curl_glue_socket_callback(CURLM *curl, curl_socket_t s, int action, v
sd_event_source_set_enabled(io, SD_EVENT_OFF);
sd_event_source_unref(io);
- hashmap_remove(g->ios, INT_TO_PTR(s+1));
- hashmap_remove(g->translate_fds, INT_TO_PTR(fd+1));
+ hashmap_remove(g->ios, FD_TO_PTR(s));
+ hashmap_remove(g->translate_fds, FD_TO_PTR(fd));
safe_close(fd);
}
@@ -143,17 +141,17 @@ static int curl_glue_socket_callback(CURLM *curl, curl_socket_t s, int action, v
sd_event_source_set_description(io, "curl-io");
- r = hashmap_put(g->ios, INT_TO_PTR(s+1), io);
+ r = hashmap_put(g->ios, FD_TO_PTR(s), io);
if (r < 0) {
log_oom();
sd_event_source_unref(io);
return -1;
}
- r = hashmap_put(g->translate_fds, INT_TO_PTR(fd+1), INT_TO_PTR(s+1));
+ r = hashmap_put(g->translate_fds, FD_TO_PTR(fd), FD_TO_PTR(s));
if (r < 0) {
log_oom();
- hashmap_remove(g->ios, INT_TO_PTR(s+1));
+ hashmap_remove(g->ios, FD_TO_PTR(s));
sd_event_source_unref(io);
return -1;
}
@@ -229,7 +227,7 @@ CurlGlue *curl_glue_unref(CurlGlue *g) {
fd = sd_event_source_get_io_fd(io);
assert(fd >= 0);
- hashmap_remove(g->translate_fds, INT_TO_PTR(fd+1));
+ hashmap_remove(g->translate_fds, FD_TO_PTR(fd));
safe_close(fd);
sd_event_source_unref(io);
diff --git a/src/import/pull-common.c b/src/import/pull-common.c
index 16b0c6160f..a83cffffa0 100644
--- a/src/import/pull-common.c
+++ b/src/import/pull-common.c
@@ -165,7 +165,7 @@ static int hash_url(const char *url, char **ret) {
assert(url);
- siphash24(&h, url, strlen(url), k.bytes);
+ h = siphash24(url, strlen(url), k.bytes);
if (asprintf(ret, "%"PRIx64, h) < 0)
return -ENOMEM;
diff --git a/src/journal/coredump-vacuum.c b/src/journal/coredump-vacuum.c
index 39bc2e4270..09ab60c6c4 100644
--- a/src/journal/coredump-vacuum.c
+++ b/src/journal/coredump-vacuum.c
@@ -157,8 +157,7 @@ int coredump_vacuum(int exclude_fd, uint64_t keep_free, uint64_t max_use) {
if (errno == ENOENT)
return 0;
- log_error_errno(errno, "Can't open coredump directory: %m");
- return -errno;
+ return log_error_errno(errno, "Can't open coredump directory: %m");
}
for (;;) {
@@ -183,7 +182,7 @@ int coredump_vacuum(int exclude_fd, uint64_t keep_free, uint64_t max_use) {
if (errno == ENOENT)
continue;
- log_warning("Failed to stat /var/lib/systemd/coredump/%s", de->d_name);
+ log_warning_errno(errno, "Failed to stat /var/lib/systemd/coredump/%s: %m", de->d_name);
continue;
}
@@ -201,7 +200,7 @@ int coredump_vacuum(int exclude_fd, uint64_t keep_free, uint64_t max_use) {
t = timespec_load(&st.st_mtim);
- c = hashmap_get(h, UINT32_TO_PTR(uid));
+ c = hashmap_get(h, UID_TO_PTR(uid));
if (c) {
if (t < c->oldest_mtime) {
@@ -229,7 +228,7 @@ int coredump_vacuum(int exclude_fd, uint64_t keep_free, uint64_t max_use) {
n->oldest_mtime = t;
- r = hashmap_put(h, UINT32_TO_PTR(uid), n);
+ r = hashmap_put(h, UID_TO_PTR(uid), n);
if (r < 0)
return log_oom();
@@ -259,8 +258,7 @@ int coredump_vacuum(int exclude_fd, uint64_t keep_free, uint64_t max_use) {
if (errno == ENOENT)
continue;
- log_error_errno(errno, "Failed to remove file %s: %m", worst->oldest_file);
- return -errno;
+ return log_error_errno(errno, "Failed to remove file %s: %m", worst->oldest_file);
} else
log_info("Removed old coredump %s.", worst->oldest_file);
}
@@ -268,6 +266,5 @@ int coredump_vacuum(int exclude_fd, uint64_t keep_free, uint64_t max_use) {
return 0;
fail:
- log_error_errno(errno, "Failed to read directory: %m");
- return -errno;
+ return log_error_errno(errno, "Failed to read directory: %m");
}
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 75a48c761c..d9a8063d31 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -2247,7 +2247,8 @@ int main(int argc, char *argv[]) {
if (arg_follow)
need_seek = true;
else {
- printf("-- No entries --\n");
+ if (!arg_quiet)
+ printf("-- No entries --\n");
goto finish;
}
}
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index 9a8d1e026b..e048e04716 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -25,6 +25,7 @@
#include <sys/socket.h>
#include <unistd.h>
+#include "libudev.h"
#include "sd-messages.h"
#include "escape.h"
@@ -34,7 +35,6 @@
#include "journald-kmsg.h"
#include "journald-server.h"
#include "journald-syslog.h"
-#include "libudev.h"
#include "parse-util.h"
#include "process-util.h"
#include "stdio-util.h"
diff --git a/src/journal/journald-rate-limit.c b/src/journal/journald-rate-limit.c
index 65e2c3e570..1c406aef8e 100644
--- a/src/journal/journald-rate-limit.c
+++ b/src/journal/journald-rate-limit.c
@@ -162,7 +162,7 @@ static JournalRateLimitGroup* journal_rate_limit_group_new(JournalRateLimit *r,
siphash24_init(&state, r->hash_key);
string_hash_func(g->id, &state);
- siphash24_finalize(&g->hash, &state);
+ g->hash = siphash24_finalize(&state);
journal_rate_limit_vacuum(r, ts);
@@ -230,7 +230,7 @@ int journal_rate_limit_test(JournalRateLimit *r, const char *id, int priority, u
siphash24_init(&state, r->hash_key);
string_hash_func(id, &state);
- siphash24_finalize(&h, &state);
+ h = siphash24_finalize(&state);
g = r->buckets[h % BUCKETS_MAX];
LIST_FOREACH(bucket, g, g)
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index b532616db6..7d11a568aa 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -28,6 +28,7 @@
#include <sys/statvfs.h>
#include <linux/sockios.h>
+#include "libudev.h"
#include "sd-daemon.h"
#include "sd-journal.h"
#include "sd-messages.h"
@@ -57,7 +58,6 @@
#include "journald-server.h"
#include "journald-stream.h"
#include "journald-syslog.h"
-#include "libudev.h"
#include "missing.h"
#include "mkdir.h"
#include "parse-util.h"
@@ -69,6 +69,7 @@
#include "socket-util.h"
#include "string-table.h"
#include "string-util.h"
+#include "user-util.h"
#define USER_JOURNALS_MAX 1024
@@ -281,7 +282,7 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
if (r < 0)
return s->system_journal;
- f = ordered_hashmap_get(s->user_journals, UINT32_TO_PTR(uid));
+ f = ordered_hashmap_get(s->user_journals, UID_TO_PTR(uid));
if (f)
return f;
@@ -302,7 +303,7 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
server_fix_perms(s, f, uid);
- r = ordered_hashmap_put(s->user_journals, UINT32_TO_PTR(uid), f);
+ r = ordered_hashmap_put(s->user_journals, UID_TO_PTR(uid), f);
if (r < 0) {
journal_file_close(f);
return s->system_journal;
@@ -348,7 +349,7 @@ void server_rotate(Server *s) {
(void) do_rotate(s, &s->system_journal, "system", s->seal, 0);
ORDERED_HASHMAP_FOREACH_KEY(f, k, s->user_journals, i) {
- r = do_rotate(s, &f, "user", s->seal, PTR_TO_UINT32(k));
+ r = do_rotate(s, &f, "user", s->seal, PTR_TO_UID(k));
if (r >= 0)
ordered_hashmap_replace(s->user_journals, k, f);
else if (!f)
@@ -359,7 +360,6 @@ void server_rotate(Server *s) {
void server_sync(Server *s) {
JournalFile *f;
- void *k;
Iterator i;
int r;
@@ -369,7 +369,7 @@ void server_sync(Server *s) {
log_warning_errno(r, "Failed to sync system journal, ignoring: %m");
}
- ORDERED_HASHMAP_FOREACH_KEY(f, k, s->user_journals, i) {
+ ORDERED_HASHMAP_FOREACH(f, s->user_journals, i) {
r = journal_file_set_offline(f);
if (r < 0)
log_warning_errno(r, "Failed to sync user journal, ignoring: %m");
diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
index 9540257895..5a07ddda76 100644
--- a/src/journal/mmap-cache.c
+++ b/src/journal/mmap-cache.c
@@ -24,6 +24,7 @@
#include <sys/mman.h>
#include "alloc-util.h"
+#include "fd-util.h"
#include "hashmap.h"
#include "list.h"
#include "log.h"
@@ -289,7 +290,7 @@ static void fd_free(FileDescriptor *f) {
window_free(f->windows);
if (f->cache)
- assert_se(hashmap_remove(f->cache->fds, INT_TO_PTR(f->fd + 1)));
+ assert_se(hashmap_remove(f->cache->fds, FD_TO_PTR(f->fd)));
free(f);
}
@@ -301,7 +302,7 @@ static FileDescriptor* fd_add(MMapCache *m, int fd) {
assert(m);
assert(fd >= 0);
- f = hashmap_get(m->fds, INT_TO_PTR(fd + 1));
+ f = hashmap_get(m->fds, FD_TO_PTR(fd));
if (f)
return f;
@@ -316,7 +317,7 @@ static FileDescriptor* fd_add(MMapCache *m, int fd) {
f->cache = m;
f->fd = fd;
- r = hashmap_put(m->fds, UINT_TO_PTR(fd + 1), f);
+ r = hashmap_put(m->fds, FD_TO_PTR(fd), f);
if (r < 0) {
free(f);
return NULL;
@@ -429,7 +430,7 @@ static int find_mmap(
assert(fd >= 0);
assert(size > 0);
- f = hashmap_get(m->fds, INT_TO_PTR(fd + 1));
+ f = hashmap_get(m->fds, FD_TO_PTR(fd));
if (!f)
return 0;
@@ -679,7 +680,7 @@ bool mmap_cache_got_sigbus(MMapCache *m, int fd) {
mmap_cache_process_sigbus(m);
- f = hashmap_get(m->fds, INT_TO_PTR(fd + 1));
+ f = hashmap_get(m->fds, FD_TO_PTR(fd));
if (!f)
return false;
@@ -698,7 +699,7 @@ void mmap_cache_close_fd(MMapCache *m, int fd) {
mmap_cache_process_sigbus(m);
- f = hashmap_get(m->fds, INT_TO_PTR(fd + 1));
+ f = hashmap_get(m->fds, FD_TO_PTR(fd));
if (!f)
return;
diff --git a/src/libsystemd-network/dhcp-identifier.c b/src/libsystemd-network/dhcp-identifier.c
index f8e6cb6ea9..d7ae865557 100644
--- a/src/libsystemd-network/dhcp-identifier.c
+++ b/src/libsystemd-network/dhcp-identifier.c
@@ -19,11 +19,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "libudev.h"
#include "sd-id128.h"
#include "dhcp-identifier.h"
#include "dhcp6-protocol.h"
-#include "libudev.h"
#include "network-internal.h"
#include "siphash24.h"
#include "sparse-endian.h"
@@ -52,7 +52,7 @@ int dhcp_identifier_set_duid_en(struct duid *duid, size_t *len) {
/* a bit of snake-oil perhaps, but no need to expose the machine-id
directly; duid->en.id might not be aligned, so we need to copy */
- siphash24(&hash, &machine_id, sizeof(machine_id), HASH_KEY.bytes);
+ hash = htole64(siphash24(&machine_id, sizeof(machine_id), HASH_KEY.bytes));
memcpy(duid->en.id, &hash, sizeof(duid->en.id));
return 0;
@@ -86,10 +86,12 @@ int dhcp_identifier_set_iaid(int ifindex, uint8_t *mac, size_t mac_len, void *_i
}
if (name)
- siphash24(&id, name, strlen(name), HASH_KEY.bytes);
+ id = siphash24(name, strlen(name), HASH_KEY.bytes);
else
/* fall back to MAC address if no predictable name available */
- siphash24(&id, mac, mac_len, HASH_KEY.bytes);
+ id = siphash24(mac, mac_len, HASH_KEY.bytes);
+
+ id = htole64(id);
/* fold into 32 bits */
unaligned_write_be32(_id, (id & 0xffffffff) ^ (id >> 32));
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
index 49a755c048..a4d4f1ae2f 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -81,7 +81,7 @@ int net_get_unique_predictable_data(struct udev_device *device, uint64_t *result
/* Let's hash the machine ID plus the device name. We
* use a fixed, but originally randomly created hash
* key here. */
- siphash24(result, v, sz, HASH_KEY.bytes);
+ *result = htole64(siphash24(v, sz, HASH_KEY.bytes));
return 0;
}
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index eeb59bb3da..277c88e2b9 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -753,7 +753,7 @@ int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message,
siphash24_init(&state, HASH_KEY.bytes);
client_id_hash_func(&req->client_id, &state);
- siphash24_finalize(&hash, &state);
+ hash = htole64(siphash24_finalize(&state));
next_offer = hash % server->pool_size;
for (i = 0; i < server->pool_size; i++) {
diff --git a/src/libsystemd-network/sd-ipv4ll.c b/src/libsystemd-network/sd-ipv4ll.c
index e69b1864d7..30a7ef5785 100644
--- a/src/libsystemd-network/sd-ipv4ll.c
+++ b/src/libsystemd-network/sd-ipv4ll.c
@@ -101,6 +101,8 @@ int sd_ipv4ll_new(sd_ipv4ll **ret) {
if (!ll)
return -ENOMEM;
+ ll->n_ref = 1;
+
r = sd_ipv4acd_new(&ll->acd);
if (r < 0)
return r;
@@ -109,8 +111,6 @@ int sd_ipv4ll_new(sd_ipv4ll **ret) {
if (r < 0)
return r;
- ll->n_ref = 1;
-
*ret = ll;
ll = NULL;
@@ -146,12 +146,11 @@ int sd_ipv4ll_set_mac(sd_ipv4ll *ll, const struct ether_addr *addr) {
uint64_t seed;
/* If no random data is set, generate some from the MAC */
- siphash24(&seed, &addr->ether_addr_octet,
- ETH_ALEN, HASH_KEY.bytes);
+ seed = siphash24(&addr->ether_addr_octet, ETH_ALEN, HASH_KEY.bytes);
assert_cc(sizeof(unsigned) <= 8);
- r = sd_ipv4ll_set_address_seed(ll, (unsigned)seed);
+ r = sd_ipv4ll_set_address_seed(ll, (unsigned) htole64(seed));
if (r < 0)
return r;
}
diff --git a/src/libsystemd-network/test-dhcp-server.c b/src/libsystemd-network/test-dhcp-server.c
index 62fdec46da..2b5f59e4d6 100644
--- a/src/libsystemd-network/test-dhcp-server.c
+++ b/src/libsystemd-network/test-dhcp-server.c
@@ -200,13 +200,11 @@ static void test_message_handler(void) {
static uint64_t client_id_hash_helper(DHCPClientId *id, uint8_t key[HASH_KEY_SIZE]) {
struct siphash state;
- uint64_t hash;
siphash24_init(&state, key);
client_id_hash_func(id, &state);
- siphash24_finalize(&hash, &state);
- return hash;
+ return htole64(siphash24_finalize(&state));
}
static void test_client_id_hash(void) {
diff --git a/src/libsystemd/sd-bus/bus-bloom.c b/src/libsystemd/sd-bus/bus-bloom.c
index 43668e37ee..c0c5d445eb 100644
--- a/src/libsystemd/sd-bus/bus-bloom.c
+++ b/src/libsystemd/sd-bus/bus-bloom.c
@@ -72,7 +72,7 @@ static void bloom_add_data(
for (d = 0; d < w; d++) {
if (c <= 0) {
- siphash24(&h, data, n, hash_keys[hash_index++].bytes);
+ h = siphash24(data, n, hash_keys[hash_index++].bytes);
c += 8;
}
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index ee4886700e..700ac691b5 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -34,6 +34,7 @@
#include "macro.h"
#include "missing.h"
#include "prioq.h"
+#include "process-util.h"
#include "set.h"
#include "signal-util.h"
#include "string-util.h"
@@ -808,7 +809,7 @@ static void source_disconnect(sd_event_source *s) {
s->event->n_enabled_child_sources--;
}
- (void) hashmap_remove(s->event->child_sources, INT_TO_PTR(s->child.pid));
+ (void) hashmap_remove(s->event->child_sources, PID_TO_PTR(s->child.pid));
event_gc_signal_data(s->event, &s->priority, SIGCHLD);
}
@@ -1188,7 +1189,7 @@ _public_ int sd_event_add_child(
if (r < 0)
return r;
- if (hashmap_contains(e->child_sources, INT_TO_PTR(pid)))
+ if (hashmap_contains(e->child_sources, PID_TO_PTR(pid)))
return -EBUSY;
s = source_new(e, !ret, SOURCE_CHILD);
@@ -1201,7 +1202,7 @@ _public_ int sd_event_add_child(
s->userdata = userdata;
s->enabled = SD_EVENT_ONESHOT;
- r = hashmap_put(e->child_sources, INT_TO_PTR(pid), s);
+ r = hashmap_put(e->child_sources, PID_TO_PTR(pid), s);
if (r < 0) {
source_free(s);
return r;
diff --git a/src/libudev/libudev-device-private.c b/src/libudev/libudev-device-private.c
index fa4e3a2b1e..2d3e62410c 100644
--- a/src/libudev/libudev-device-private.c
+++ b/src/libudev/libudev-device-private.c
@@ -18,10 +18,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include "libudev.h"
+
#include "device-private.h"
#include "libudev-device-internal.h"
#include "libudev-private.h"
-#include "libudev.h"
int udev_device_tag_index(struct udev_device *udev_device, struct udev_device *udev_device_old, bool add) {
sd_device *device_old = NULL;
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index b17ecd870d..814e016800 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -34,6 +34,7 @@
#include <sys/stat.h>
#include <unistd.h>
+#include "libudev.h"
#include "sd-device.h"
#include "alloc-util.h"
@@ -41,7 +42,6 @@
#include "device-util.h"
#include "libudev-device-internal.h"
#include "libudev-private.h"
-#include "libudev.h"
#include "parse-util.h"
/**
diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c
index f15b099ad1..442f9615f2 100644
--- a/src/libudev/libudev-enumerate.c
+++ b/src/libudev/libudev-enumerate.c
@@ -28,13 +28,13 @@
#include <string.h>
#include <sys/stat.h>
+#include "libudev.h"
#include "sd-device.h"
#include "alloc-util.h"
#include "device-enumerator-private.h"
#include "device-util.h"
#include "libudev-device-internal.h"
-#include "libudev.h"
/**
* SECTION:libudev-enumerate
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index f1ef4ac96f..f870eba9eb 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -28,12 +28,13 @@
#include <sys/socket.h>
#include <unistd.h>
+#include "libudev.h"
+
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "formats-util.h"
#include "libudev-private.h"
-#include "libudev.h"
#include "missing.h"
#include "mount-util.h"
#include "socket-util.h"
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index 4a75980b1f..574cfeac85 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -24,10 +24,11 @@
#include <string.h>
#include <unistd.h>
+#include "libudev.h"
+
#include "MurmurHash2.h"
#include "device-nodes.h"
#include "libudev-private.h"
-#include "libudev.h"
#include "syslog-util.h"
#include "utf8.h"
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
index 3f76dd8171..63fb05547d 100644
--- a/src/libudev/libudev.c
+++ b/src/libudev/libudev.c
@@ -24,10 +24,11 @@
#include <stdlib.h>
#include <string.h>
+#include "libudev.h"
+
#include "alloc-util.h"
#include "fd-util.h"
#include "libudev-private.h"
-#include "libudev.h"
#include "missing.h"
#include "string-util.h"
diff --git a/src/login/logind-session-device.c b/src/login/logind-session-device.c
index 0c6983d73a..9bf3ca0995 100644
--- a/src/login/logind-session-device.c
+++ b/src/login/logind-session-device.c
@@ -25,10 +25,11 @@
#include <sys/ioctl.h>
#include <sys/types.h>
+#include "libudev.h"
+
#include "alloc-util.h"
#include "bus-util.h"
#include "fd-util.h"
-#include "libudev.h"
#include "logind-session-device.h"
#include "missing.h"
#include "util.h"
diff --git a/src/login/logind.c b/src/login/logind.c
index 04f467ceb4..7b41174c64 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <unistd.h>
+#include "libudev.h"
#include "sd-daemon.h"
#include "alloc-util.h"
@@ -34,7 +35,6 @@
#include "dirent-util.h"
#include "fd-util.h"
#include "formats-util.h"
-#include "libudev.h"
#include "logind.h"
#include "signal-util.h"
#include "strv.h"
diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
index 3f7cbb78df..ed4f7c726f 100644
--- a/src/login/pam_systemd.c
+++ b/src/login/pam_systemd.c
@@ -493,7 +493,7 @@ _public_ PAM_EXTERN int pam_sm_open_session(
return PAM_SESSION_ERR;
}
- r = pam_set_data(handle, "systemd.session-fd", INT_TO_PTR(session_fd+1), NULL);
+ r = pam_set_data(handle, "systemd.session-fd", FD_TO_PTR(session_fd), NULL);
if (r != PAM_SUCCESS) {
pam_syslog(handle, LOG_ERR, "Failed to install session fd.");
safe_close(session_fd);
diff --git a/src/login/sysfs-show.c b/src/login/sysfs-show.c
index 86acee5751..e9ca4bb03d 100644
--- a/src/login/sysfs-show.c
+++ b/src/login/sysfs-show.c
@@ -22,8 +22,9 @@
#include <errno.h>
#include <string.h>
-#include "alloc-util.h"
#include "libudev.h"
+
+#include "alloc-util.h"
#include "locale-util.h"
#include "path-util.h"
#include "string-util.h"
diff --git a/src/machine/machine.c b/src/machine/machine.c
index 282079f228..6b1fae2769 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -38,6 +38,7 @@
#include "machine.h"
#include "mkdir.h"
#include "parse-util.h"
+#include "process-util.h"
#include "special.h"
#include "string-table.h"
#include "terminal-util.h"
@@ -105,7 +106,7 @@ void machine_free(Machine *m) {
m->manager->host_machine = NULL;
if (m->leader > 0)
- (void) hashmap_remove_value(m->manager->machine_leaders, UINT_TO_PTR(m->leader), m);
+ (void) hashmap_remove_value(m->manager->machine_leaders, PID_TO_PTR(m->leader), m);
sd_bus_message_unref(m->create_message);
@@ -401,7 +402,7 @@ int machine_start(Machine *m, sd_bus_message *properties, sd_bus_error *error) {
if (m->started)
return 0;
- r = hashmap_put(m->manager->machine_leaders, UINT_TO_PTR(m->leader), m);
+ r = hashmap_put(m->manager->machine_leaders, PID_TO_PTR(m->leader), m);
if (r < 0)
return r;
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index 4ec6baaa1f..961767c4a9 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -1508,7 +1508,7 @@ int manager_get_machine_by_pid(Manager *m, pid_t pid, Machine **machine) {
assert(pid >= 1);
assert(machine);
- mm = hashmap_get(m->machine_leaders, UINT_TO_PTR(pid));
+ mm = hashmap_get(m->machine_leaders, PID_TO_PTR(pid));
if (!mm) {
_cleanup_free_ char *unit = NULL;
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 081e299d82..a86a6383da 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -438,7 +438,7 @@ int netdev_get_mac(const char *ifname, struct ether_addr **ret) {
/* Let's hash the host machine ID plus the container name. We
* use a fixed, but originally randomly created hash key here. */
- siphash24(&result, v, sz, HASH_KEY.bytes);
+ result = siphash24(v, sz, HASH_KEY.bytes);
assert_cc(ETH_ALEN <= sizeof(result));
memcpy(mac->ether_addr_octet, &result, ETH_ALEN);
diff --git a/src/nspawn/nspawn-network.c b/src/nspawn/nspawn-network.c
index 04d8da3bc8..8f74c41c71 100644
--- a/src/nspawn/nspawn-network.c
+++ b/src/nspawn/nspawn-network.c
@@ -22,12 +22,12 @@
#include <linux/veth.h>
#include <net/if.h>
+#include "libudev.h"
#include "sd-id128.h"
#include "sd-netlink.h"
#include "alloc-util.h"
#include "ether-addr-util.h"
-#include "libudev.h"
#include "netlink-util.h"
#include "nspawn-network.h"
#include "siphash24.h"
@@ -74,7 +74,7 @@ static int generate_mac(
/* Let's hash the host machine ID plus the container name. We
* use a fixed, but originally randomly created hash key here. */
- siphash24(&result, v, sz, hash_key.bytes);
+ result = htole64(siphash24(v, sz, hash_key.bytes));
assert_cc(ETH_ALEN <= sizeof(result));
memcpy(mac->ether_addr_octet, &result, ETH_ALEN);
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index d2ce731c72..f6a2c0386e 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2283,7 +2283,7 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
static int on_orderly_shutdown(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
pid_t pid;
- pid = PTR_TO_UINT32(userdata);
+ pid = PTR_TO_PID(userdata);
if (pid > 0) {
if (kill(pid, arg_kill_signal) >= 0) {
log_info("Trying to halt container. Send SIGTERM again to trigger immediate termination.");
@@ -3510,8 +3510,8 @@ int main(int argc, char *argv[]) {
if (arg_kill_signal > 0) {
/* Try to kill the init system on SIGINT or SIGTERM */
- sd_event_add_signal(event, NULL, SIGINT, on_orderly_shutdown, UINT32_TO_PTR(pid));
- sd_event_add_signal(event, NULL, SIGTERM, on_orderly_shutdown, UINT32_TO_PTR(pid));
+ sd_event_add_signal(event, NULL, SIGINT, on_orderly_shutdown, PID_TO_PTR(pid));
+ sd_event_add_signal(event, NULL, SIGTERM, on_orderly_shutdown, PID_TO_PTR(pid));
} else {
/* Immediately exit */
sd_event_add_signal(event, NULL, SIGINT, NULL, NULL);
diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c
index b155f991bb..9fc56284d2 100644
--- a/src/remount-fs/remount-fs.c
+++ b/src/remount-fs/remount-fs.c
@@ -22,6 +22,7 @@
#include <errno.h>
#include <mntent.h>
#include <string.h>
+#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -31,7 +32,9 @@
#include "mount-setup.h"
#include "mount-util.h"
#include "path-util.h"
+#include "process-util.h"
#include "signal-util.h"
+#include "strv.h"
#include "util.h"
/* Goes through /etc/fstab and remounts all API file systems, applying
@@ -39,10 +42,10 @@
* respected */
int main(int argc, char *argv[]) {
- int ret = EXIT_FAILURE;
+ _cleanup_hashmap_free_free_ Hashmap *pids = NULL;
_cleanup_endmntent_ FILE *f = NULL;
struct mntent* me;
- Hashmap *pids = NULL;
+ int r;
if (argc > 1) {
log_error("This program takes no argument.");
@@ -57,21 +60,21 @@ int main(int argc, char *argv[]) {
f = setmntent("/etc/fstab", "r");
if (!f) {
- if (errno == ENOENT)
- return EXIT_SUCCESS;
+ if (errno == ENOENT) {
+ r = 0;
+ goto finish;
+ }
- log_error_errno(errno, "Failed to open /etc/fstab: %m");
- return EXIT_FAILURE;
+ r = log_error_errno(errno, "Failed to open /etc/fstab: %m");
+ goto finish;
}
pids = hashmap_new(NULL);
if (!pids) {
- log_error("Failed to allocate set");
+ r = log_oom();
goto finish;
}
- ret = EXIT_SUCCESS;
-
while ((me = getmntent(f))) {
pid_t pid;
int k;
@@ -87,25 +90,18 @@ int main(int argc, char *argv[]) {
pid = fork();
if (pid < 0) {
- log_error_errno(errno, "Failed to fork: %m");
- ret = EXIT_FAILURE;
- continue;
+ r = log_error_errno(errno, "Failed to fork: %m");
+ goto finish;
}
if (pid == 0) {
- const char *arguments[5];
/* Child */
(void) reset_all_signal_handlers();
(void) reset_signal_mask();
+ (void) prctl(PR_SET_PDEATHSIG, SIGTERM);
- arguments[0] = MOUNT_PATH;
- arguments[1] = me->mnt_dir;
- arguments[2] = "-o";
- arguments[3] = "remount";
- arguments[4] = NULL;
-
- execv(MOUNT_PATH, (char **) arguments);
+ execv(MOUNT_PATH, STRV_MAKE(MOUNT_PATH, me->mnt_dir, "-o", "remount"));
log_error_errno(errno, "Failed to execute " MOUNT_PATH ": %m");
_exit(EXIT_FAILURE);
@@ -115,20 +111,19 @@ int main(int argc, char *argv[]) {
s = strdup(me->mnt_dir);
if (!s) {
- log_oom();
- ret = EXIT_FAILURE;
- continue;
+ r = log_oom();
+ goto finish;
}
-
- k = hashmap_put(pids, UINT_TO_PTR(pid), s);
+ k = hashmap_put(pids, PID_TO_PTR(pid), s);
if (k < 0) {
- log_error_errno(k, "Failed to add PID to set: %m");
- ret = EXIT_FAILURE;
- continue;
+ free(s);
+ r = log_oom();
+ goto finish;
}
}
+ r = 0;
while (!hashmap_isempty(pids)) {
siginfo_t si = {};
char *s;
@@ -138,12 +133,11 @@ int main(int argc, char *argv[]) {
if (errno == EINTR)
continue;
- log_error_errno(errno, "waitid() failed: %m");
- ret = EXIT_FAILURE;
- break;
+ r = log_error_errno(errno, "waitid() failed: %m");
+ goto finish;
}
- s = hashmap_remove(pids, UINT_TO_PTR(si.si_pid));
+ s = hashmap_remove(pids, PID_TO_PTR(si.si_pid));
if (s) {
if (!is_clean_exit(si.si_code, si.si_status, NULL)) {
if (si.si_code == CLD_EXITED)
@@ -151,7 +145,7 @@ int main(int argc, char *argv[]) {
else
log_error(MOUNT_PATH " for %s terminated by signal %s.", s, signal_to_string(si.si_status));
- ret = EXIT_FAILURE;
+ r = -ENOEXEC;
}
free(s);
@@ -159,9 +153,5 @@ int main(int argc, char *argv[]) {
}
finish:
-
- if (pids)
- hashmap_free_free(pids);
-
- return ret;
+ return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
diff --git a/src/rfkill/rfkill.c b/src/rfkill/rfkill.c
index 45a41ccd33..5c45a3ae6c 100644
--- a/src/rfkill/rfkill.c
+++ b/src/rfkill/rfkill.c
@@ -22,6 +22,7 @@
#include <linux/rfkill.h>
#include <poll.h>
+#include "libudev.h"
#include "sd-daemon.h"
#include "alloc-util.h"
@@ -29,7 +30,6 @@
#include "fd-util.h"
#include "fileio.h"
#include "io-util.h"
-#include "libudev.h"
#include "mkdir.h"
#include "parse-util.h"
#include "proc-cmdline.h"
diff --git a/src/test/test-libudev.c b/src/test/test-libudev.c
index 422926ef45..350eaf734d 100644
--- a/src/test/test-libudev.c
+++ b/src/test/test-libudev.c
@@ -24,6 +24,7 @@
#include <unistd.h>
#include "libudev.h"
+
#include "string-util.h"
#include "udev-util.h"
#include "util.h"
diff --git a/src/test/test-siphash24.c b/src/test/test-siphash24.c
index 7e39890110..a571a95a70 100644
--- a/src/test/test-siphash24.c
+++ b/src/test/test-siphash24.c
@@ -29,7 +29,7 @@ static int do_test(const uint8_t *in, size_t len, const uint8_t *key) {
uint64_t out = 0;
unsigned i, j;
- siphash24(&out, in, len, key);
+ out = siphash24(in, len, key);
assert_se(out == htole64(0xa129ca6149be45e5));
/* verify the internal state as given in the above paper */
@@ -43,7 +43,7 @@ static int do_test(const uint8_t *in, size_t len, const uint8_t *key) {
assert_se(state.v1 == 0x0d52f6f62a4f59a4);
assert_se(state.v2 == 0x634cb3577b01fd3d);
assert_se(state.v3 == 0xa5224d6f55c7d9c8);
- siphash24_finalize(&out, &state);
+ out = siphash24_finalize(&state);
assert_se(out == htole64(0xa129ca6149be45e5));
assert_se(state.v0 == 0xf6bcd53893fecff1);
assert_se(state.v1 == 0x54b9964c7ea0d937);
@@ -58,7 +58,7 @@ static int do_test(const uint8_t *in, size_t len, const uint8_t *key) {
siphash24_compress(in, i, &state);
siphash24_compress(&in[i], j - i, &state);
siphash24_compress(&in[j], len - j, &state);
- siphash24_finalize(&out, &state);
+ out = siphash24_finalize(&state);
assert_se(out == htole64(0xa129ca6149be45e5));
}
}
diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c
index be3471013d..1e414664ce 100644
--- a/src/udev/ata_id/ata_id.c
+++ b/src/udev/ata_id/ata_id.c
@@ -37,9 +37,10 @@
#include <sys/types.h>
#include <unistd.h>
+#include "libudev.h"
+
#include "fd-util.h"
#include "libudev-private.h"
-#include "libudev.h"
#include "log.h"
#include "udev-util.h"
diff --git a/src/udev/cdrom_id/cdrom_id.c b/src/udev/cdrom_id/cdrom_id.c
index 3ca576d75b..72f284f710 100644
--- a/src/udev/cdrom_id/cdrom_id.c
+++ b/src/udev/cdrom_id/cdrom_id.c
@@ -34,8 +34,9 @@
#include <time.h>
#include <unistd.h>
-#include "libudev-private.h"
#include "libudev.h"
+
+#include "libudev-private.h"
#include "random-util.h"
/* device info */
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
index ff16344316..4655691642 100644
--- a/src/udev/scsi_id/scsi_id.c
+++ b/src/udev/scsi_id/scsi_id.c
@@ -29,9 +29,10 @@
#include <sys/stat.h>
#include <unistd.h>
+#include "libudev.h"
+
#include "fd-util.h"
#include "libudev-private.h"
-#include "libudev.h"
#include "scsi_id.h"
#include "string-util.h"
#include "udev-util.h"
diff --git a/src/udev/scsi_id/scsi_serial.c b/src/udev/scsi_id/scsi_serial.c
index 71a518a453..c7ef783684 100644
--- a/src/udev/scsi_id/scsi_serial.c
+++ b/src/udev/scsi_id/scsi_serial.c
@@ -33,8 +33,9 @@
#include <time.h>
#include <unistd.h>
-#include "libudev-private.h"
#include "libudev.h"
+
+#include "libudev-private.h"
#include "random-util.h"
#include "scsi.h"
#include "scsi_id.h"
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 5364b92a57..6d9d765153 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -191,7 +191,7 @@ static void worker_free(struct worker *worker) {
assert(worker->manager);
- hashmap_remove(worker->manager->workers, UINT_TO_PTR(worker->pid));
+ hashmap_remove(worker->manager->workers, PID_TO_PTR(worker->pid));
udev_monitor_unref(worker->monitor);
event_free(worker->event);
@@ -234,7 +234,7 @@ static int worker_new(struct worker **ret, Manager *manager, struct udev_monitor
if (r < 0)
return r;
- r = hashmap_put(manager->workers, UINT_TO_PTR(pid), worker);
+ r = hashmap_put(manager->workers, PID_TO_PTR(pid), worker);
if (r < 0)
return r;
@@ -891,7 +891,7 @@ static int on_worker(sd_event_source *s, int fd, uint32_t revents, void *userdat
}
/* lookup worker who sent the signal */
- worker = hashmap_get(manager->workers, UINT_TO_PTR(ucred->pid));
+ worker = hashmap_get(manager->workers, PID_TO_PTR(ucred->pid));
if (!worker) {
log_debug("worker ["PID_FMT"] returned, but is no longer tracked", ucred->pid);
continue;
@@ -1195,7 +1195,7 @@ static int on_sigchld(sd_event_source *s, const struct signalfd_siginfo *si, voi
if (pid <= 0)
break;
- worker = hashmap_get(manager->workers, UINT_TO_PTR(pid));
+ worker = hashmap_get(manager->workers, PID_TO_PTR(pid));
if (!worker) {
log_warning("worker ["PID_FMT"] is unknown, ignoring", pid);
continue;