automatic version update by autodist [release 256.9-1mamba;Sat Nov 30 2024]

This commit is contained in:
Automatic Build System 2024-12-01 10:25:58 +01:00
parent c7c73393a3
commit afcf98ddf3
26 changed files with 30 additions and 2605 deletions

View File

@ -1,20 +0,0 @@
From e2c8b07dcb50c2adf64cdfb22e4a496fc76576fb Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 21 Sep 2012 22:16:13 +0000
Subject: journal: bring mmap cache prototype in sync
---
diff --git a/src/journal/mmap-cache.h b/src/journal/mmap-cache.h
index de34634..0c42fb8 100644
--- a/src/journal/mmap-cache.h
+++ b/src/journal/mmap-cache.h
@@ -31,6 +31,6 @@ MMapCache* mmap_cache_new(void);
MMapCache* mmap_cache_ref(MMapCache *m);
MMapCache* mmap_cache_unref(MMapCache *m);
-int mmap_cache_get(MMapCache *m, int fd, int prot, unsigned context, bool keep_always, uint64_t offset, uint64_t size, struct stat *st, void **ret);
+int mmap_cache_get(MMapCache *m, int fd, int prot, unsigned context, bool keep_always, uint64_t offset, size_t size, struct stat *st, void **ret);
void mmap_cache_close_fd(MMapCache *m, int fd);
void mmap_cache_close_context(MMapCache *m, unsigned context);
--
cgit v0.9.0.2-2-gbebe

View File

