summaryrefslogtreecommitdiff
path: root/src/udev/udev-event.c
AgeCommit message (Collapse)Author
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
2013-10-30udev: link-config - less verbose loggingTom Gundersen
Also reinstate print to kmsg when renaming netif.
2013-10-30udev: link-config - let udevd set the ifnameTom Gundersen
2013-10-29udev-event: use rtnl to set ifnameTom Gundersen
2013-10-08udev: support custom Linux Security Module labels for device nodesKay Sievers
2013-03-21udev: always set selinux label at "add" eventsKay Sievers
https://bugs.freedesktop.org/show_bug.cgi?id=62615
2013-02-13use streq instead of strcmpThomas Hindoe Paaboel Andersen
2013-01-27udev: set default rules permissions only at "add" eventsKay Sievers
2013-01-09udev: move string copy functions to shared/Kay Sievers
2012-12-31udev: in addition to DEVMODE, honor DEVUID, DEVGID from the ueventKay Sievers
2012-11-20udev: fix whitespaceKay Sievers
2012-11-13udev: properly handle symlink removal by 'change' eventKay Sievers
If a 'change' event is supposed to remove created symlinks, we create a new device structure from the sysfs device and fill it with the list of links, to compute the delta of the old and new list of links to apply. If the device is already 'remove'd by the kernel though, udev fails to create the device structure, so the links are not removed properly. > From: Neil Brown <nfbrown@suse.com> > Date: Thu, 8 Nov 2012 10:39:06 +0100 > Subject: [PATCH] If a 'change' event does not get handled by udev until > after the device has subsequently disappeared, udev mis-handles > it. This can happen with 'md' devices which emit a change > event and then a remove event when they are stopped. It is > normally only noticed if udev is very busy (lots of arrays > being stopped at once) or the machine is otherwise loaded > and reponding slowly. > > There are two problems. > > 1/ udev_device_new_from_syspath() will refuse to create the device > structure if the device does not exist in /sys, and particularly if > the uevent file does not exist. > If a 'db' file does exist, that is sufficient evidence that the device > is genuine and should be created. Equally if we have just received an > event from the kernel about the device, it must be real. > > This patch just disabled the test for the 'uevent' file, it doesn't > try imposing any other tests - it isn't clear that they are really > needed. > > 2/ udev_event_execute_rules() calls udev_device_read_db() on a 'device' > structure that is largely uninitialised and in particular does not > have the 'subsystem' set. udev_device_read_db() needs the subsystem > so it tries to read the 'subsystem' symlink out of sysfs. If the > device is already deleted, this naturally fails. > udev_event_execute_rules() knows the subsystem (as it was in the > event message) so this patch simply sets the subsystem for the device > structure to be loaded to match the subsystem of the device structure > that is handling the event. > > With these two changes, deleted handling of change events will still > correctly remove any symlinks that are not needed any more. Use udev_device_new() instead of allowing udev_device_new_from_syspath() to proceed without a sysfs device.
2012-11-12use the same email address everywhereKay Sievers
2012-11-12udev: use usec_t and now()Kay Sievers