summaryrefslogtreecommitdiff
path: root/src
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-06-18udevd: fix REMOVE handlingChris Clayton
The original upstream commit is at http://cgit.freedesktop.org/systemd/systemd/commit/?id=107f2e2526d476c6cc9b81a690391c111027d641 This was reworked by Chris Clayton for eudev. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-06-18Revert "udev: don't close std{in,out,err}"Anthony G. Basile
This reverts commit b2399d9b7222abe7db8ab4bc16e0efe3ccae4c42. This solves issue #108. While upstream also reverted this commit, they did so using functions in terminal-util.c. We could import that file and those functions but for such a small commit, its not worth it. We may do so at some future time if there are further gains. See: https://github.com/systemd/systemd/commit/40e749b59ba49fb97c1f45859debe2a82bc9c9ef Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-30configure.ac: bump udev to 220 and eudev to 3.1Anthony G. Basile
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-27udev/net_id: Only read the first 64 bytes of PCI config spaceJason S. McMullan
The original code used fread(), which on some libc implementions (ie glibc 2.17) would pre-read a full 4K (PAGE_SIZE) of the PCI config space, when only 64 bytes were requested. I have recently come across PCIe hardware which responds with Completion Timeouts when accesses above 256 bytes are attempted. This can cause server systems with GHES/AEPI support to cause and immediate kernel panic due to the failed PCI transaction. This change replaces the buffered fread() with an explict unbuffered read() of 64 bytes, which corrects this issue by only reading the guaranteed first 64 bytes of PCIe config space. 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-27udevd: main - use _exit() when daemonizingTom Gundersen
Makes it a bit clearer what is going on, rather than jumping to the end of main(). No functional change. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-27ata_id: drop spurious spaceLennart Poettering
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-27udevd: on_worker - distinguish between EINTR and EAGAINTom Gundersen
EAGAIN means there are no more messages to read, so give up. EINTR means we got interrupted reading a message, so try again. 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-27udevd: worker - use loop_write() rather than send()Tom Gundersen
When notifying the main daemon about event completion, make sure the message is sent successfully, and not interrupted. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-27udev-ctrl: make _unref() always return NULLTom Gundersen
Bring this in line with the rest of the codebase. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: remove stale commentTom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: explicitly update queue file before answering to pingTom Gundersen
This avoids updating the flag files twice for every loop, and also removes another dependency in the main-loop, so we are freer to reshufle it as we want. 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-26treewide: Correct typos and spell plural of bus consistentTorstein Husebø
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: remove unused functionThomas Hindoe Paaboel Andersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: don't explicitly count the number of workersTom Gundersen
Simply query the size of the hashmap keeping all the worker contexts instead. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: keep workers in a hashmap rather than a listTom Gundersen
This makes the code somewhat more readable. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: worker - drop reference countingTom Gundersen
Make the worker context have the same life-span as the worker process. It is created on fork() and free'd on SIGCHLD. The change means that we can get worker_returned() for a worker context that is no longer around, this is not a problem and we can just drop the message. The only use for worker_returned() is to know to reschedule events to workers that are still around, so if the worker has already exited it is not important to keep track of. We still print a debug statement in this case to be on the safe side. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udev: fix weird coding-styleDavid Herrmann
Eeeew! Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: worker - allow passing NULL to worker_unref()Tom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: worker - use _exit() rather than exit()Tom Gundersen
Follow the coding style and avoid the exit handlers. 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-26udevd: modernize error handlingTom Gundersen
We never return magic exit codes, but just EXIT_FAILUER or EXIT_SUCCESS. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: use kernel cmdline parserTom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: worker - move some fields from the worker to the eventTom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: worker - introduce worker_attach_event()Tom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: worker - make refcounting clearerTom Gundersen
Take and drop explicit references where it makes sense. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: worker - only allocate the worker struct in the main processTom Gundersen
This is not used in the worker, so avoid having to free it there. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: rename worker_new() to worker_spawn()Tom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-26udevd: don't track worker exitcodeTom Gundersen
We used to use this to track failed events so they could be retriggered, but that is no longer done, so the code can be dropped. 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-03udevd: worker - log if worker result cannot be sentTom Gundersen
If the main daemon is not notified about a worker finishing an event the refcounting of the worker struct will be wrong, and we will lose track of the number of children we have to wait for. This should not happen, but if it does we better complain loudly about it. Worst case udev will wait for 30 seconsd at shutdown waiting for nonexistent workers. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udevd: worker - warn if unknown worker returnsTom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03src/udev/udevd.c: remove initializer for struct for gcc-4.5.Anthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udevd: worker - let the kernel attach the sender pidTom Gundersen
No need to include this explicitly, just use SCM_CREDENTIALS. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udevd: don't unref worker objects on SIGSTOP/SIGCONTTom Gundersen
We should not be receiving these anyway, but let's be correct. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udevd: warn if we receive SIGCHLD from untracked workerTom Gundersen
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
2015-05-03udevd: improve logging in SIGCHLD handlingTom Gundersen
Remove some redundant logging, and reduce the log-level in most cases. The only case that is really critical is if a worker failed while hanlding an event, so keep that at error level.
2015-05-03src/shared/util.h: import xsprintf() from upstream.Anthony G. Basile
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>