summaryrefslogtreecommitdiff
path: root/src/shared
AgeCommit message (Collapse)Author
2015-06-18Rename mkdir_p -> udev_mkdir_p to avoid symbol collisions.Anthony G. Basile
While usptream doesn't support a static libudev.a, we will try to do so. However, mkdir_p() is used in lvm2 and util-linux, so to avoid the collision, we rename it to udev_mkdir_p(). See: https://bugs.gentoo.org/show_bug.cgi?id=520450 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-29random-util.c: remove <sys/auxv.h> missing in uClibcAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-29src/shared/missing.h: O_PATH and AT_EMPTY_PATH missing in uClibc's <fcntl.h>Anthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-27src/shared/util.h: update qsort_safe() for muslAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-27src/shared/path-util.c: import prefix_root() from upstreamAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-27nspawn: finish user namespace supportLennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-27src/shared/util.h: import loop_write() from upstreamAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: make udev_ctrl_connection globalTom Gundersen
This allows us to simplify the ctrl_msg handler. Eventually all this global state should move to a Manager object or so. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26src/shared/util.[ch]: import functions from upstream for previous commitsAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-04core: rework cgroup path parse logicLennart Poettering
Various cleanups, be stricter when parsing unit paths. Most importantly: return the root slice "-.slice" when asked for slice of paths that contain no slice component. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-04path-util: fix fstat fallback in fd_is_mount_pointThomas Hindoe Paaboel Andersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-04sysctl: minor simplificationsLennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-04path-util: make use of "mnt_id" field exported in /proc/self/fdinfo/<fd> to ↵Lennart Poettering
test for mount points Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-04util: Fix assertion in split() on missing 'Martin Pitt
When parsing a unit with a trailing slash after an escaped line break, like ExecStart=/bin/echo 'foo \ bar' the split() function (through config_parse()) asserted and crashed pid 1: Assertion 'current[*l + 1] == quotechars[0]' failed at ../src/shared/util.c:583, function split(). Aborting. Fix this by returning an error in this case ("trailing garbage"). Add corresponding test case. Also fix the missing "unit" argument of config_parse_exec() in the comment. https://launchpad.net/bugs/1447243
2015-05-03shared/hashmap: normalize whitespaceZbigniew Jędrzejewski-Szmek
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03src/shared/util.h: import xsprintf() from upstream.Anthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-15Ronny Chevalier <chevalier.ronny@gmail.com>shared: add terminal-util.[ch]Ronny Chevalier
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-14shared: add random-util.[ch]Ronny Chevalier
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-14shared: add process-util.[ch]Ronny Chevalier
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-14util: when unescaping C escape sequences support C++11 \u andLennart Poettering
\U unicode literals We simply recode them in utf8. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12path-util: fix more path_is_mount e792e890f falloutLennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12path-util: don't eat up ENOENT in path_is_mount_point()Lennart Poettering
There's no reason to eat up ENOENT, it should be OK to simply report the error back. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12path-util: make sure fd_is_mount_point() returns true for root directoryLennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12src/shared/Makefile.am: fix make dist-checkAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12path-util: if parent can do name_to_handle() but relevant dir not, it's a ↵Lennart Poettering
mount point Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12path-util.c: changes for rm-rf: never cross mount pointsLennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12hashmap: return NULL from destructorDavid Herrmann
We _always_ return NULL from destructors to allow direct assignments to the variable holding the object. Especially on hashmaps, which treat NULL as empty hashmap, this is pretty neat. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12shared: add formats-util.hRonny Chevalier
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12device-nodes: minor simplificationsLennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12util.c: follow upstream's comments.Anthony G. Basile
2015-04-12shared: set - make argument to set_remove() constTom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12shared/mkdir: do not set errno in addition to return valueZbigniew Jędrzejewski-Szmek
All callers look at the return value anyway.
2015-04-12strv: return NULL from strv_free()David Herrmann
We always return NULL/invalid-object from destructors, fix strv_free() to do the same. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: input_id: tag accelerometers as ID_INPUT_ACCELEROMETERHans de Goede
input_id already (tries to) tag accelerometers as such, but this only works for absolute accelerometers. Recent kernels mark accelerometers through an input prop. Trust that prop and always tag devices with it with ID_INPUT_ACCELEROMETER. Note that detection by the prop bit works the same as the existing detection and will ensure that no other tags get set on the device. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-04-12udev: input_id: tag pointing sticks as ID_INPUT_POINTINGSTICKAnthony G. Basile
Also referred to as trackpoint, trackstick. These are marked by recent kernels through an input prop. Forward that prop as udev property so userspace can easily determine whether there is a pointing stick present. These devices were previously marked as ID_INPUT_MOUSE, for backwards compatibility we keep that in place, the new property is an addition.y Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-27Remove hardcoded path /run and configure using --with-rootrundir=David Cortarello
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-19shared: add path_compare(), an ordering path comparisonMichal Schmidt
... and make path_equal() a simple wrapper around it. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-19sysctl: move property handling to shared/Kay Sievers
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18selinux: fix SEGV during switch-root if SELinux policy loadedWill Woods
If you've got SELinux policy loaded, label_hnd is your labeling handle. When systemd is shutting down, we free that handle via mac_selinux_finish(). But: switch_root() calls mkdir_p_label(), which tries to look up a label using that freed handle, and so we get a bunch of garbage and eventually SEGV in libselinux. (This doesn't happen in the switch-root from initramfs to real root because there's no SELinux policy loaded in initramfs, so label_hnd is NULL and we never attempt any lookups.) So: make sure that mac_selinux_finish() actually sets label_hnd to NULL, so nobody tries to use it after it becomes invalid. https://bugzilla.redhat.com/show_bug.cgi?id=1185604 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18Check that EWOULDBLOCK is the same as EAGAINZbigniew Jędrzejewski-Szmek
It certainly is everywhere on Linux, but as a courtesy to people doing some strange cross-compilation, check that the assumption holds. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18Replace ENOTSUP with EOPNOTSUPPAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18path-util: fix path_is_mount_point() for symlinksHarald Hoyer
path_is_mount_point() compares the mount_id of a directory and the mount_id of the parent directory. When following symlinks, the function to get the parent directory does not take the symlink into account. /bin -> /usr/bin with /usr being a mountpoint: mount_id of /bin with AT_SYMLINK_FOLLOW != mount_id of / Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18libudev: udev_device_add_property - implicitly mark properties for saving to dbTom Gundersen
Note: We also ported touch() and touch_file() from upstream. -AGB. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-18shared: import close_many() from upstreamAnthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-03-01shared: introduce cmsg_close_all() callLennart Poettering
The call iterates through cmsg list and closes all fds passed via SCM_RIGHTS. This patch also ensures the call is used wherever appropriate, where we might get spurious fds sent and we should better close them, then leave them lying around. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-02-11Minor cleanupsAnthony G. Basile
2015-02-11udev: event - move renaming of udev_device to libudevTom Gundersen
This is not exposed in the public API. We want to simplify the internal libudev-device API as much as possible so that it will be simpler to rip the whole thing out in the future. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-02-08util: rework strappenda(), and rename it strjoina()Lennart Poettering
After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-01-25build-sys: fix build on compilers without static_assertZbigniew Jędrzejewski-Szmek
Build would fail when assert was used on the same line in different files #included together. https://bugs.freedesktop.org/show_bug.cgi?id=87339 Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-01-25src/shared/util.h: only define the _to_string() enum mapping functionLennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>