summaryrefslogtreecommitdiff
path: root/src/udev/udev-event.c
AgeCommit message (Collapse)Author
2015-06-29udev: event - simplify udev_event_spawn() logicTom Gundersen
Push the extraction of the envp + argv as close as possible to their use, to avoid code duplication. As a sideeffect fix logging when delaing execution.
2015-06-23udev: event - check return code of dup2()Tom Gundersen
This fixes CID#1304688.
2015-06-14Merge pull request #144 from teg/udev-spawn-log-less-2Kay Sievers
udevd: event - don't log about failures of spawn processes when this …
2015-06-13sd-netlink: rename from sd-rtnlTom Gundersen
2015-06-10udevd: event - don't log about failures of spawn processes when this is expectedTom Gundersen
PROGRAM and IMPORT{program} uses the exit code of the spawn process to decide if a rule matches or not, a failing process is hence normal operation and not something we should warn about. We still warn about other types of failing processes.
2015-06-08tree-wide: remove spurious spaceThomas Hindoe Paaboel Andersen
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-02udev: add some assertsTom Gundersen
Mostly for documentation purposes.
2015-05-29util: split out signal-util.[ch] from util.[ch]Lennart Poettering
No functional changes.
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-04-23udevd: fix REMOVE handlingTom Gundersen
This reverts b67f944. Lazy loading of device properties does not work for devices that are received over netlink, as these are sealed. Reinstate the unconditional loading of the device db. Reported by: Mantas Mikulėnas <grawity@gmail.com>.
2015-04-23udev: event - update tags before writing out dbTom Gundersen
The old tags are read from the db when deciding which tags to clear, make sure we don't write out the new db before the old one has been read.
2015-04-10shared: add formats-util.hRonny Chevalier
2015-03-13udev: make set_usec_initialized() internal to libudevTom Gundersen
Instead introduce ensure_usec_initialized(), which copies the timestamp if possible otherwise sets it to now(CLOCK_MONOTONIC).
2015-03-12libudev: introduce clone_with_db()Tom Gundersen
This allows us to move the db reading from udevd to libudev.
2015-03-12udevd: event - make db loading lazy in REMOVE event handlingTom Gundersen
We were explicitly eagerly loading the db, then deletenig the backing file and then processing the rules/symlinks. Instead we delete the backnig db file as the last step and let the db loading be lazy as everywhere else. This may save us a bit of work in casese where the db is not needed, but more importantly it hides some implementation details of libudev-device form udevd.
2015-03-12libudev: introduce udev_device_properties_copy()Tom Gundersen
To copy properties from one device to another. Drop the equivalent functionality from udevd.
2015-03-09libudev: add missing hunksTom Gundersen
This should have been committed with udev_device_add_property - implicitly mark properties for saving to db
2015-03-09libudev: udev_device_read_db - drop unused argumentTom Gundersen
2015-03-09udev/libudev: event - move {OLD_,}INTERFACE handling from udevd to libudevTom Gundersen
This should be internal to the library as it is only about reflecting the sysfs state in the udev_device.
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
2015-02-12include <poll.h> instead of <sys/poll.h>Thomas Hindoe Paaboel Andersen
include-what-you-use automatically does this and it makes finding unnecessary harder to spot. The only content of poll.h is a include of sys/poll.h so should be harmless.
2015-01-26udev: event - minor nitTom Gundersen
Stay uniform and use 'dev' rather than 'event->dev', as these are aliases (and event->dev looks like it may be a typo for event->dev_db).
2015-01-26udev: event - introduce and use internal udev_device_shallow_clone()Tom Gundersen
2015-01-26udev: 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.
2015-01-22Assorted format fixesZbigniew Jędrzejewski-Szmek
Types used for pids and uids in various interfaces are unpredictable. Too bad.
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: yet more log_*_errno + return simplificationsMichal Schmidt
Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
2014-11-28udev,update-done: more log_xyz_errno() conversionsLennart Poettering
2014-11-28treewide: drop unnecessary trailing \n in log_*() callsMichal Schmidt
2014-11-13udev: support ENV{}=="" global property matchesKay Sievers
2014-11-13udev: switch to systemd logging functionsKay Sievers
2014-09-18udev: fix path for database names on 'change' eventRobert Milasan
If a device does not have a major/minor number attached, we use different database names than if it does. On "change" events, we didn't copy the devnum over, therefore, we used different paths than on 'add' or 'remove' events (where devnum was properly copied). Fix this by always copying the devnum into the udev-device. (David: added commit-log from email)
2014-09-17udev: event - modernize spawn_exec()Tom Gundersen
2014-09-17udev: event - explicitly don't read() from invalid fdTom Gundersen
This fixes CID #1237641.
2014-09-17udev: event - modernize spawn_read()Tom Gundersen
2014-09-11udev: timeout - warn after a third of the timeout before killingTom Gundersen
2014-09-09udev: netif_rename - don't log to kmsgTom Gundersen
As of 3.17, the kernel will do this on its own, so just do regular log_debug() logging from udev.
2014-09-09udev: event - keep one rtnl per worker, rather than per eventTom Gundersen
Creating the rtnl context is cheap, but freeing it may not be, due to synchronous close(). Also drop some excessive logging. We now log about the changing ifname exactly once.
2014-09-09udev: import the full db on MOVE events for devices without dev_tTom Gundersen
2014-07-29udev: place opening { at the same line as the function declarationKay Sievers
2014-07-29udev: unify event timeout handlingKay Sievers
2014-05-15udev: do not skip the execution of RUN when renaming a network device failsKay Sievers
2014-05-13udev: rename netif - properly break lines in kmsgTom Gundersen
Before: 30,997,4553484,-;systemd-udevd[439]: renamed network interface wwan0 to wwp0s20u4i6systemd-udevd[439]: renamed network interface wlan0 to wlp3s0 30,998,1175077801,c;systemd-udevd[2345]: renamed network interface wwan0 to wwp0s20u4i6 After: 30,834,4553484,-;systemd-udevd[439]: renamed network interface wwan0 to wwp0s20u4i6 30,835,4732949,-;systemd-udevd[439]: renamed network interface wlan0 to wlp3s0 30,988,1175077801,-;systemd-udevd[2345]: renamed network interface wwan0 to wwp0s20u4i6
2014-03-11udev: properly detect reference to unexisting part of PROGRAM's resultLukas Nykryn
2014-02-20api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering
first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
2014-02-13everywhere: make use of new0() and macro() macros, and stop using perror()Lennart Poettering
2014-02-13rtnl: drop "sd_" prefix from cleanup macrosLennart Poettering
The "sd_" prefix is supposed to be used on exported symbols only, and not in the middle of names. Let's drop it from the cleanup macros hence, to make things simpler. The bus cleanup macros don't carry the "sd_" either, so this brings the APIs a bit nearer.
2014-01-31use memzero(foo, length); for all memset(foo, 0, length); callsGreg KH
In trying to track down a stupid linker bug, I noticed a bunch of memset() calls that should be using memzero() to make it more "obvious" that the options are correct (i.e. 0 is not the length, but the data to set). So fix up all current calls to memset(foo, 0, length) to memzero(foo, length).
2013-12-24log: log_error() and friends add a newline after each line anyway, so avoid ↵Lennart Poettering
including it in the log strings