summaryrefslogtreecommitdiff
path: root/src/udev
AgeCommit message (Collapse)Author
2015-06-10util: introduce CMSG_FOREACH() macro and make use of it everywhereLennart Poettering
It's only marginally shorter then the usual for() loop, but certainly more readable.
2015-06-09Revert "hwdb: actually search /run/udev/hwdb.d"Lennart Poettering
2015-06-09hwdb: actually search /run/udev/hwdb.dPeter Hutterer
The documentation claims hwdb entries may be placed in the volatile /run/udev/hwdb.d directory but nothing actually looked at it.
2015-06-08tree-wide: remove spurious spaceThomas Hindoe Paaboel Andersen
2015-06-03udevd: merge manager_new() and manager_listen() againTom Gundersen
Now that listen_fds() have been split out, we can safely move the allocation of the manager object after doing the forking (the fork is done to notify legcay init-systems that the fds are ready). Subsequently, we can merge manager_listen() back into managre_new(). This entails a minor behaviour change: the application of permissions to static device nodes now happens after the fork (but still before notifying systemd about being ready).
2015-06-03udevd: make sd_notify independent of forknig/notify modeTom Gundersen
This will simply silently fail on non-systemd systems, so there is no reason to make it conditional. Also make it clear that we notify systemd about being ready as the last step before starting the event loop, whereas the forking might need to happen earlier.
2015-06-03udevd: manager - split listen_fds() out of manager_new()Tom Gundersen
This will allow us in a follow-up commit to listen to fds before forking and still allocate the manager only after the fork.
2015-06-03udevd: unify fd handling in forking/notify modesTom Gundersen
Hide the differenec in listen_fds, by simply opening the fds here in case they are not passed in.
2015-06-03udevd: make cgroup logic independent of socket passingTom Gundersen
This should have no behavioural change, but it is odd to tie the cgroup cleaning to whether or not we are passed sockets. The point really is if we are guaranteed to be in a dedicated cgroup, so instead check for our parent being PID1 (we already implicitly only do this on systemd systems).
2015-06-03udevd: only bind ctrl and netlink sockets when we open themTom Gundersen
If they are passed from PID1 this is not necessary.
2015-06-03udevd: rename systemd_fds to listen_fdsTom Gundersen
2015-06-03udevd: simplify signal mask handlingTom Gundersen
We used to block all signals, and restore the original signal mask before exec'ing external processes. Now we just block the signals we care about and unconditionally unblock all signals before exec'ing.
2015-06-03udev: input_id - use ABS_MT_SLOT{-1} to exclude non touch screen devicesAndreas Pokorny
Peek at the ABS_MT_SLOT-1 axis. Expect that touch screens only have axes inside the MT range.
2015-06-03udev: input_id - use direct property and mt axis for touch screen detectionAndreas Pokorny
A lot of touch screens use INPUT_PROP_DIRECT to indicate that touch input maps directly to the underlying screen, while the BTN_TOUCH bit might not be set.
2015-06-03udev: input_id - refactor device detectionAndreas Pokorny
This change switches to bools and separates bit flag evaluation from decision making and application of udev properties, while hopefully keeping the same semantics. Apart from using BTN_LEFT instead of BTN_MOUSE for mouse detection.
2015-06-02udev-builtin: path_id - don't pass NULL to udev_device_get_parent()Tom Gundersen
Being explicit about this makes the code easier to follow IMHO.
2015-06-02udev: add some assertsTom Gundersen
Mostly for documentation purposes.
2015-05-31udevd: open sockets before forkingTom Gundersen
The communication channels must all be opened before forknig in daemon mode, or we cannot guarantee that udevadm will work correctly as soon as udevd is started.
2015-05-31udevd: don't allocate sd_event object before forkTom Gundersen
In daemon mode we would break sd-event as it cannot work accross different processes. Simply delay the allocation to after the fork.
2015-05-31udevd: don't sanitize fd 0,1,2Tom Gundersen
Kay said: 'it is from ancient times, when we started udevd from the kernel's usermodhelper which had no fd 0,1,2'.
2015-05-29util: split out signal-util.[ch] from util.[ch]Lennart Poettering
No functional changes.
2015-05-29udevd: notify - expose a bit more of the internal stateTom Gundersen
This notifies PID1 about config being flushed, about shutdown starting and shutdown finalizing.
2015-05-29udevd: notify - keep NOTIFY_SOCKET aroundTom Gundersen
Only unset the env var in the workers, but otherwise keep it around in the main daemon.
2015-05-29udevd: modernize status notificationTom Gundersen
Only log about starting in daemon mode, rely on PID1 to log this in notify mode. Also explicitly set the STATUS variable, as is done in notify mode as is done for other serivecs.
2015-05-29udevd: event - port spawn_wait() to sd-eventTom Gundersen
This allows us to drop the special sigterm handling in spawn_wait() as this will now be passed directly to the worker event loop. We now log failing spawend processes at 'warning' level, and timeouts are in terms of CLOCK_BOOTTIME when available, otherwise the behavior is unchanged.
2015-05-29udevd: move main-loop to sd-eventTom Gundersen
2015-05-29udevd: explicitly try to start event queue when it may be possibleTom Gundersen
Rather than trying to schedule new events on every main-loop iteration, do it explicitly when processing an event finishes, a worker is killed, a new uevent is received, or the event queue is explicitly restarted.
2015-05-29udevd: only check for changed config before scheduling new eventsTom Gundersen
Also move builtin and rules initialization from main loop to event_queue_start(). No functional change.
2015-05-29udevd: introduce manager_exit() and manager_reload()Tom Gundersen
The behavior is mostly unchanged, but rather than only ever calling these functions at fixed points in the event loop, they are called directly whenever they are invoked.
2015-05-27udevd: fix SIGCHLD handling in --daemon modeTom Gundersen
We were listening for SIGCHLD in the wrong process.
2015-05-26udev: fix inotify handlingDavid Herrmann
This partly reverts: commit 6d1b1e0bc6bd020218afc5f05286bf372be283d5 Author: Tom Gundersen <teg@jklm.no> Date: Sun May 24 15:10:04 2015 +0200 udevd: worker - fully clean up unnecessary fds The inotify-fd _is_ used in the workers, so don't close it! Have a look at udev-watch.c, which keeps track of the inotify-fd as a global variable (ugh!).
2015-05-24udevd: event - fix event queue in daemenozied modeTom Gundersen
We would enforce that events could only be added to the queue from the main process, but that brake in daemonized mode. Relax the restriction to only allow one process to add events to the queue. Reported by Mantas Mikulėnas.
2015-05-24udevd: worker - modernize a bitTom Gundersen
Initialize structs when declaring rather than using memzero().
2015-05-24udevd: worker - fully clean up unnecessary fdsTom Gundersen
These are only ever used in the parent process, so close them early in the worker.
2015-05-22udev/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.
2015-05-21nspawn: finish user namespace supportLennart Poettering
2015-05-21udev: link-config - fix corruptionTom Gundersen
The parser used for MTU and Speed expects them to be size_t, not unsigned int. This caused a corruption in the rest of the structure. Reported by David O Neill <david.m.oneill@intel.com>.
2015-05-18udevd: 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.
2015-05-18udevd: main - reshuffleTom Gundersen
First parse config, then sanitize environment before donig any further setup. No functional change.
2015-05-18udevd: rename on_reque_{exit,reload} to on_sig{term,chld}Tom Gundersen
No functional change.
2015-05-18udevd: introduce on_event_timeout{,_warning}Tom Gundersen
This uses kill_and_sigcont() instead of kill(), otherwise no functional change.
2015-05-18udevd: process all SIGCHLD events every time the handler is invokedTom Gundersen
We were returning rather than continuing in some cases. The intention was always to fully process all pending events before returning from the SIGCHLD handler. Restore this behaviour.
2015-05-18udevd: init/exit the builtins in manager_new/freeTom Gundersen
No functional change.
2015-05-18udevd: move file descriptors to ManagerTom Gundersen
No functional change.
2015-05-18ata_id: drop spurious spaceLennart Poettering
2015-05-16udevd: queue - update queue state when events are queued/freedTom Gundersen
This way it is more obvious that the queue flag file is always up-to-date. Moreover, we only have to touch/unlink it when the first/last event is allocated/freed.
2015-05-16udevd: 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.
2015-05-16udevd: 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.
2015-05-16udevd: net - fix leak in .link configTom Gundersen
Path, Driver and Type are now strv rather than strings, so free them properly.
2015-05-15udev-ctrl: make _unref() always return NULLTom Gundersen
Bring this in line with the rest of the codebase.