@ -1,63 +0,0 @@
From 48a849ee17fb25e0001bfcc0f28a4aa633d016a1 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Fri, 04 Jan 2013 15:15:46 +0000
Subject: udev: set device node permissions only at "add" events
---
diff --git a/TODO b/TODO
index 8ebb951..35d96ec 100644
--- a/TODO
+++ b/TODO
@@ -29,8 +29,6 @@ Features:
* exec: when deinitializating a tty device fix the perms and group, too, not only when initializing. Set access mode/gid to 0620/tty.
-* udev: only reset mode/gid of /dev/tty1 and friends on ACTION=add, not ACTION=changed
-
* DeviceAllow/DeviceDeny: disallow everything by default, but whitelist /dev/zero, /dev/null and friends
* service: watchdog logic: for testing purposes allow ping, but do not require pong
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index 7774303..1e378ad 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -279,22 +279,23 @@ static int node_fixup(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid
goto out;
}
- if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) {
- log_debug("set permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid);
- chmod(devnode, mode);
- chown(devnode, uid, gid);
- } else {
- log_debug("preserve permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid);
- }
-
/*
- * Set initial selinux file context only on add events.
- * We set the proper context on bootup (triger) or for newly
- * added devices, but we don't change it later, in case
- * something else has set a custom context in the meantime.
+ * Set permissions and selinux file context only on add events. We always
+ * set it on bootup (coldplug) with "trigger --action=add" for all devices
+ * and for any newly added devices (hotplug). We don't want to change it
+ * later, in case something else has applied custom settings in the meantime.
*/
- if (strcmp(udev_device_get_action(dev), "add") == 0)
- label_fix(devnode, true, false);
+ if (strcmp(udev_device_get_action(dev), "add") == 0) {
+ if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) {
+ log_debug("set permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid);
+ chmod(devnode, mode);
+ chown(devnode, uid, gid);
+ } else {
+ log_debug("preserve permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid);
+ }
+
+ label_fix(devnode, true, false);
+ }
/* always update timestamp when we re-use the node, like on media change events */
utimensat(AT_FDCWD, devnode, NULL, 0);
--
cgit v0.9.0.2-2-gbebe

View File

@ -1,12 +0,0 @@
diff -Nru systemd-198.orig/tmpfiles.d/legacy.conf systemd-198/tmpfiles.d/legacy.conf
--- systemd-198.orig/tmpfiles.d/legacy.conf 2013-01-07 22:50:49.082315571 +0100
+++ systemd-198/tmpfiles.d/legacy.conf 2013-03-17 16:02:42.445059870 +0100
@@ -23,7 +23,7 @@
# On modern systems a BSD file lock is a better choice if
# serialization is needed on those devices.
-d /run/lock/lockdev 0775 root lock -
+d /run/lock/lockdev 0775 root tty -
# /forcefsck, /fastboot and /forcequotecheck are deprecated in favor of the
# kernel command line options 'fsck.mode=force', 'fsck.mode=skip' and

View File

@ -1,85 +0,0 @@
From 4e82fe5213bedcb70e25c0270e516d5f2706d8c8 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Sun, 15 Sep 2013 23:08:32 +0000
Subject: swap: create .wants symlink to 'auto' swap devices
As we load unit files lazily, we need to make sure something pulls in swap
units that should be started automatically, otherwise the default dependencies
will never be applied.
This partially reinstates code removed in
commit 64347fc2b983f33e7efb0fd2bb44e133fb9f30f4.
Also don't order swap devices after swap.target when they are 'nofail'.
---
diff --git a/src/core/swap.c b/src/core/swap.c
index 3950860..76c7d45 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -220,8 +220,12 @@ static int swap_add_default_dependencies(Swap *s) {
}
if (!noauto) {
- r = unit_add_two_dependencies_by_name_inverse(UNIT(s), UNIT_AFTER, (nofail ? UNIT_WANTS : UNIT_REQUIRES),
- SPECIAL_SWAP_TARGET, NULL, true);
+ if (nofail)
+ r = unit_add_dependency_by_name_inverse(UNIT(s),
+ UNIT_WANTS, SPECIAL_SWAP_TARGET, NULL, true);
+ else
+ r = unit_add_two_dependencies_by_name_inverse(UNIT(s),
+ UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SWAP_TARGET, NULL, true);
if (r < 0)
return r;
}
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 6ebe8aa..b73dfa4 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -66,6 +66,7 @@ static int mount_find_pri(struct mntent *me, int *ret) {
static int add_swap(const char *what, struct mntent *me) {
_cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL;
_cleanup_fclose_ FILE *f = NULL;
+ bool noauto;
int r, pri = -1;
assert(what);
@@ -77,6 +78,8 @@ static int add_swap(const char *what, struct mntent *me) {
return pri;
}
+ noauto = !!hasmntopt(me, "noauto");
+
name = unit_name_from_path(what, ".swap");
if (!name)
return log_oom();
@@ -97,8 +100,7 @@ static int add_swap(const char *what, struct mntent *me) {
fprintf(f,
"# Automatically generated by systemd-fstab-generator\n\n"
"[Unit]\n"
- "SourcePath=/etc/fstab\n"
- "\n"
+ "SourcePath=/etc/fstab\n\n"
"[Swap]\n"
"What=%s\n",
what);
@@ -114,6 +116,18 @@ static int add_swap(const char *what, struct mntent *me) {
return -errno;
}
+ if (!noauto) {
+ lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL);
+ if (!lnk)
+ return log_oom();
+
+ mkdir_parents_label(lnk, 0755);
+ if (symlink(unit, lnk) < 0) {
+ log_error("Failed to create symlink %s: %m", lnk);
+ return -errno;
+ }
+ }
+
return 0;
}
--
cgit v0.9.0.2-2-gbebe

View File

@ -1,204 +0,0 @@
From 3db604b907323b8df0fc810216f6112056d26a02 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 17 Sep 2013 23:04:40 +0000
Subject: gpt-auto-generator: do not assume that /dev/block/%u:%u is useable
The generator might run before udev, and udev sets up the /dev/block/
symlinks, hence we cannot use them from the gpt generator. Instead,
manually translate a major/minor to a device node.
---
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 880661e..ca54925 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -55,18 +55,13 @@ static inline void blkid_free_probep(blkid_probe *b) {
}
#define _cleanup_blkid_freep_probe_ _cleanup_(blkid_free_probep)
-static int verify_gpt_partition(dev_t dev, sd_id128_t *type, unsigned *nr, char **fstype) {
- _cleanup_free_ char *t = NULL;
+static int verify_gpt_partition(const char *node, sd_id128_t *type, unsigned *nr, char **fstype) {
_cleanup_blkid_freep_probe_ blkid_probe b = NULL;
const char *v;
int r;
- r = asprintf(&t, "/dev/block/%u:%u", major(dev), minor(dev));
- if (r < 0)
- return -ENOMEM;
-
errno = 0;
- b = blkid_new_probe_from_filename(t);
+ b = blkid_new_probe_from_filename(node);
if (!b)
return errno != 0 ? -errno : -ENOMEM;
@@ -237,8 +232,7 @@ static int add_home(const char *path, const char *fstype) {
return 0;
}
-static int enumerate_partitions(dev_t dev) {
- struct udev *udev;
+static int enumerate_partitions(struct udev *udev, dev_t dev) {
struct udev_enumerate *e = NULL;
struct udev_device *parent = NULL, *d = NULL;
struct udev_list_entry *first, *item;
@@ -246,10 +240,6 @@ static int enumerate_partitions(dev_t dev) {
_cleanup_free_ char *home = NULL, *home_fstype = NULL;
int r;
- udev = udev_new();
- if (!udev)
- return log_oom();
-
e = udev_enumerate_new(udev);
if (!e) {
r = log_oom();
@@ -294,7 +284,6 @@ static int enumerate_partitions(dev_t dev) {
struct udev_device *q;
sd_id128_t type_id;
unsigned nr;
- dev_t sub;
q = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
if (!q) {
@@ -314,12 +303,10 @@ static int enumerate_partitions(dev_t dev) {
goto finish;
}
- sub = udev_device_get_devnum(q);
-
- r = verify_gpt_partition(sub, &type_id, &nr, &fstype);
+ r = verify_gpt_partition(node, &type_id, &nr, &fstype);
if (r < 0) {
- log_error("Failed to verify GPT partition /dev/block/%u:%u: %s",
- major(sub), minor(sub), strerror(-r));
+ log_error("Failed to verify GPT partition %s: %s",
+ node, strerror(-r));
udev_device_unref(q);
goto finish;
}
@@ -360,8 +347,6 @@ finish:
if (e)
udev_enumerate_unref(e);
- if (udev)
- udev_unref(udev);
return r;
}
@@ -440,13 +425,50 @@ static int get_block_device(const char *path, dev_t *dev) {
return 0;
}
+static int devno_to_devnode(struct udev *udev, dev_t devno, char **ret) {
+ struct udev_device *d = NULL;
+ const char *t;
+ char *n;
+ int r;
+
+ d = udev_device_new_from_devnum(udev, 'b', devno);
+ if (!d) {
+ r = log_oom();
+ goto finish;
+ }
+
+ t = udev_device_get_devnode(d);
+ if (!t) {
+ r = -ENODEV;
+ goto finish;
+ }
+
+ n = strdup(t);
+ if (!n) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
+ *ret = n;
+ r = 0;
+
+finish:
+ if (d)
+ udev_device_unref(d);
+
+ return r;
+}
+
int main(int argc, char *argv[]) {
- dev_t dev;
+ _cleanup_free_ char *node = NULL;
+ struct udev *udev = NULL;
+ dev_t devno;
int r;
if (argc > 1 && argc != 4) {
log_error("This program takes three or no arguments.");
- return EXIT_FAILURE;
+ r = -EINVAL;
+ goto finish;
}
if (argc > 1)
@@ -458,31 +480,48 @@ int main(int argc, char *argv[]) {
umask(0022);
- if (in_initrd())
- return EXIT_SUCCESS;
+ if (in_initrd()) {
+ r = 0;
+ goto finish;
+ }
- r = get_block_device("/", &dev);
+ r = get_block_device("/", &devno);
if (r < 0) {
log_error("Failed to determine block device of root file system: %s", strerror(-r));
- return EXIT_FAILURE;
+ goto finish;
}
if (r == 0) {
log_debug("Root file system not on a (single) block device.");
- return EXIT_SUCCESS;
+ goto finish;
+ }
+
+ udev = udev_new();
+ if (!udev) {
+ r = log_oom();
+ goto finish;
+ }
+
+ r = devno_to_devnode(udev, devno, &node);
+ if (r < 0) {
+ log_error("Failed to determine block device node from major/minor: %s", strerror(-r));
+ goto finish;
}
- log_debug("Root device /dev/block/%u:%u.", major(dev), minor(dev));
+ log_debug("Root device %s.", node);
- r = verify_gpt_partition(dev, NULL, NULL, NULL);
+ r = verify_gpt_partition(node, NULL, NULL, NULL);
if (r < 0) {
- log_error("Failed to verify GPT partition /dev/block/%u:%u: %s",
- major(dev), minor(dev), strerror(-r));
- return EXIT_FAILURE;
+ log_error("Failed to verify GPT partition %s: %s", node, strerror(-r));
+ goto finish;
}
if (r == 0)
- return EXIT_SUCCESS;
+ goto finish;
+
+ r = enumerate_partitions(udev, devno);
- r = enumerate_partitions(dev);
+finish:
+ if (udev)
+ udev_unref(udev);
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
--
cgit v0.9.0.2-2-gbebe

View File

@ -1,26 +0,0 @@
From 90060fa6605446bef7078867423b691e4effa575 Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Fri, 13 Sep 2013 12:46:18 +0000
Subject: swap: fix reverse dependencies
Make sure swap.target correctly requires/wants the swap units.
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=69291.
Reported-by: Hussam Al-Tayeb
---
diff --git a/src/core/swap.c b/src/core/swap.c
index 57d15eb..3950860 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -220,7 +220,7 @@ static int swap_add_default_dependencies(Swap *s) {
}
if (!noauto) {
- r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, (nofail ? UNIT_WANTED_BY : UNIT_REQUIRED_BY),
+ r = unit_add_two_dependencies_by_name_inverse(UNIT(s), UNIT_AFTER, (nofail ? UNIT_WANTS : UNIT_REQUIRES),
SPECIAL_SWAP_TARGET, NULL, true);
if (r < 0)
return r;
--
cgit v0.9.0.2-2-gbebe

View File

@ -1,15 +0,0 @@
diff -Nru systemd-208.orig/src/journal/journald.conf systemd-208/src/journal/journald.conf
--- systemd-208.orig/src/journal/journald.conf 2013-08-13 22:02:46.413707211 +0200
+++ systemd-208/src/journal/journald.conf 2014-01-18 14:31:20.184025254 +0100
@@ -15,9 +15,9 @@
#SyncIntervalSec=5m
#RateLimitInterval=30s
#RateLimitBurst=1000
-#SystemMaxUse=
+SystemMaxUse=200M
#SystemKeepFree=
-#SystemMaxFileSize=
+SystemMaxFileSize=50M
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=

View File

@ -1,25 +0,0 @@
--- systemd-216/src/sysv-generator/sysv-generator.c.orig 2014-09-27 16:57:35.327164853 +0200
+++ systemd-216/src/sysv-generator/sysv-generator.c 2014-09-27 16:59:01.635140790 +0200
@@ -52,15 +52,15 @@
const RunlevelType type;
} rcnd_table[] = {
/* Standard SysV runlevels for start-up */
- { "rc1.d", SPECIAL_RESCUE_TARGET, RUNLEVEL_UP },
- { "rc2.d", SPECIAL_RUNLEVEL2_TARGET, RUNLEVEL_UP },
- { "rc3.d", SPECIAL_RUNLEVEL3_TARGET, RUNLEVEL_UP },
- { "rc4.d", SPECIAL_RUNLEVEL4_TARGET, RUNLEVEL_UP },
- { "rc5.d", SPECIAL_RUNLEVEL5_TARGET, RUNLEVEL_UP },
+ { "rc1.d", "rescue.target", RUNLEVEL_UP },
+ { "rc2.d", "multi-user.target", RUNLEVEL_UP },
+ { "rc3.d", "multi-user.target", RUNLEVEL_UP },
+ { "rc4.d", "multi-user.target", RUNLEVEL_UP },
+ { "rc5.d", "graphical.target", RUNLEVEL_UP },
/* Standard SysV runlevels for shutdown */
- { "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN },
- { "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN }
+ { "rc0.d", "poweroff.target", RUNLEVEL_DOWN },
+ { "rc6.d", "reboot.target", RUNLEVEL_DOWN }
/* Note that the order here matters, as we read the
directories in this order, and we want to make sure that

View File

@ -1,12 +0,0 @@
--- systemd-218/src/tmpfiles/tmpfiles.c.orig 2015-01-02 01:33:20.450888674 +0100
+++ systemd-218/src/tmpfiles/tmpfiles.c 2015-01-02 01:31:34.421960789 +0100
@@ -38,8 +38,8 @@
#include <sys/param.h>
#include <glob.h>
#include <fnmatch.h>
-#include <sys/capability.h>
#include <sys/xattr.h>
+#include <sys/capability.h>
#include "log.h"
#include "util.h"

View File

@ -1,907 +0,0 @@
From 628c89cc68ab96fce2de7ebba5933725d147aecc Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 27 Feb 2015 21:55:08 +0100
Subject: [PATCH] core: rework device state logic
This change introduces a new state "tentative" for device units. Device
units are considered "plugged" when udev announced them, "dead" when
they are not available in the kernel, and "tentative" when they are
referenced in /proc/self/mountinfo or /proc/swaps but not (yet)
announced via udev.
This should fix a race when device nodes (like loop devices) are created
and immediately mounted. Previously, systemd might end up seeing the
mount unit before the device, and would thus pull down the mount because
its BindTo dependency on the device would not be fulfilled.
---
src/core/device.c | 368 +++++++++++++++++++++++++++++++++---------------------
src/core/device.h | 14 ++-
src/core/mount.c | 46 ++++---
src/core/swap.c | 32 +++--
src/core/swap.h | 4 +-
src/core/unit.c | 1 -
6 files changed, 285 insertions(+), 180 deletions(-)
diff --git a/src/core/device.c b/src/core/device.c
index 2d983cc..e41ed41 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -34,7 +34,8 @@
static const UnitActiveState state_translation_table[_DEVICE_STATE_MAX] = {
[DEVICE_DEAD] = UNIT_INACTIVE,
- [DEVICE_PLUGGED] = UNIT_ACTIVE
+ [DEVICE_TENTATIVE] = UNIT_ACTIVATING,
+ [DEVICE_PLUGGED] = UNIT_ACTIVE,
};
static int device_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata);
@@ -63,6 +64,41 @@ static void device_unset_sysfs(Device *d) {
d->sysfs = NULL;
}
+static int device_set_sysfs(Device *d, const char *sysfs) {
+ Device *first;
+ char *copy;
+ int r;
+
+ assert(d);
+
+ if (streq_ptr(d->sysfs, sysfs))
+ return 0;
+
+ r = hashmap_ensure_allocated(&UNIT(d)->manager->devices_by_sysfs, &string_hash_ops);
+ if (r < 0)
+ return r;
+
+ copy = strdup(sysfs);
+ if (!copy)
+ return -ENOMEM;
+
+ device_unset_sysfs(d);
+
+ first = hashmap_get(UNIT(d)->manager->devices_by_sysfs, sysfs);
+ LIST_PREPEND(same_sysfs, first, d);
+
+ r = hashmap_replace(UNIT(d)->manager->devices_by_sysfs, copy, first);
+ if (r < 0) {
+ LIST_REMOVE(same_sysfs, first, d);
+ free(copy);
+ return r;
+ }
+
+ d->sysfs = copy;
+
+ return 0;
+}
+
static void device_init(Unit *u) {
Device *d = DEVICE(u);
@@ -110,8 +146,13 @@ static int device_coldplug(Unit *u) {
assert(d);
assert(d->state == DEVICE_DEAD);
- if (d->sysfs)
+ if (d->found & DEVICE_FOUND_UDEV)
+ /* If udev says the device is around, it's around */
device_set_state(d, DEVICE_PLUGGED);
+ else if (d->found != DEVICE_NOT_FOUND)
+ /* If a device is found in /proc/self/mountinfo or
+ * /proc/swaps, it's "tentatively" around. */
+ device_set_state(d, DEVICE_TENTATIVE);
return 0;
}
@@ -140,49 +181,9 @@ _pure_ static const char *device_sub_state_to_string(Unit *u) {
return device_state_to_string(DEVICE(u)->state);
}
-static int device_add_escaped_name(Unit *u, const char *dn) {
- _cleanup_free_ char *e = NULL;
- int r;
-
- assert(u);
- assert(dn);
- assert(dn[0] == '/');
-
- e = unit_name_from_path(dn, ".device");
- if (!e)
- return -ENOMEM;
-
- r = unit_add_name(u, e);
- if (r < 0 && r != -EEXIST)
- return r;
-
- return 0;
-}
-
-static int device_find_escape_name(Manager *m, const char *dn, Unit **_u) {
- _cleanup_free_ char *e = NULL;
- Unit *u;
-
- assert(m);
- assert(dn);
- assert(dn[0] == '/');
- assert(_u);
-
- e = unit_name_from_path(dn, ".device");
- if (!e)
- return -ENOMEM;
-
- u = manager_get_unit(m, e);
- if (u) {
- *_u = u;
- return 1;
- }
-
- return 0;
-}
-
-static int device_make_description(Unit *u, struct udev_device *dev, const char *path) {
+static int device_update_description(Unit *u, struct udev_device *dev, const char *path) {
const char *model;
+ int r;
assert(u);
assert(dev);
@@ -207,13 +208,16 @@ static int device_make_description(Unit *u, struct udev_device *dev, const char
j = strjoin(model, " ", label, NULL);
if (j)
- return unit_set_description(u, j);
- }
+ r = unit_set_description(u, j);
+ } else
+ r = unit_set_description(u, model);
+ } else
+ r = unit_set_description(u, path);
- return unit_set_description(u, model);
- }
+ if (r < 0)
+ log_unit_error_errno(u->id, r, "Failed to set device description: %m");
- return unit_set_description(u, path);
+ return r;
}
static int device_add_udev_wants(Unit *u, struct udev_device *dev) {
@@ -240,20 +244,20 @@ static int device_add_udev_wants(Unit *u, struct udev_device *dev) {
n = unit_name_mangle(e, MANGLE_NOGLOB);
if (!n)
- return -ENOMEM;
+ return log_oom();
r = unit_add_dependency_by_name(u, UNIT_WANTS, n, NULL, true);
if (r < 0)
- return r;
+ return log_unit_error_errno(u->id, r, "Failed to add wants dependency: %m");
}
if (!isempty(state))
- log_unit_warning(u->id, "Property %s on %s has trailing garbage, ignoring.",
- property, strna(udev_device_get_syspath(dev)));
+ log_unit_warning(u->id, "Property %s on %s has trailing garbage, ignoring.", property, strna(udev_device_get_syspath(dev)));
return 0;
}
-static int device_update_unit(Manager *m, struct udev_device *dev, const char *path, bool main) {
+static int device_setup_unit(Manager *m, struct udev_device *dev, const char *path, bool main) {
+ _cleanup_free_ char *e = NULL;
const char *sysfs;
Unit *u = NULL;
bool delete;
@@ -267,12 +271,18 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
if (!sysfs)
return 0;
- r = device_find_escape_name(m, path, &u);
- if (r < 0)
- return r;
+ e = unit_name_from_path(path, ".device");
+ if (!e)
+ return log_oom();
+
+ u = manager_get_unit(m, e);
- if (u && DEVICE(u)->sysfs && !path_equal(DEVICE(u)->sysfs, sysfs))
+ if (u &&
+ DEVICE(u)->sysfs &&
+ !path_equal(DEVICE(u)->sysfs, sysfs)) {
+ log_unit_error(u->id, "Device %s appeared twice with different sysfs paths %s and %s", e, DEVICE(u)->sysfs, sysfs);
return -EEXIST;
+ }
if (!u) {
delete = true;
@@ -281,7 +291,7 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
if (!u)
return log_oom();
- r = device_add_escaped_name(u, path);
+ r = unit_add_name(u, e);
if (r < 0)
goto fail;
@@ -293,37 +303,16 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
* actually been seen yet ->sysfs will not be
* initialized. Hence initialize it if necessary. */
- if (!DEVICE(u)->sysfs) {
- Device *first;
-
- DEVICE(u)->sysfs = strdup(sysfs);
- if (!DEVICE(u)->sysfs) {
- r = -ENOMEM;
- goto fail;
- }
-
- r = hashmap_ensure_allocated(&m->devices_by_sysfs, &string_hash_ops);
- if (r < 0)
- goto fail;
-
- first = hashmap_get(m->devices_by_sysfs, sysfs);
- LIST_PREPEND(same_sysfs, first, DEVICE(u));
-
- r = hashmap_replace(m->devices_by_sysfs, DEVICE(u)->sysfs, first);
- if (r < 0)
- goto fail;
- }
-
- device_make_description(u, dev, path);
+ r = device_set_sysfs(DEVICE(u), sysfs);
+ if (r < 0)
+ goto fail;
- if (main) {
- /* The additional systemd udev properties we only
- * interpret for the main object */
+ (void) device_update_description(u, dev, path);
- r = device_add_udev_wants(u, dev);
- if (r < 0)
- goto fail;
- }
+ /* The additional systemd udev properties we only interpret
+ * for the main object */
+ if (main)
+ (void) device_add_udev_wants(u, dev);
/* Note that this won't dispatch the load queue, the caller
* has to do that if needed and appropriate */
@@ -332,7 +321,7 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
return 0;
fail:
- log_warning_errno(r, "Failed to load device unit: %m");
+ log_unit_warning_errno(u->id, r, "Failed to set up device unit: %m");
if (delete && u)
unit_free(u);
@@ -340,7 +329,7 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
return r;
}
-static int device_process_new_device(Manager *m, struct udev_device *dev) {
+static int device_process_new(Manager *m, struct udev_device *dev) {
const char *sysfs, *dn, *alias;
struct udev_list_entry *item = NULL, *first = NULL;
int r;
@@ -352,14 +341,14 @@ static int device_process_new_device(Manager *m, struct udev_device *dev) {
return 0;
/* Add the main unit named after the sysfs path */
- r = device_update_unit(m, dev, sysfs, true);
+ r = device_setup_unit(m, dev, sysfs, true);
if (r < 0)
return r;
/* Add an additional unit for the device node */
dn = udev_device_get_devnode(dev);
if (dn)
- device_update_unit(m, dev, dn, false);
+ (void) device_setup_unit(m, dev, dn, false);
/* Add additional units for all symlinks */
first = udev_device_get_devlinks_list_entry(dev);
@@ -386,7 +375,7 @@ static int device_process_new_device(Manager *m, struct udev_device *dev) {
st.st_rdev != udev_device_get_devnum(dev))
continue;
- device_update_unit(m, dev, p, false);
+ (void) device_setup_unit(m, dev, p, false);
}
/* Add additional units for all explicitly configured
@@ -403,7 +392,7 @@ static int device_process_new_device(Manager *m, struct udev_device *dev) {
e[l] = 0;
if (path_is_absolute(e))
- device_update_unit(m, dev, e, false);
+ (void) device_setup_unit(m, dev, e, false);
else
log_warning("SYSTEMD_ALIAS for %s is not an absolute path, ignoring: %s", sysfs, e);
}
@@ -414,39 +403,62 @@ static int device_process_new_device(Manager *m, struct udev_device *dev) {
return 0;
}
-static void device_set_path_plugged(Manager *m, struct udev_device *dev) {
- const char *sysfs;
+static void device_update_found_one(Device *d, bool add, DeviceFound found, bool now) {
+ DeviceFound n;
+
+ assert(d);
+
+ n = add ? (d->found | found) : (d->found & ~found);
+ if (n == d->found)
+ return;
+
+ d->found = n;
+
+ if (now) {
+ if (d->found & DEVICE_FOUND_UDEV)
+ device_set_state(d, DEVICE_PLUGGED);
+ else if (d->found != DEVICE_NOT_FOUND)
+ device_set_state(d, DEVICE_TENTATIVE);
+ else
+ device_set_state(d, DEVICE_DEAD);
+ }
+}
+
+static int device_update_found_by_sysfs(Manager *m, const char *sysfs, bool add, DeviceFound found, bool now) {
Device *d, *l;
assert(m);
- assert(dev);
+ assert(sysfs);
- sysfs = udev_device_get_syspath(dev);
- if (!sysfs)
- return;
+ if (found == DEVICE_NOT_FOUND)
+ return 0;
l = hashmap_get(m->devices_by_sysfs, sysfs);
LIST_FOREACH(same_sysfs, d, l)
- device_set_state(d, DEVICE_PLUGGED);
+ device_update_found_one(d, add, found, now);
+
+ return 0;
}
-static int device_process_removed_device(Manager *m, struct udev_device *dev) {
- const char *sysfs;
- Device *d;
+static int device_update_found_by_name(Manager *m, const char *path, bool add, DeviceFound found, bool now) {
+ _cleanup_free_ char *e = NULL;
+ Unit *u;
assert(m);
- assert(dev);
+ assert(path);
- sysfs = udev_device_get_syspath(dev);
- if (!sysfs)
- return -ENOMEM;
+ if (found == DEVICE_NOT_FOUND)
+ return 0;
- /* Remove all units of this sysfs path */
- while ((d = hashmap_get(m->devices_by_sysfs, sysfs))) {
- device_unset_sysfs(d);
- device_set_state(d, DEVICE_DEAD);
- }
+ e = unit_name_from_path(path, ".device");
+ if (!e)
+ return log_oom();
+ u = manager_get_unit(m, e);
+ if (!u)
+ return 0;
+
+ device_update_found_one(DEVICE(u), add, found, now);
return 0;
}
@@ -462,22 +474,6 @@ static bool device_is_ready(struct udev_device *dev) {
return parse_boolean(ready) != 0;
}
-static int device_process_new_path(Manager *m, const char *path) {
- _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
-
- assert(m);
- assert(path);
-
- dev = udev_device_new_from_syspath(m->udev, path);
- if (!dev)
- return log_oom();
-
- if (!device_is_ready(dev))
- return 0;
-
- return device_process_new_device(m, dev);
-}
-
static Unit *device_following(Unit *u) {
Device *d = DEVICE(u);
Device *other, *first = NULL;
@@ -604,12 +600,31 @@ static int device_enumerate(Manager *m) {
goto fail;
first = udev_enumerate_get_list_entry(e);
- udev_list_entry_foreach(item, first)
- device_process_new_path(m, udev_list_entry_get_name(item));
+ udev_list_entry_foreach(item, first) {
+ _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+ const char *sysfs;
+
+ sysfs = udev_list_entry_get_name(item);
+
+ dev = udev_device_new_from_syspath(m->udev, sysfs);
+ if (!dev) {
+ log_oom();
+ continue;
+ }
+
+ if (!device_is_ready(dev))
+ continue;
+
+ (void) device_process_new(m, dev);
+
+ device_update_found_by_sysfs(m, sysfs, true, DEVICE_FOUND_UDEV, false);
+ }
return 0;
fail:
+ log_error_errno(r, "Failed to enumerate devices: %m");
+
device_shutdown(m);
return r;
}
@@ -617,7 +632,7 @@ static int device_enumerate(Manager *m) {
static int device_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
_cleanup_udev_device_unref_ struct udev_device *dev = NULL;
Manager *m = userdata;
- const char *action;
+ const char *action, *sysfs;
int r;
assert(m);
@@ -639,33 +654,47 @@ static int device_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
if (!dev)
return 0;
+ sysfs = udev_device_get_syspath(dev);
+ if (!sysfs) {
+ log_error("Failed to get udev sys path.");
+ return 0;
+ }
+
action = udev_device_get_action(dev);
if (!action) {
log_error("Failed to get udev action string.");
return 0;
}
- if (streq(action, "remove") || !device_is_ready(dev)) {
- r = device_process_removed_device(m, dev);
- if (r < 0)
- log_error_errno(r, "Failed to process device remove event: %m");
-
- r = swap_process_removed_device(m, dev);
+ if (streq(action, "remove")) {
+ r = swap_process_device_remove(m, dev);
if (r < 0)
log_error_errno(r, "Failed to process swap device remove event: %m");
- } else {
- r = device_process_new_device(m, dev);
- if (r < 0)
- log_error_errno(r, "Failed to process device new event: %m");
+ /* If we get notified that a device was removed by
+ * udev, then it's completely gone, hence unset all
+ * found bits */
+ device_update_found_by_sysfs(m, sysfs, false, DEVICE_FOUND_UDEV|DEVICE_FOUND_MOUNT|DEVICE_FOUND_SWAP, true);
- r = swap_process_new_device(m, dev);
+ } else if (device_is_ready(dev)) {
+
+ (void) device_process_new(m, dev);
+
+ r = swap_process_device_new(m, dev);
if (r < 0)
log_error_errno(r, "Failed to process swap device new event: %m");
manager_dispatch_load_queue(m);
- device_set_path_plugged(m, dev);
+ /* The device is found now, set the udev found bit */
+ device_update_found_by_sysfs(m, sysfs, true, DEVICE_FOUND_UDEV, true);
+
+ } else {
+ /* The device is nominally around, but not ready for
+ * us. Hence unset the udev bit, but leave the rest
+ * around. */
+
+ device_update_found_by_sysfs(m, sysfs, false, DEVICE_FOUND_UDEV, true);
}
return 0;
@@ -684,9 +713,58 @@ static bool device_supported(Manager *m) {
return read_only <= 0;
}
+int device_found_node(Manager *m, const char *node, bool add, DeviceFound found, bool now) {
+ _cleanup_udev_device_unref_ struct udev_device *dev = NULL;
+ struct stat st;
+
+ assert(m);
+ assert(node);
+
+ /* This is called whenever we find a device referenced in
+ * /proc/swaps or /proc/self/mounts. Such a device might be
+ * mounted/enabled at a time where udev has not finished
+ * probing it yet, and we thus haven't learned about it
+ * yet. In this case we will set the device unit to
+ * "tentative" state. */
+
+ if (add) {
+ if (!path_startswith(node, "/dev"))
+ return 0;
+
+ if (stat(node, &st) < 0) {
+ if (errno == ENOENT)
+ return 0;
+
+ return log_error_errno(errno, "Failed to stat device node file %s: %m", node);
+ }
+
+ if (!S_ISBLK(st.st_mode) && !S_ISCHR(st.st_mode))
+ return 0;
+
+ dev = udev_device_new_from_devnum(m->udev, S_ISBLK(st.st_mode) ? 'b' : 'c', st.st_rdev);
+ if (!dev) {
+ if (errno == ENOENT)
+ return 0;
+
+ return log_oom();
+ }
+
+ /* If the device is known in the kernel and newly
+ * appeared, then we'll create a device unit for it,
+ * under the name referenced in /proc/swaps or
+ * /proc/self/mountinfo. */
+
+ (void) device_setup_unit(m, dev, node, false);
+ }
+
+ /* Update the device unit's state, should it exist */
+ return device_update_found_by_name(m, node, add, found, now);
+}
+
static const char* const device_state_table[_DEVICE_STATE_MAX] = {
[DEVICE_DEAD] = "dead",
- [DEVICE_PLUGGED] = "plugged"
+ [DEVICE_TENTATIVE] = "tentative",
+ [DEVICE_PLUGGED] = "plugged",
};
DEFINE_STRING_TABLE_LOOKUP(device_state, DeviceState);
diff --git a/src/core/device.h b/src/core/device.h
index 9065085..9f46e08 100644
--- a/src/core/device.h
+++ b/src/core/device.h
@@ -28,20 +28,28 @@ typedef struct Device Device;
* simplifies the state engine greatly */
typedef enum DeviceState {
DEVICE_DEAD,
- DEVICE_PLUGGED,
+ DEVICE_TENTATIVE, /* mounted or swapped, but not (yet) announced by udev */
+ DEVICE_PLUGGED, /* announced by udev */
_DEVICE_STATE_MAX,
_DEVICE_STATE_INVALID = -1
} DeviceState;
+typedef enum DeviceFound {
+ DEVICE_NOT_FOUND = 0,
+ DEVICE_FOUND_UDEV = 1,
+ DEVICE_FOUND_MOUNT = 2,
+ DEVICE_FOUND_SWAP = 4,
+} DeviceFound;
+
struct Device {
Unit meta;
char *sysfs;
+ DeviceFound found;
/* In order to be able to distinguish dependencies on
different device nodes we might end up creating multiple
devices for the same sysfs path. We chain them up here. */
-
LIST_FIELDS(struct Device, same_sysfs);
DeviceState state;
@@ -51,3 +59,5 @@ extern const UnitVTable device_vtable;
const char* device_state_to_string(DeviceState i) _const_;
DeviceState device_state_from_string(const char *s) _pure_;
+
+int device_found_node(Manager *m, const char *node, bool add, DeviceFound found, bool now);
diff --git a/src/core/mount.c b/src/core/mount.c
index 40037e7..8e4a376 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1386,7 +1386,7 @@ static int mount_dispatch_timer(sd_event_source *source, usec_t usec, void *user
return 0;
}
-static int mount_add_one(
+static int mount_setup_unit(
Manager *m,
const char *what,
const char *where,
@@ -1429,7 +1429,7 @@ static int mount_add_one(
u = unit_new(m, sizeof(Mount));
if (!u)
- return -ENOMEM;
+ return log_oom();
r = unit_add_name(u, e);
if (r < 0)
@@ -1542,6 +1542,8 @@ static int mount_add_one(
return 0;
fail:
+ log_warning_errno(r, "Failed to set up mount unit: %m");
+
if (delete && u)
unit_free(u);
@@ -1549,33 +1551,36 @@ static int mount_add_one(
}
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
- _cleanup_(mnt_free_tablep) struct libmnt_table *tb = NULL;
- _cleanup_(mnt_free_iterp) struct libmnt_iter *itr = NULL;
- struct libmnt_fs *fs;
+ _cleanup_(mnt_free_tablep) struct libmnt_table *t = NULL;
+ _cleanup_(mnt_free_iterp) struct libmnt_iter *i = NULL;
int r = 0;
assert(m);
- tb = mnt_new_table();
- itr = mnt_new_iter(MNT_ITER_FORWARD);
- if (!tb || !itr)
+ t = mnt_new_table();
+ if (!t)
return log_oom();
- r = mnt_table_parse_mtab(tb, NULL);
+ i = mnt_new_iter(MNT_ITER_FORWARD);
+ if (!i)
+ return log_oom();
+
+ r = mnt_table_parse_mtab(t, NULL);
if (r < 0)
- return r;
+ return log_error_errno(r, "Failed to parse /proc/self/mountinfo: %m");
r = 0;
for (;;) {
const char *device, *path, *options, *fstype;
_cleanup_free_ const char *d = NULL, *p = NULL;
+ struct libmnt_fs *fs;
int k;
- k = mnt_table_next_fs(tb, itr, &fs);
+ k = mnt_table_next_fs(t, i, &fs);
if (k == 1)
break;
- else if (k < 0)
- return log_error_errno(k, "Failed to get next entry from /etc/fstab: %m");
+ if (k < 0)
+ return log_error_errno(k, "Failed to get next entry from /proc/self/mountinfo: %m");
device = mnt_fs_get_source(fs);
path = mnt_fs_get_target(fs);
@@ -1583,11 +1588,16 @@ static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
fstype = mnt_fs_get_fstype(fs);
d = cunescape(device);
+ if (!d)
+ return log_oom();
+
p = cunescape(path);
- if (!d || !p)
+ if (!p)
return log_oom();
- k = mount_add_one(m, d, p, options, fstype, set_flags);
+ (void) device_found_node(m, d, true, DEVICE_FOUND_MOUNT, set_flags);
+
+ k = mount_setup_unit(m, d, p, options, fstype, set_flags);
if (r == 0 && k < 0)
r = k;
}
@@ -1731,8 +1741,6 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
r = mount_load_proc_self_mountinfo(m, true);
if (r < 0) {
- log_error_errno(r, "Failed to reread /proc/self/mountinfo: %m");
-
/* Reset flags, just in case, for later calls */
LIST_FOREACH(units_by_type, u, m->units_by_type[UNIT_MOUNT]) {
Mount *mount = MOUNT(u);
@@ -1765,6 +1773,10 @@ static int mount_dispatch_io(sd_event_source *source, int fd, uint32_t revents,
break;
}
+ if (mount->parameters_proc_self_mountinfo.what)
+ (void) device_found_node(m, mount->parameters_proc_self_mountinfo.what, false, DEVICE_FOUND_MOUNT, true);
+
+
} else if (mount->just_mounted || mount->just_changed) {
/* New or changed mount entry */
diff --git a/src/core/swap.c b/src/core/swap.c
index f73a8e6..de3a5d8 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -331,7 +331,7 @@ static int swap_load(Unit *u) {
return swap_verify(s);
}
-static int swap_add_one(
+static int swap_setup_unit(
Manager *m,
const char *what,
const char *what_proc_swaps,
@@ -356,8 +356,10 @@ static int swap_add_one(
if (u &&
SWAP(u)->from_proc_swaps &&
- !path_equal(SWAP(u)->parameters_proc_swaps.what, what_proc_swaps))
+ !path_equal(SWAP(u)->parameters_proc_swaps.what, what_proc_swaps)) {
+ log_error("Swap %s appeared twice with different device paths %s and %s", e, SWAP(u)->parameters_proc_swaps.what, what_proc_swaps);
return -EEXIST;
+ }
if (!u) {
delete = true;
@@ -372,7 +374,7 @@ static int swap_add_one(
SWAP(u)->what = strdup(what);
if (!SWAP(u)->what) {
- r = log_oom();
+ r = -ENOMEM;
goto fail;
}
@@ -400,7 +402,6 @@ static int swap_add_one(
p->priority = priority;
unit_add_to_dbus_queue(u);
-
return 0;
fail:
@@ -412,7 +413,7 @@ static int swap_add_one(
return r;
}
-static int swap_process_new_swap(Manager *m, const char *device, int prio, bool set_flags) {
+static int swap_process_new(Manager *m, const char *device, int prio, bool set_flags) {
_cleanup_udev_device_unref_ struct udev_device *d = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
const char *dn;
@@ -421,7 +422,7 @@ static int swap_process_new_swap(Manager *m, const char *device, int prio, bool
assert(m);
- r = swap_add_one(m, device, device, prio, set_flags);
+ r = swap_setup_unit(m, device, device, prio, set_flags);
if (r < 0)
return r;
@@ -437,7 +438,7 @@ static int swap_process_new_swap(Manager *m, const char *device, int prio, bool
/* Add the main device node */
dn = udev_device_get_devnode(d);
if (dn && !streq(dn, device))
- swap_add_one(m, dn, device, prio, set_flags);
+ swap_setup_unit(m, dn, device, prio, set_flags);
/* Add additional units for all symlinks */
first = udev_device_get_devlinks_list_entry(d);
@@ -458,7 +459,7 @@ static int swap_process_new_swap(Manager *m, const char *device, int prio, bool
st.st_rdev != udev_device_get_devnum(d))
continue;
- swap_add_one(m, p, device, prio, set_flags);
+ swap_setup_unit(m, p, device, prio, set_flags);
}
return r;
@@ -1084,15 +1085,17 @@ static int swap_load_proc_swaps(Manager *m, bool set_flags) {
if (k == EOF)
break;
- log_warning("Failed to parse /proc/swaps:%u", i);
+ log_warning("Failed to parse /proc/swaps:%u.", i);
continue;
}
d = cunescape(dev);
if (!d)
- return -ENOMEM;
+ return log_oom();
+
+ device_found_node(m, d, true, DEVICE_FOUND_SWAP, set_flags);
- k = swap_process_new_swap(m, d, prio, set_flags);
+ k = swap_process_new(m, d, prio, set_flags);
if (k < 0)
r = k;
}
@@ -1144,6 +1147,9 @@ static int swap_dispatch_io(sd_event_source *source, int fd, uint32_t revents, v
break;
}
+ if (swap->what)
+ device_found_node(m, swap->what, false, DEVICE_FOUND_SWAP, true);
+
} else if (swap->just_activated) {
/* New swap entry */
@@ -1291,7 +1297,7 @@ static int swap_enumerate(Manager *m) {
return r;
}
-int swap_process_new_device(Manager *m, struct udev_device *dev) {
+int swap_process_device_new(Manager *m, struct udev_device *dev) {
struct udev_list_entry *item = NULL, *first = NULL;
_cleanup_free_ char *e = NULL;
const char *dn;
@@ -1334,7 +1340,7 @@ int swap_process_new_device(Manager *m, struct udev_device *dev) {
return r;
}
-int swap_process_removed_device(Manager *m, struct udev_device *dev) {
+int swap_process_device_remove(Manager *m, struct udev_device *dev) {
const char *dn;
int r = 0;
Swap *s;
diff --git a/src/core/swap.h b/src/core/swap.h
index c36c6f2..5de8c20 100644
--- a/src/core/swap.h
+++ b/src/core/swap.h
@@ -115,8 +115,8 @@ struct Swap {
extern const UnitVTable swap_vtable;
-int swap_process_new_device(Manager *m, struct udev_device *dev);
-int swap_process_removed_device(Manager *m, struct udev_device *dev);
+int swap_process_device_new(Manager *m, struct udev_device *dev);
+int swap_process_device_remove(Manager *m, struct udev_device *dev);
const char* swap_state_to_string(SwapState i) _const_;
SwapState swap_state_from_string(const char *s) _pure_;
diff --git a/src/core/unit.c b/src/core/unit.c
index 63ccd67..7cd7043 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2834,7 +2834,6 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) {
return -ENOMEM;
r = manager_load_unit(u->manager, e, NULL, NULL, &device);
-
if (r < 0)
return r;

View File

@ -1,23 +0,0 @@
From 5259bcf6a638d8d489db1ddefd55327aa15f3e51 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 23 Apr 2015 13:50:01 +0200
Subject: core: downgrade warning about duplicate device names
http://lists.freedesktop.org/archives/systemd-devel/2015-April/031094.html
diff --git a/src/core/device.c b/src/core/device.c
index dca2a82..43c4c67 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -282,7 +282,7 @@ static int device_setup_unit(Manager *m, struct udev_device *dev, const char *pa
if (u &&
DEVICE(u)->sysfs &&
!path_equal(DEVICE(u)->sysfs, sysfs)) {
- log_unit_error(u->id, "Device %s appeared twice with different sysfs paths %s and %s", e, DEVICE(u)->sysfs, sysfs);
+ log_unit_debug(u->id, "Device %s appeared twice with different sysfs paths %s and %s", e, DEVICE(u)->sysfs, sysfs);
return -EEXIST;
}
--
cgit v0.10.2

View File

@ -1,376 +0,0 @@
From 6e392c9c45643d106673c6643ac8bf4e65da13c1 Mon Sep 17 00:00:00 2001
From: Ivan Shapovalov <intelfx100@gmail.com>
Date: Sat, 7 Mar 2015 08:44:52 -0500
Subject: [PATCH] core: do not spawn jobs or touch other units during
coldplugging
Because the order of coldplugging is not defined, we can reference a
not-yet-coldplugged unit and read its state while it has not yet been
set to a meaningful value.
This way, already active units may get started again.
We fix this by deferring such actions until all units have been at
least somehow coldplugged.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=88401
---
src/core/automount.c | 2 +-
src/core/busname.c | 2 +-
src/core/device.c | 2 +-
src/core/manager.c | 35 +++++++++++++++++++++++++++++++++--
src/core/mount.c | 2 +-
src/core/path.c | 14 ++++++++++----
src/core/scope.c | 2 +-
src/core/service.c | 2 +-
src/core/slice.c | 2 +-
src/core/snapshot.c | 2 +-
src/core/socket.c | 2 +-
src/core/swap.c | 2 +-
src/core/target.c | 2 +-
src/core/timer.c | 14 ++++++++++----
src/core/unit.c | 25 ++++++++++++++++---------
src/core/unit.h | 12 +++++++++---
16 files changed, 89 insertions(+), 33 deletions(-)
diff --git a/src/core/automount.c b/src/core/automount.c
index 4a509ef..0539fbb 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -233,7 +233,7 @@ static void automount_set_state(Automount *a, AutomountState state) {
unit_notify(UNIT(a), state_translation_table[old_state], state_translation_table[state], true);
}
-static int automount_coldplug(Unit *u) {
+static int automount_coldplug(Unit *u, Hashmap *deferred_work) {
Automount *a = AUTOMOUNT(u);
int r;
diff --git a/src/core/busname.c b/src/core/busname.c
index 1d77292..43d7607 100644
--- a/src/core/busname.c
+++ b/src/core/busname.c
@@ -335,7 +335,7 @@ static void busname_set_state(BusName *n, BusNameState state) {
unit_notify(UNIT(n), state_translation_table[old_state], state_translation_table[state], true);
}
-static int busname_coldplug(Unit *u) {
+static int busname_coldplug(Unit *u, Hashmap *deferred_work) {
BusName *n = BUSNAME(u);
int r;
diff --git a/src/core/device.c b/src/core/device.c
index eb976b8..6b489a4 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -140,7 +140,7 @@ static void device_set_state(Device *d, DeviceState state) {
unit_notify(UNIT(d), state_translation_table[old_state], state_translation_table[state], true);
}
-static int device_coldplug(Unit *u) {
+static int device_coldplug(Unit *u, Hashmap *deferred_work) {
Device *d = DEVICE(u);
assert(d);
diff --git a/src/core/manager.c b/src/core/manager.c
index 7a6d519..3e87aa9 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -975,7 +975,28 @@ static int manager_coldplug(Manager *m) {
Unit *u;
char *k;
- assert(m);
+ /*
+ * Some unit types tend to spawn jobs or check other units' state
+ * during coldplug. This is wrong because it is undefined whether the
+ * units in question have been already coldplugged (i. e. their state
+ * restored). This way, we can easily re-start an already started unit
+ * or otherwise make a wrong decision based on the unit's state.
+ *
+ * Solve this by providing a way for coldplug functions to defer
+ * such actions until after all units have been coldplugged.
+ *
+ * We store Unit* -> int(*)(Unit*).
+ *
+ * https://bugs.freedesktop.org/show_bug.cgi?id=88401
+ */
+ _cleanup_hashmap_free_ Hashmap *deferred_work = NULL;
+ int(*proc)(Unit*);
+
+ assert(m);
+
+ deferred_work = hashmap_new(&trivial_hash_ops);
+ if (!deferred_work)
+ return -ENOMEM;
/* Then, let's set up their initial state. */
HASHMAP_FOREACH_KEY(u, k, m->units, i) {
@@ -985,7 +1006,17 @@ static int manager_coldplug(Manager *m) {
if (u->id != k)
continue;
- q = unit_coldplug(u);
+ q = unit_coldplug(u, deferred_work);
+ if (q < 0)
+ r = q;
+ }
+
+ /* After coldplugging and setting up initial state of the units,
+ * let's perform operations which spawn jobs or query units' state. */
+ HASHMAP_FOREACH_KEY(proc, u, deferred_work, i) {
+ int q;
+
+ q = proc(u);
if (q < 0)
r = q;
}
diff --git a/src/core/mount.c b/src/core/mount.c
index 5ee679d..1251c94 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -612,7 +612,7 @@ static void mount_set_state(Mount *m, MountState state) {
m->reload_result = MOUNT_SUCCESS;
}
-static int mount_coldplug(Unit *u) {
+static int mount_coldplug(Unit *u, Hashmap *deferred_work) {
Mount *m = MOUNT(u);
MountState new_state = MOUNT_DEAD;
int r;
diff --git a/src/core/path.c b/src/core/path.c
index fbb695d..6be9ac8 100644
--- a/src/core/path.c
+++ b/src/core/path.c
@@ -438,7 +438,12 @@ static void path_set_state(Path *p, PathState state) {
static void path_enter_waiting(Path *p, bool initial, bool recheck);
-static int path_coldplug(Unit *u) {
+static int path_enter_waiting_coldplug(Unit *u) {
+ path_enter_waiting(PATH(u), true, true);
+ return 0;
+}
+
+static int path_coldplug(Unit *u, Hashmap *deferred_work) {
Path *p = PATH(u);
assert(p);
@@ -447,9 +452,10 @@ static int path_coldplug(Unit *u) {
if (p->deserialized_state != p->state) {
if (p->deserialized_state == PATH_WAITING ||
- p->deserialized_state == PATH_RUNNING)
- path_enter_waiting(p, true, true);
- else
+ p->deserialized_state == PATH_RUNNING) {
+ hashmap_put(deferred_work, u, &path_enter_waiting_coldplug);
+ path_set_state(p, PATH_WAITING);
+ } else
path_set_state(p, p->deserialized_state);
}
diff --git a/src/core/scope.c b/src/core/scope.c
index 1c3c6bb..8b2bb29 100644
--- a/src/core/scope.c
+++ b/src/core/scope.c
@@ -171,7 +171,7 @@ static int scope_load(Unit *u) {
return scope_verify(s);
}
-static int scope_coldplug(Unit *u) {
+static int scope_coldplug(Unit *u, Hashmap *deferred_work) {
Scope *s = SCOPE(u);
int r;
diff --git a/src/core/service.c b/src/core/service.c
index a89ff3f..cc4ea19 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -878,7 +878,7 @@ static void service_set_state(Service *s, ServiceState state) {
s->reload_result = SERVICE_SUCCESS;
}
-static int service_coldplug(Unit *u) {
+static int service_coldplug(Unit *u, Hashmap *deferred_work) {
Service *s = SERVICE(u);
int r;
diff --git a/src/core/slice.c b/src/core/slice.c
index 0bebdbc..0285c49 100644
--- a/src/core/slice.c
+++ b/src/core/slice.c
@@ -150,7 +150,7 @@ static int slice_load(Unit *u) {
return slice_verify(s);
}
-static int slice_coldplug(Unit *u) {
+static int slice_coldplug(Unit *u, Hashmap *deferred_work) {
Slice *t = SLICE(u);
assert(t);
diff --git a/src/core/snapshot.c b/src/core/snapshot.c
index b70c3be..b1d8448 100644
--- a/src/core/snapshot.c
+++ b/src/core/snapshot.c
@@ -75,7 +75,7 @@ static int snapshot_load(Unit *u) {
return 0;
}
-static int snapshot_coldplug(Unit *u) {
+static int snapshot_coldplug(Unit *u, Hashmap *deferred_work) {
Snapshot *s = SNAPSHOT(u);
assert(s);
diff --git a/src/core/socket.c b/src/core/socket.c
index 9606ac2..f67370b 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1322,7 +1322,7 @@ static void socket_set_state(Socket *s, SocketState state) {
unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], true);
}
-static int socket_coldplug(Unit *u) {
+static int socket_coldplug(Unit *u, Hashmap *deferred_work) {
Socket *s = SOCKET(u);
int r;
diff --git a/src/core/swap.c b/src/core/swap.c
index 4dd6be8..bb1398f 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -506,7 +506,7 @@ static void swap_set_state(Swap *s, SwapState state) {
job_add_to_run_queue(UNIT(other)->job);
}
-static int swap_coldplug(Unit *u) {
+static int swap_coldplug(Unit *u, Hashmap *deferred_work) {
Swap *s = SWAP(u);
SwapState new_state = SWAP_DEAD;
int r;
diff --git a/src/core/target.c b/src/core/target.c
index 8817ef2..5f64402 100644
--- a/src/core/target.c
+++ b/src/core/target.c
@@ -103,7 +103,7 @@ static int target_load(Unit *u) {
return 0;
}
-static int target_coldplug(Unit *u) {
+static int target_coldplug(Unit *u, Hashmap *deferred_work) {
Target *t = TARGET(u);
assert(t);
diff --git a/src/core/timer.c b/src/core/timer.c
index 9405501..79a7540 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -267,7 +267,12 @@ static void timer_set_state(Timer *t, TimerState state) {
static void timer_enter_waiting(Timer *t, bool initial);
-static int timer_coldplug(Unit *u) {
+static int timer_enter_waiting_coldplug(Unit *u) {
+ timer_enter_waiting(TIMER(u), false);
+ return 0;
+}
+
+static int timer_coldplug(Unit *u, Hashmap *deferred_work) {
Timer *t = TIMER(u);
assert(t);
@@ -275,9 +280,10 @@ static int timer_coldplug(Unit *u) {
if (t->deserialized_state != t->state) {
- if (t->deserialized_state == TIMER_WAITING)
- timer_enter_waiting(t, false);
- else
+ if (t->deserialized_state == TIMER_WAITING) {
+ hashmap_put(deferred_work, u, &timer_enter_waiting_coldplug);
+ timer_set_state(t, TIMER_WAITING);
+ } else
timer_set_state(t, t->deserialized_state);
}
diff --git a/src/core/unit.c b/src/core/unit.c
index b639d68..ec4fa82 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2856,27 +2856,34 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) {
return 0;
}
-int unit_coldplug(Unit *u) {
+static int unit_add_deserialized_job_coldplug(Unit *u) {
+ int r;
+
+ r = manager_add_job(u->manager, u->deserialized_job, u, JOB_IGNORE_REQUIREMENTS, false, NULL, NULL);
+ if (r < 0)
+ return r;
+
+ u->deserialized_job = _JOB_TYPE_INVALID;
+
+ return 0;
+}
+
+int unit_coldplug(Unit *u, Hashmap *deferred_work) {
int r;
assert(u);
if (UNIT_VTABLE(u)->coldplug)
- if ((r = UNIT_VTABLE(u)->coldplug(u)) < 0)
+ if ((r = UNIT_VTABLE(u)->coldplug(u, deferred_work)) < 0)
return r;
if (u->job) {
r = job_coldplug(u->job);
if (r < 0)
return r;
- } else if (u->deserialized_job >= 0) {
+ } else if (u->deserialized_job >= 0)
/* legacy */
- r = manager_add_job(u->manager, u->deserialized_job, u, JOB_IGNORE_REQUIREMENTS, false, NULL, NULL);
- if (r < 0)
- return r;
-
- u->deserialized_job = _JOB_TYPE_INVALID;
- }
+ hashmap_put(deferred_work, u, &unit_add_deserialized_job_coldplug);
return 0;
}
diff --git a/src/core/unit.h b/src/core/unit.h
index ac5647a..11242c2 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -301,8 +301,14 @@ struct UnitVTable {
int (*load)(Unit *u);
/* If a lot of units got created via enumerate(), this is
- * where to actually set the state and call unit_notify(). */
- int (*coldplug)(Unit *u);
+ * where to actually set the state and call unit_notify().
+ *
+ * This must not reference other units (maybe implicitly through spawning
+ * jobs), because it is possible that they are not yet coldplugged.
+ * Such actions must be deferred until the end of coldplug bу adding
+ * a "Unit* -> int(*)(Unit*)" entry into the hashmap.
+ */
+ int (*coldplug)(Unit *u, Hashmap *deferred_work);
void (*dump)(Unit *u, FILE *f, const char *prefix);
@@ -538,7 +544,7 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds);
int unit_add_node_link(Unit *u, const char *what, bool wants);
-int unit_coldplug(Unit *u);
+int unit_coldplug(Unit *u, Hashmap *deferred_work);
void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) _printf_(3, 0);
--
2.3.2

View File

@ -1,31 +0,0 @@
From 496068a8288084ab3ecf8b179a8403ecff1a6be8 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Fri, 13 Mar 2015 08:35:59 +0100
Subject: core: don't change removed devices to state "tentative"
Commit 628c89c introduced the "tentative" device state, which caused
devices to go from "plugged" to "tentative" on a remove uevent. This
breaks the cleanup of stale mounts (see commit 3b48ce4), as that only
applies to "dead" devices.
The "tentative" state only really makes sense on adding a device when
we don't know where it was coming from (i. e. not from udev). But when
we get a device removal from udev we definitively know that it's gone,
so change the device state back to "dead" as before 628c89c.
diff --git a/src/core/device.c b/src/core/device.c
index 4bfd71f..b5d9d82 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -419,7 +419,7 @@ static void device_update_found_one(Device *d, bool add, DeviceFound found, bool
if (now) {
if (d->found & DEVICE_FOUND_UDEV)
device_set_state(d, DEVICE_PLUGGED);
- else if (d->found != DEVICE_NOT_FOUND)
+ else if (add && d->found != DEVICE_NOT_FOUND)
device_set_state(d, DEVICE_TENTATIVE);
else
device_set_state(d, DEVICE_DEAD);
--
cgit v0.10.2

View File

@ -1,30 +0,0 @@
From ff59e06f9423af0532aaeedf931474823f764875 Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Wed, 9 Nov 2016 08:00:26 -0500
Subject: [PATCH] disable RestrictAddressFamilies on i686
Shit's broke, yo.
https://github.com/systemd/systemd/issues/4575
---
src/core/execute.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/core/execute.c b/src/core/execute.c
index f666f7c..7d09154 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -1254,6 +1254,10 @@ static int apply_address_families(const Unit* u, const ExecContext *c) {
Iterator i;
int r;
+#if defined(__i386__)
+ return 0;
+#endif
+
assert(c);
if (skip_seccomp_unavailable(u, "RestrictAddressFamilies="))
--
2.10.2

View File

@ -1,11 +0,0 @@
--- systemd-232/src/libudev/libudev.pc.in.orig 2016-12-01 12:21:25.504783677 +0100
+++ systemd-232/src/libudev/libudev.pc.in 2016-12-01 12:21:50.412921862 +0100
@@ -7,7 +7,7 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
-libdir=@libdir@
+libdir=@rootlibdir@
includedir=@includedir@
Name: libudev

View File

@ -1,13 +0,0 @@
--- systemd-228/sysctl.d/50-coredump.conf.in.orig 2015-11-23 21:25:34.287966718 +0100
+++ systemd-228/sysctl.d/50-coredump.conf.in 2015-11-24 00:28:21.717824291 +0100
@@ -9,4 +9,9 @@
# and systemd-coredump(8) and core(5) for the explanation of the
# setting below.
-kernel.core_pattern=|@rootlibexecdir@/systemd-coredump %P %u %g %s %t %c %e
+# NOTE: systemd-coredump is disabled; to enable it create a file called
+# /etc/sysctl.d/50-coredump.conf with the following uncommented line:
+#kernel.core_pattern=|@rootlibexecdir@/systemd-coredump %P %u %g %s %t %c %e
+
+kernel.core_pattern = core
+kernel.core_uses_pid = 0

View File

@ -1,58 +0,0 @@
From 521251d2757295b6e9df4b51c7cb33929fbd65c4 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppymaster@gmail.com>
Date: Sat, 30 Dec 2017 06:16:49 -0500
Subject: [PATCH] sysctl: use raw file descriptor in sysctl_write (#7753)
The kernel returns specific error codes which may be lost if we use the
libc buffered io functions.
Fixes: https://github.com/systemd/systemd/issues/7744
---
src/shared/sysctl-util.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c
index 189580e3ed..0bc81aaa56 100644
--- a/src/shared/sysctl-util.c
+++ b/src/shared/sysctl-util.c
@@ -18,9 +18,13 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <errno.h>
+#include <fcntl.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
+#include "fd-util.h"
#include "fileio.h"
#include "log.h"
#include "macro.h"
@@ -53,6 +57,7 @@ char *sysctl_normalize(char *s) {
int sysctl_write(const char *property, const char *value) {
char *p;
+ _cleanup_close_ int fd = -1;
assert(property);
assert(value);
@@ -60,7 +65,17 @@ int sysctl_write(const char *property, const char *value) {
log_debug("Setting '%s' to '%s'", property, value);
p = strjoina("/proc/sys/", property);
- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
+ fd = open(p, O_WRONLY|O_CLOEXEC);
+ if (fd < 0)
+ return -errno;
+
+ if (!endswith(value, "\n"))
+ value = strjoina(value, "\n");
+
+ if (write(fd, value, strlen(value)) < 0)
+ return -errno;
+
+ return 0;
}
int sysctl_read(const char *property, char **content) {

View File

@ -1,72 +0,0 @@
From 227b8a762fea1458547be2cdf0e6e4aac0079730 Mon Sep 17 00:00:00 2001
From: Michael Olbrich <m.olbrich@pengutronix.de>
Date: Mon, 26 Mar 2018 17:34:53 +0200
Subject: [PATCH] core: don't include libmount.h in a header file (#8580)
linux/fs.h sys/mount.h, libmount.h and missing.h all include MS_*
definitions.
To avoid problems, only one of linux/fs.h, sys/mount.h and libmount.h
should be included. And missing.h must be included last.
Without this, building systemd may fail with:
In file included from [...]/libmount/libmount.h:31:0,
from ../systemd-238/src/core/manager.h:23,
from ../systemd-238/src/core/emergency-action.h:37,
from ../systemd-238/src/core/unit.h:34,
from ../systemd-238/src/core/dbus-timer.h:25,
from ../systemd-238/src/core/timer.c:26:
[...]/sys/mount.h:57:2: error: expected identifier before numeric constant
---
src/core/dbus-execute.c | 1 +
src/core/manager.h | 3 ++-
src/core/mount.c | 2 ++
3 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 7344623ebf6..c342093bca4 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <sys/mount.h>
#include <sys/prctl.h>
#include <stdio_ext.h>
diff --git a/src/core/manager.h b/src/core/manager.h
index 28c5da225b1..e09e0cdf5e9 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -20,7 +20,6 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <libmount.h>
#include <stdbool.h>
#include <stdio.h>
@@ -34,6 +33,8 @@
#include "list.h"
#include "ratelimit.h"
+struct libmnt_monitor;
+
/* Enforce upper limit how many names we allow */
#define MANAGER_MAX_NAMES 131072 /* 128K */
diff --git a/src/core/mount.c b/src/core/mount.c
index 0e755da5c02..0154ebda5d6 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -23,6 +23,8 @@
#include <stdio.h>
#include <sys/epoll.h>
+#include <libmount.h>
+
#include "sd-messages.h"
#include "alloc-util.h"

View File

@ -1,105 +0,0 @@
From 75720bff62a84896e9a0654afc7cf9408cf89a38 Mon Sep 17 00:00:00 2001
From: Filipe Brandenburger <filbranden@google.com>
Date: Sun, 15 Jul 2018 22:43:35 -0700
Subject: [PATCH] build-sys: Detect whether struct statx is defined in
sys/stat.h
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Starting with glibc 2.27.9000-36.fc29, include file sys/stat.h will have a
definition for struct statx, in which case include file linux/stat.h should be
avoided, in order to prevent a duplicate definition.
In file included from ../src/basic/missing.h:18,
from ../src/basic/util.h:28,
from ../src/basic/hashmap.h:10,
from ../src/shared/bus-util.h:12,
from ../src/libsystemd/sd-bus/bus-creds.c:11:
/usr/include/linux/stat.h:99:8: error: redefinition of struct statx
struct statx {
^~~~~
In file included from /usr/include/sys/stat.h:446,
from ../src/basic/util.h:19,
from ../src/basic/hashmap.h:10,
from ../src/shared/bus-util.h:12,
from ../src/libsystemd/sd-bus/bus-creds.c:11:
/usr/include/bits/statx.h:36:8: note: originally defined here
struct statx
^~~~~
Extend our meson.build to look for struct statx when only sys/stat.h is
included and, in that case, do not include linux/stat.h anymore.
Tested that systemd builds correctly when using a glibc version that includes a
definition for struct statx.
glibc Fedora RPM update:
https://src.fedoraproject.org/rpms/glibc/c/28cb5d31fc1e5887912283c889689c47076278ae
glibc upstream commit:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fd70af45528d59a00eb3190ef6706cb299488fcd
---
meson.build | 5 +++++
src/basic/missing.h | 5 ++++-
src/basic/xattr-util.c | 1 -
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index dd904c71487..68423bdfa5e 100644
--- a/meson.build
+++ b/meson.build
@@ -425,6 +425,7 @@ decl_headers = '''
#include <sys/stat.h>
'''
# FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
+# FIXME: these should use -D_GNU_SOURCE, since that is defined at build time
foreach decl : ['char16_t',
'char32_t',
@@ -439,6 +440,10 @@ foreach decl : ['char16_t',
conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
endforeach
+conf.set10('HAVE_STRUCT_STATX_IN_SYS_STAT_H', cc.sizeof('struct statx', prefix : '''
+#include <sys/stat.h>
+''', args : '-D_GNU_SOURCE') > 0)
+
foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
['IFLA_VRF_TABLE', 'linux/if_link.h'],
diff --git a/src/basic/missing.h b/src/basic/missing.h
index 71a07d05747..14ad3d49140 100644
--- a/src/basic/missing.h
+++ b/src/basic/missing.h
@@ -15,7 +15,6 @@
#include <linux/neighbour.h>
#include <linux/oom.h>
#include <linux/rtnetlink.h>
-#include <linux/stat.h>
#include <net/ethernet.h>
#include <stdlib.h>
#include <sys/resource.h>
@@ -25,6 +24,10 @@
#include <uchar.h>
#include <unistd.h>
+#if !HAVE_STRUCT_STATX_IN_SYS_STAT_H
+#include <linux/stat.h>
+#endif
+
#if HAVE_AUDIT
#include <libaudit.h>
#endif
diff --git a/src/basic/xattr-util.c b/src/basic/xattr-util.c
index c5c55ea8461..0ee0979837c 100644
--- a/src/basic/xattr-util.c
+++ b/src/basic/xattr-util.c
@@ -2,7 +2,6 @@
#include <errno.h>
#include <fcntl.h>
-#include <linux/stat.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,150 +0,0 @@
From 93a3444a0941c293cecd84920c049b1ba8c81b3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 6 Jan 2019 22:17:00 +0100
Subject: [PATCH] udev: rework how we handle the return value from spawned
programs
When running PROGRAM="...", we would log
systemd-udevd[447]: Failed to wait spawned command '...': Input/output error
no matter why the program actually failed, at error level.
The code wouldn't distinguish between an internal failure and a failure in the
program being called and run sd_event_exit(..., -EIO) on any kind of error. EIO
is rather misleading here, becuase it suggests a serious error.
on_spawn_sigchld is updated to set the return code to distinguish failure to
spawn, including the program being killed by a signal (a negative return value),
and the program failing (positive return value).
The logging levels are adjusted, so that for PROGRAM= calls, which are
essentially "if" statements, we only log at debug level (unless we get a
timeout or segfault or another unexpected error).
---
src/udev/udev-event.c | 38 +++++++++++++-------------------------
src/udev/udev-rules.c | 12 +++++++-----
2 files changed, 20 insertions(+), 30 deletions(-)
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 3e916976c03..07b7365e3aa 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -504,38 +504,34 @@ static int on_spawn_timeout_warning(sd_event_source *s, uint64_t usec, void *use
static int on_spawn_sigchld(sd_event_source *s, const siginfo_t *si, void *userdata) {
Spawn *spawn = userdata;
+ int ret = -EIO;
assert(spawn);
switch (si->si_code) {
case CLD_EXITED:
- if (si->si_status == 0) {
+ if (si->si_status == 0)
log_debug("Process '%s' succeeded.", spawn->cmd);
- sd_event_exit(sd_event_source_get_event(s), 0);
-
- return 1;
- }
-
- log_full(spawn->accept_failure ? LOG_DEBUG : LOG_WARNING,
- "Process '%s' failed with exit code %i.", spawn->cmd, si->si_status);
+ else
+ log_full(spawn->accept_failure ? LOG_DEBUG : LOG_WARNING,
+ "Process '%s' failed with exit code %i.", spawn->cmd, si->si_status);
+ ret = si->si_status;
break;
case CLD_KILLED:
case CLD_DUMPED:
- log_warning("Process '%s' terminated by signal %s.", spawn->cmd, signal_to_string(si->si_status));
-
+ log_error("Process '%s' terminated by signal %s.", spawn->cmd, signal_to_string(si->si_status));
break;
default:
log_error("Process '%s' failed due to unknown reason.", spawn->cmd);
}
- sd_event_exit(sd_event_source_get_event(s), -EIO);
-
+ sd_event_exit(sd_event_source_get_event(s), ret);
return 1;
}
static int spawn_wait(Spawn *spawn) {
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
- int r, ret;
+ int r;
assert(spawn);
@@ -586,15 +582,7 @@ static int spawn_wait(Spawn *spawn) {
if (r < 0)
return r;
- r = sd_event_loop(e);
- if (r < 0)
- return r;
-
- r = sd_event_get_exit_code(e, &ret);
- if (r < 0)
- return r;
-
- return ret;
+ return sd_event_loop(e);
}
int udev_event_spawn(UdevEvent *event,
@@ -679,12 +667,12 @@ int udev_event_spawn(UdevEvent *event,
};
r = spawn_wait(&spawn);
if (r < 0)
- return log_error_errno(r, "Failed to wait spawned command '%s': %m", cmd);
+ return log_error_errno(r, "Failed to wait for spawned command '%s': %m", cmd);
if (result)
result[spawn.result_len] = '\0';
- return r;
+ return r; /* 0 for success, and positive if the program failed */
}
static int rename_netif(UdevEvent *event) {
@@ -899,7 +887,7 @@ void udev_event_execute_run(UdevEvent *event, usec_t timeout_usec) {
(void) usleep(event->exec_delay_usec);
}
- udev_event_spawn(event, timeout_usec, false, command, NULL, 0);
+ (void) udev_event_spawn(event, timeout_usec, false, command, NULL, 0);
}
}
}
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 53c68d254a6..f697972debe 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -645,11 +645,13 @@ static int import_program_into_properties(UdevEvent *event,
const char *program) {
char result[UTIL_LINE_SIZE];
char *line;
- int err;
+ int r;
- err = udev_event_spawn(event, timeout_usec, true, program, result, sizeof(result));
- if (err < 0)
- return err;
+ r = udev_event_spawn(event, timeout_usec, false, program, result, sizeof result);
+ if (r < 0)
+ return r;
+ if (r > 0)
+ return -EIO;
line = result;
while (line) {
@@ -1959,7 +1961,7 @@ int udev_rules_apply_to_event(
rules_str(rules, rule->rule.filename_off),
rule->rule.filename_line);
- if (udev_event_spawn(event, timeout_usec, true, program, result, sizeof(result)) < 0) {
+ if (udev_event_spawn(event, timeout_usec, true, program, result, sizeof(result)) != 0) {
if (cur->key.op != OP_NOMATCH)
goto nomatch;
} else {

View File

@ -1,100 +0,0 @@
Submitted By: Douglas R. Reno <renodr at linuxfromscratch dot org>
Date: 2020-12-02
Initial Package Version: 247
Origin: Upstream + PR #17809
Upstream Status: Applied (and undergoing review)
Description: Fixes a few regressions discovered in systemd-247.
The first regression causes segmentation faults when
shutting down or rebooting. This appears to crash
PID1, which will result in a kernel panic.
The next regression causes systems on networks that
have an IPv4 prefix length of 32 or higher to not be
able to get a route assigned when working over DHCP.
Note: This primarily impacts users of Comcast as an ISP.
diff -Naurp systemd-247.orig/src/core/scope.c systemd-247/src/core/scope.c
--- systemd-247.orig/src/core/scope.c 2020-11-26 12:00:50.000000000 -0600
+++ systemd-247/src/core/scope.c 2020-12-02 18:30:39.826650593 -0600
@@ -377,10 +377,6 @@ static int scope_start(Unit *u) {
return r;
}
- /* Now u->pids have been moved into the scope cgroup, it's not needed
- * anymore. */
- u->pids = set_free(u->pids);
-
s->result = SCOPE_SUCCESS;
scope_set_state(s, SCOPE_RUNNING);
@@ -388,7 +384,13 @@ static int scope_start(Unit *u) {
/* Set the maximum runtime timeout. */
scope_arm_timer(s, usec_add(UNIT(s)->active_enter_timestamp.monotonic, s->runtime_max_usec));
- /* Start watching the PIDs currently in the scope */
+ /* On unified we use proper notifications, hence we can unwatch the PIDs
+ * we just attached to the scope. This can also be done on legacy as
+ * we're going to update the list of the processes we watch with the
+ * PIDs currently in the scope anyway. */
+ unit_unwatch_all_pids(u);
+
+ /* Start watching the PIDs currently in the scope (legacy hierarchy only) */
(void) unit_enqueue_rewatch_pids(u);
return 1;
}
diff -Naurp systemd-247.orig/src/libsystemd/sd-event/sd-event.c systemd-247/src/libsystemd/sd-event/sd-event.c
--- systemd-247.orig/src/libsystemd/sd-event/sd-event.c 2020-11-26 12:00:50.000000000 -0600
+++ systemd-247/src/libsystemd/sd-event/sd-event.c 2020-12-02 18:28:32.268651998 -0600
@@ -3725,7 +3725,7 @@ _public_ int sd_event_run(sd_event *e, u
this_run = now(CLOCK_MONOTONIC);
l = u64log2(this_run - e->last_run);
- assert(l < sizeof(e->delays));
+ assert(l < ELEMENTSOF(e->delays));
e->delays[l]++;
if (this_run - e->last_log >= 5*USEC_PER_SEC) {
diff -Naurp systemd-247.orig/src/network/networkd-address.c systemd-247/src/network/networkd-address.c
--- systemd-247.orig/src/network/networkd-address.c 2020-11-26 12:00:50.000000000 -0600
+++ systemd-247/src/network/networkd-address.c 2020-12-02 18:36:58.081646426 -0600
@@ -1863,10 +1863,12 @@ static int address_section_verify(Addres
address->section->filename, address->section->line);
}
- if (address->family == AF_INET && in_addr_is_null(address->family, &address->in_addr_peer) &&
- address->broadcast.s_addr == 0 && address->prefixlen <= 30)
- address->broadcast.s_addr = address->in_addr.in.s_addr | htobe32(0xfffffffflu >> address->prefixlen);
- else if (address->broadcast.s_addr != 0) {
+ if (address->family == AF_INET &&
+ in_addr_is_null(address->family, &address->in_addr_peer) &&
+ address->prefixlen <= 30) {
+ if (address->broadcast.s_addr == 0)
+ address->broadcast.s_addr = address->in_addr.in.s_addr | htobe32(0xfffffffflu >> address->prefixlen);
+ } else if (address->broadcast.s_addr != 0) {
log_warning("%s: broadcast address is set for IPv6 address or IPv4 address with prefixlength larger than 30. "
"Ignoring Broadcast= setting in the [Address] section from line %u.",
address->section->filename, address->section->line);
diff -Naurp systemd-247.orig/src/network/networkd-dhcp4.c systemd-247/src/network/networkd-dhcp4.c
--- systemd-247.orig/src/network/networkd-dhcp4.c 2020-11-26 12:00:50.000000000 -0600
+++ systemd-247/src/network/networkd-dhcp4.c 2020-12-02 18:37:58.247645763 -0600
@@ -861,7 +861,8 @@ static int dhcp4_update_address(Link *li
addr->cinfo.ifa_prefered = lifetime;
addr->cinfo.ifa_valid = lifetime;
addr->prefixlen = prefixlen;
- addr->broadcast.s_addr = address.s_addr | ~netmask.s_addr;
+ if (prefixlen <= 30)
+ addr->broadcast.s_addr = address.s_addr | ~netmask.s_addr;
SET_FLAG(addr->flags, IFA_F_NOPREFIXROUTE, !link_prefixroute(link));
/* allow reusing an existing address and simply update its lifetime
diff -Naurp systemd-247.orig/src/network/test-networkd-conf.c systemd-247/src/network/test-networkd-conf.c
--- systemd-247.orig/src/network/test-networkd-conf.c 2020-11-26 12:00:50.000000000 -0600
+++ systemd-247/src/network/test-networkd-conf.c 2020-12-02 18:27:55.637652401 -0600
@@ -224,7 +224,7 @@ static void test_config_parse_match_ifna
assert_se(config_parse_match_ifnames("network", "filename", 1, "section", 1, "Name", 0, "!baz", &names, NULL) == 0);
assert_se(config_parse_match_ifnames("network", "filename", 1, "section", 1, "Name", 0, "aaa bbb ccc", &names, NULL) == 0);
- strv_equal(names, STRV_MAKE("!hoge", "!hogehoge", "!foo", "!baz", "aaa", "bbb", "ccc"));
+ assert_se(strv_equal(names, STRV_MAKE("!hoge", "!hogehoge", "!foo", "!baz", "aaa", "bbb", "ccc")));
}
static void test_config_parse_match_strv(void) {

View File

@ -1,25 +0,0 @@
From 08e86b15fc22a8e9f1ee0a791dfd35b2fc25e4c4 Mon Sep 17 00:00:00 2001
From: Daan De Meyer <daan.j.demeyer@gmail.com>
Date: Sun, 22 May 2022 14:36:07 +0200
Subject: [PATCH] coredump: Fix format string type mismatch
Fixes #23471
---
src/coredump/coredump.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c
index c9747416ad3c..994d968d871b 100644
--- a/src/coredump/coredump.c
+++ b/src/coredump/coredump.c
@@ -512,8 +512,8 @@ static int save_external_coredump(
if (truncated)
log_struct(LOG_INFO,
- LOG_MESSAGE("Core file was truncated to %zu bytes.", max_size),
- "SIZE_LIMIT=%zu", max_size,
+ LOG_MESSAGE("Core file was truncated to %"PRIu64" bytes.", max_size),
+ "SIZE_LIMIT=%"PRIu64, max_size,
"MESSAGE_ID=" SD_MESSAGE_TRUNCATED_CORE_STR);
r = fix_permissions(fd, tmp, fn, context, uid);

View File

@ -1,10 +0,0 @@
--- systemd-stable-251.2/src/fundamental/sha256.c.orig 2022-06-13 15:52:57.119352352 +0200
+++ systemd-stable-251.2/src/fundamental/sha256.c 2022-06-13 15:53:09.522271808 +0200
@@ -29,6 +29,7 @@
#include "macro-fundamental.h"
#include "sha256.h"
+#include <stdbool.h>
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define SWAP(n) \

View File

@ -26,7 +26,7 @@
Name: systemd
Epoch: 2
Version: 255.8
Version: 256.9
Release: 1mamba
Summary: A system and service manager compatible with SysV and LSB init scripts
Group: System/Configuration
@ -34,8 +34,7 @@ Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://systemd.io/
Source: https://github.com/systemd/systemd-stable.git/v%{version}/systemd-stable-%{version}.tar.bz2
Source1: udev-initscript
Source: https://github.com/systemd/systemd.git/v%{version}/systemd-%{version}.tar.bz2
Source2: udev-permissions.rules
Source4: udev-openmamba.rules
Source8: udev-check-cdrom.sh
@ -46,30 +45,6 @@ Source14: udev-ifupdown.rules
Source15: udev-post-initscript
Source16: udev-sysconfig
Source17: systemd-sysv-install
Patch0: systemd-191-upstream-build-fix.patch
Patch1: systemd-197-revert-only-add-support.patch
Patch2: systemd-198-lock-to-tty-group-openmamba.patch
Patch3: systemd-235-disable-systemd-coredump.patch
Patch4: systemd-207-gpt-auto-generator.patch
Patch5: udev-177-arm-pre-accept4.patch
Patch6: systemd-207-swap_fix_reverse_dependencies.patch
Patch7: systemd-207-create_wants_symlink.patch
Patch8: systemd-208-journald-reduce-sizes.patch
Patch9: systemd-216-sysv-generator-use-native-targets.patch
Patch10: systemd-218-glibc-2.19.patch
Patch11: systemd-219-rework_device_state_logic.patch
Patch12: systemd-219-upstream_dont_change_devices_state_to_tentative.patch
Patch13: systemd-219-upstream_do_not_spawn_jobs_or_during_coldplug.patch
Patch14: systemd-219-silend-about-device-appeared-twice.patch
Patch15: systemd-232-udev-rootlibdir.patch
Patch16: systemd-232-i586-disable_restrict_address_families.patch
Patch17: systemd-236-use_raw_file_descriptor_in_sysctl_write.patch
Patch18: systemd-238-upstream-dont-include-libmount-h.patch
Patch19: systemd-239-glibc-2.28.patch
Patch20: systemd-240-upstream_fix_return_values.patch
Patch21: systemd-247-upstream-fixes-1.patch
Patch22: systemd-251-fix-format-string-type-mismatch.patch
Patch23: systemd-251.2-add-stdbool-include-1.patch
Patch24: systemd-254.5-systemd-networkd-wait-online-condition-networks-managed.patch
License: GPL
## AUTOBUILDREQ-BEGIN
@ -86,8 +61,6 @@ BuildRequires: libfdisk-devel
BuildRequires: libgcrypt-devel
BuildRequires: libgnutls-devel
BuildRequires: libgpg-error-devel
BuildRequires: libkmod-devel
BuildRequires: liblz4-devel
BuildRequires: liblzma-devel
BuildRequires: libmicrohttpd-devel
BuildRequires: libmount-devel
@ -97,7 +70,6 @@ BuildRequires: libseccomp-devel
BuildRequires: libselinux-devel
BuildRequires: libxcrypt-devel
BuildRequires: libz-devel
BuildRequires: libzstd-devel
## AUTOBUILDREQ-END
BuildRequires: docbook-xsl >= 1.79.2-3mamba
BuildRequires: kmod >= 28-3mamba
@ -176,7 +148,6 @@ Requires(post):/usr/sbin/groupadd
Requires(post):setup
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires: libudev = %{?epoch:%epoch:}%{version}-%{release}
Requires: initscripts >= 1.1.18
%description -n udev
Udev allows Linux users to have a dynamic /dev directory and it provides the ability to have persistent device names.
@ -215,18 +186,11 @@ This package include development files for building software using udev librarie
%debug_package
%prep
%setup -q -n systemd-stable-%{version}
%setup -q
#-D -T
#:<< _EOF
#%patch 21 -p1
#%patch 22 -p1 -b .fix-format-string-type-mismatch
#%ifarch %{ix86}
#%patch 23 -p1
#%endif
%patch 24 -p 1
#sed -i "s|@bindir@|/bin|g" src/core/macros.systemd.in
%build
#:<< _EOF
# LANG Workaround for meson error
@ -257,6 +221,7 @@ export LC_ALL="en_US.UTF-8"
-Dsysvinit-path=%{_initrddir} \
-Drc-local=%{_initrddir}/rc.local \
-Ddebug-shell=/bin/sh \
-Dlink-executor-shared=false \
-Ddefault-dnssec=no \
-Dsystem-uid-max=998 \
-Dsystem-gid-max=998 \
@ -304,17 +269,6 @@ install -D -m644 %{S:13} \
#ln -s /lib/systemd/systemd-udevd %{buildroot}/sbin/udevd
ln -s libudev.so.1 %{buildroot}/%{_libdir}/libudev.so.0
## fix libudev.so link since 232
##mv %{buildroot}/%{_lib}/libudev.la %{buildroot}%{_libdir}/
##rm -f %{buildroot}/%{_lib}/libudev.so
##ln -sf /%{_lib}/libudev.la %{buildroot}%{_libdir}/libudev.la
#ln -sf /%{_lib}/libudev.so.1 %{buildroot}%{_libdir}/libudev.so
## same for libsystemd.so
##mv %{buildroot}/%{_lib}/libsystemd.la %{buildroot}%{_libdir}/
##rm -f %{buildroot}/%{_lib}/libsystemd.so
##ln -sf /%{_lib}/libsystemd.la %{buildroot}%{_libdir}/libsystemd.la
#ln -sf /%{_lib}/libsystemd.so.0 %{buildroot}%{_libdir}/libsystemd.so
# /etc/mtab symlink
ln -s /proc/mounts %{buildroot}%{_sysconfdir}/mtab
@ -519,8 +473,6 @@ if [ $1 -ge 1 ]; then
fi
:
%post -n libsystemd -p /sbin/ldconfig
%postun -n libsystemd -p /sbin/ldconfig
%pre -n udev
# backup persistent-net rules file if it has an old syntax
@ -559,8 +511,6 @@ groupadd render -g %{group_render} 2>/dev/null
[ -e /lib/udev ] || ln -s ../usr/lib/udev /lib/udev
:
%post -n libudev -p /sbin/ldconfig
%postun -n libudev -p /sbin/ldconfig
%posttrans -n udev
[ ! -L /lib -a ! -L /lib/udev ] && {
@ -642,6 +592,8 @@ systemctl daemon-reload &>/dev/null || :
%config(noreplace) %{_sysconfdir}/systemd/homed.conf
%config(noreplace) %{_sysconfdir}/systemd/oomd.conf
%{_sysconfdir}/mtab
%{_sysconfdir}/ssh/ssh_config.d/20-systemd-ssh-proxy.conf
%{_sysconfdir}/ssh/sshd_config.d/20-systemd-userdb.conf
%dir %{_sysconfdir}/binfmt.d
%dir %{_sysconfdir}/modules-load.d
%dir %{_sysconfdir}/repart.d
@ -654,13 +606,16 @@ systemctl daemon-reload &>/dev/null || :
%{_bindir}/bootctl
%{_bindir}/halt
%{_bindir}/init
%{_bindir}/importctl
%{_bindir}/mount.ddi
%{_bindir}/poweroff
%{_bindir}/reboot
%{_bindir}/run0
%{_bindir}/runlevel
%{_bindir}/shutdown
%{_bindir}/telinit
%{_prefix}/lib/pam.d/systemd-user
%{_prefix}/lib/pam.d/systemd-run0
%{_bindir}/busctl
%{_bindir}/coredumpctl
%{_bindir}/hostnamectl
@ -725,17 +680,20 @@ systemctl daemon-reload &>/dev/null || :
%{_datadir}/factory/etc/pam.d/other
%{_datadir}/factory/etc/pam.d/system-auth
%{_datadir}/factory/etc/vconsole.conf
%{_datadir}/pkgconfig/systemd.pc
%dir %{_datadir}/systemd
%{_datadir}/systemd/kbd-model-map
%{_datadir}/systemd/language-fallback-map
%dir %{_datadir}/systemd/gatewayd
%{_datadir}/systemd/gatewayd/browse.html
%{_datadir}/mime/packages/io.systemd.xml
%{_datadir}/polkit-1/actions/org.freedesktop.*.policy
%{_datadir}/polkit-1/rules.d/systemd-networkd.rules
%{_datadir}/polkit-1/actions/io.systemd.credentials.policy
%{_datadir}/polkit-1/actions/io.systemd.mount-file-system.policy
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/*
%{_datadir}/polkit-1/actions/org.freedesktop.*.policy
%{_datadir}/polkit-1/rules.d/systemd-networkd.rules
%{_datadir}/pkgconfig/systemd.pc
%dir %{_localstatedir}/log/journal
%dir %{_localstatedir}/log/journal/remote
%dir %{_localstatedir}/lib/systemd
@ -745,6 +703,7 @@ systemctl daemon-reload &>/dev/null || :
%{_mandir}/man1/homectl.1*
%{_mandir}/man1/hostnamectl.1*
%{_mandir}/man1/init.1*
%{_mandir}/man1/importctl.1*
%{_mandir}/man1/journalctl.1*
%{_mandir}/man1/localectl.1*
%{_mandir}/man1/loginctl.1*
@ -755,6 +714,7 @@ systemctl daemon-reload &>/dev/null || :
%{_mandir}/man1/portablectl.1*
%{_mandir}/man1/resolvconf.1*
%{_mandir}/man1/resolvectl.1*
%{_mandir}/man1/run0.1*
%{_mandir}/man1/systemctl.1*
%{_mandir}/man1/systemd-*
%{_mandir}/man1/systemd.1*
@ -853,6 +813,19 @@ systemctl daemon-reload &>/dev/null || :
%{_libdir}/pkgconfig/libudev.pc
%changelog
* Sat Nov 30 2024 Automatic Build System <autodist@openmamba.org> 256.9-1mamba
- automatic version update by autodist
* Sat Nov 16 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 256.8-2mamba
- rebuilt with libk-executor-shared=false (see https://github.com/systemd/systemd/commit/d59cae6cebd0fc25a16a020bd28e5303901f1b19)
- removed requirement for initscripts
* Fri Nov 15 2024 Automatic Build System <autodist@openmamba.org> 256.8-1mamba
- automatic version update by autodist
* Wed Oct 30 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 256.7-1mamba
- update to 256.7
* Fri Jun 28 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 255.8-1mamba
- update to 255.8

View File

@ -1,39 +0,0 @@
diff -Nru udev-177.orig/src/udev-ctrl.c udev-177/src/udev-ctrl.c
--- udev-177.orig/src/udev-ctrl.c 2012-01-10 01:43:22.125518772 +0100
+++ udev-177/src/udev-ctrl.c 2012-01-22 16:46:31.339378651 +0100
@@ -15,6 +15,7 @@
#include <stddef.h>
#include <string.h>
#include <unistd.h>
+#include <fcntl.h>
#include <sys/types.h>
#include <sys/poll.h>
#include <sys/socket.h>
@@ -182,6 +183,7 @@
struct ucred ucred;
socklen_t slen;
const int on = 1;
+ int flgs;
conn = calloc(1, sizeof(struct udev_ctrl_connection));
if (conn == NULL)
@@ -189,13 +191,18 @@
conn->refcount = 1;
conn->uctrl = uctrl;
- conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK);
+ conn->sock = accept(uctrl->sock, NULL, NULL);
if (conn->sock < 0) {
if (errno != EINTR)
err(uctrl->udev, "unable to receive ctrl connection: %m\n");
goto err;
}
+ /* Since we don't have accept4 */
+ flgs = fcntl(conn->sock, F_GETFL, NULL);
+ if (flgs >= 0) fcntl(conn->sock, F_SETFL, flgs | O_NONBLOCK);
+ fcntl(conn->sock, F_SETFD, FD_CLOEXEC);
+
/* check peer credential of connection */
slen = sizeof(ucred);
if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) {

View File

@ -1,136 +0,0 @@
#! /bin/sh
#
# Author: Rolf Eike Beer <eike-hotplug@sf-tec.de>
# derived from original RedHat udev init script
# based on the SuSE 9.0 template (c) 1995-2002 SuSE Linux AG
#
# /etc/init.d/udev
# and its symbolic link
# /(usr/)sbin/rcudev
#
# System startup script for udev
#
# LSB compatible service control script; see http://www.linuxbase.org/spec/
#
### BEGIN INIT INFO
# Provides: udev
# Required-Start:
# Required-Stop:
# Default-Start: 1 2 3 5
# Default-Stop: 0 6
# Short-Description: manage user-space device nodes in /udev
# Description: Start udev to create the device files for all
# devices already present in system when script is
# called. All other devices files will be automatically
# created when udev is called via /sbin/hotplug.
# Requires at least a kernel 2.6 to work properly.
### END INIT INFO
#
# Note on script names:
# http://www.linuxbase.org/spec/refspecs/LSB_1.2.0/gLSB/scrptnames.html
# A registry has been set up to manage the init script namespace.
# http://www.lanana.org/
# Please use the names already registered or register one or use a
# vendor prefix.
# Check for missing binaries (stale symlinks should not happen)
UDEV_PROG=systemd-udevd
UDEV_BIN=/lib/systemd/$UDEV_PROG
UDEV_STATIC_ARCHIVE=/lib/udev/devices/static.tar.gz
test -x $UDEV_BIN || exit 5
# Check for existence of needed config file and read it
UDEV_CONFIG=/etc/udev/udev.conf
test -r $UDEV_CONFIG || exit 6
. $UDEV_CONFIG
# Directory where sysfs is mounted
SYSFS_DIR=/sys
# Source LSB init functions
#. /lib/lsb/init-functions
. /etc/sysconfig/rc
. $rc_functions
case "$1" in
start)
if [ ! -d $SYSFS_DIR ]; then
log_failure_msg "${0}: SYSFS_DIR \"$SYSFS_DIR\" not found"
exit 1
fi
if [ ! -d $udev_root ]; then
mkdir $udev_root || exit 4
fi
echo "" > /proc/sys/kernel/hotplug
echo -n "Starting udev: "
if [ ! "`grep ' /dev ' /proc/mounts`" ]; then
[ "`grep devtmpfs /proc/filesystems`" ] && \
mount -n -t devtmpfs udev /dev || \
mount -n -t tmpfs udev /dev
fi
if [ ! "`grep ' /run ' /proc/mounts`" ]; then
mount -n -t tmpfs tmpfs /run
fi
[ -e /dev/shm ] || {
mkdir /dev/shm /dev/pts
chmod 1777 /dev/shm
}
[ -e $UDEV_STATIC_ARCHIVE ] && {
STATIC_INIT=1
(cd /
tar xzf $UDEV_STATIC_ARCHIVE)
} || [ -x /lib/udev/devices/MAKEDEV ] && /lib/udev/devices/MAKEDEV
$UDEV_BIN --daemon &>/dev/null
evaluate_retval
echo
[ "$STATIC_INIT" ] || {
echo -n "Plugging devices: "
udevadm trigger
udevadm settle
evaluate_retval
echo
}
;;
stop)
echo -n "Stopping udev: "
killall $UDEV_PROG
success
echo
;;
restart|force-reload)
$0 stop && $0 start
exit $?
;;
reload)
exit 3
;;
status)
echo -n "Checking for udev root directory: "
if [ -d $udev_root ]; then
#log_success_msg "found"
echo_success found
echo
else
#log_warning_msg "not found"
warning "not found"
echo
exit 3
fi
;;
savedevices)
echo -n "Creating static devices archive: "
(cd /
tar czf $UDEV_STATIC_ARCHIVE /dev)
evaluate_retval
echo
;;
*)
echo "Usage: $0 {start|stop|status|restart|force-reload|reload|savedevices}"
exit 1
;;
esac