1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 23:51:28 +03:00
Commit Graph

72 Commits

Author SHA1 Message Date
Kay Sievers
cf3b3fbcd5 udevd: use facility == LOG_DAEMON when writing to /dev/kmsg
Syslog wants to distinguish the sorce of messages. We should
indicate that this is a userspace message (LOG_DAEMON) and not
a kernel message (LOG_KERNEL).
2011-03-23 01:41:25 +01:00
Kay Sievers
5f59fa0900 move /dev/.udev/ to /dev/.run/udev/ and convert old udev database at udevd startup 2011-03-15 17:26:08 +01:00
Kay Sievers
9c6a11b1c6 libudev: record and export "age" of device record 2010-12-15 08:58:46 +01:00
Kay Sievers
48a0170b11 libudev: enumerate - allow to filter-out not-already-initialized devices 2010-12-14 14:18:32 +01:00
Kay Sievers
ff0e1f4e5d check ifindex > 0 instead of subsystem == "net" 2010-12-14 11:27:02 +01:00
Kay Sievers
4281da1fa6 udevd: use dev_t or netif ifindex as database key
We need to preserve the database of network interfaces while we
rename them. Use the kernel's numbers wherever possible, instead
of the device names.

Fix wrong database filenames which contain a '/', translated
from '!' in the kernel name.

Fix segfault for kobject pathes where the subsystem can not be
determined from sysfs.
2010-12-10 01:18:15 +01:00
Kay Sievers
1c2311c556 return proper error code in rename_netif()
<Md>  kay: can you look at rename_netif()? it returns -errno in a place,
      but I think that it may by changed by err() (at least)
<kay> Md: yeah, that doesn't look correct
2010-10-18 12:55:06 +02:00
Kay Sievers
c25bfbfb1b udevd: add pid to kmsg logs 2010-08-19 08:49:43 +02:00
Kay Sievers
ebd189621f do not rename the database on device rename
Harald Hoyer discovered some incorrect behavior while debugging
problems with network interface renaming:

Udev events might be queued for devices which are renamed. A new
device registered the same time may claime the old name and create
a database entry for it. The current rename logic would move over
this databse entry to the wrong device.
2010-08-11 14:34:32 +02:00
Kay Sievers
ce9a42bec4 always log error when renaming a network interface fails 2010-08-11 14:29:49 +02:00
Harald Hoyer
09c0310302 udev-event.c: rename interface to <src>-<dest>, if <dest> taken
e.g. if eth0 should be eth3 and eth3 is waiting to be renamed,
eth0 was renamed to eth0_rename. The kernel would take eth0 as the name
for a new interface and this new eth0 could also become eth0_rename, if
the target name is also taken. To prevent this name clash, the
interfaces are now renamed to <src>-<dest> and the rename is logged.
2010-08-10 16:46:48 +02:00
Kay Sievers
c830e98d6a udevd: read debug settings from kernel commandline 2010-05-28 12:07:27 +02:00
Kay Sievers
88cbfb09ee while (1) -> for (;;) 2010-05-27 15:11:00 +02:00
Kay Sievers
f2291cd07f fix tests and allow MODE=000 2010-05-20 14:51:18 +02:00
Kay Sievers
c1332ae898 use default mode of 0600 for nodes if gid == 0 2010-05-20 06:24:45 +02:00
Kay Sievers
e85f5ec15f reset process priority before executing RUN+=
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=581235
2010-05-12 08:46:56 +02:00
Kay Sievers
75cb1ac51e warn when renaming kernel-provided nodes instead of adding symlinks 2010-05-05 11:39:25 +02:00
Kay Sievers
c7cdd8b2d2 remove unused parameter from udev_node_mknod() 2010-05-03 18:08:51 +02:00
Kay Sievers
c1dbe11dc3 delete old tags when configuration changes 2010-04-23 09:01:56 +02:00
Kay Sievers
28460195c2 add TAG= to improve event filtering and device enumeration 2010-04-22 18:12:36 +02:00
Kay Sievers
6252f9e732 delete only device nodes, not symlinks when deleting a devtmpfs node
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550152
2010-04-19 18:57:28 +02:00
Kay Sievers
3ba7e651ad log info only if we actually delete the node 2010-04-12 17:13:37 +02:00
Kay Sievers
0ec5b5e142 unify/cleanup event handling 2010-04-12 15:51:16 +02:00
Kay Sievers
fbb31cd6e1 libbudev-private: rename udev_list_entry_get_flag() 2010-03-10 14:52:42 +01:00
Kay Sievers
cdae488a3f remove "ignore_device"
There is no way to ignore an event these days. Libudev events can
not be suppressed. It only prevents RUN keys from being executed,
which results in an inconsistent behavior in current setups.
2009-11-16 15:22:17 +01:00
Harald Hoyer
6068553195 rename interfaces to <iface>_rename if rename fails 2009-09-18 13:14:30 +02:00
Kay Sievers
6c29f2b942 simplify "symlink name stack"
With well defined and kernel-supplied node names, we no longer need
to support a possible stack of conflicting symlinks and node names.
Only symlinks with identical names can be claimed by multiple devices.

This shrinks the former /dev/.udev/names/ significantly.

Also the /dev/{block,char}/MAJ:MIN" links are excluded from the name
stack - they are unique and can not conflict.
2009-09-09 18:49:07 +02:00
Jeremy Kerr
d412a68573 util_run_program: restore signal mask before executing event RUN commands
External programs triggered by events (via RUN=) will inherit udev's
signal mask, which is set to block all but SIGALRM. For most utilities,
this is OK, but if we start daemons from RUN=, we run into trouble
(especially as SIGCHLD is blocked).

This change saves the original sigmask when udev starts, and restores it
just before we exec() the external command.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
2009-09-07 12:13:50 +02:00
Daniel Mierswa
959e8b5dec use nanosleep() instead of usleep()
POSIX.1-2001 declares usleep() function obsolete and POSIX.1-2008
removes it.

[Kay Sievers]
  - include time.h
  - use const for timespec
  - scsi_id: drop rand() in retry loop
  - modem-probe: rename msuspend() to msleep()
2009-08-30 23:58:57 +02:00
Kay Sievers
2ffc9cc191 change database file names
With very deeply nested devices, We can not use a single file
name to carry an entire DEVPATH. Use <subsystem>:<sysname> as
the database filename, which should also simplify the handling
of devices moving around, as these values will not change but
still be unique.

For the name stack we use the <maj>:<min> now as the filename.

> On Tue, Aug 18, 2009 at 09:59:56AM -0400, Ric Wheeler wrote:
> The first is that udev grumbles during boot about "file name too long"
> like the following:
>
> Aug 17 06:49:58 megadeth udevd-event[20447]: unable to create db file
> '/dev/.udev/db/\x2fdevices\x2fpci0000:00\x2f0000:00:04.0\x2f0000:17:00.0\x2f0000:18:0a.0\x2f0000:1f:00.0\x2fhost11\x2fport-11:0\x2fexpander-11:0\x2fport-11:0:0\x2fexpander-11:1\x2fport-11:1:0\x2fexpander-11:2\x2fport-11:2:17\x2fexpander-11:3\x2fport-11:3:1\x2fend_device-11:3:1\x2fbsg\x2fend_device-11:3:1':
> File name too long
2009-08-19 20:49:49 +02:00
Alan Jenkins
214a6c791c fix spelling
Fix spelling in docbook comments, code comments, and a local variable
name.  Thanks to "ispell -h" for docbook HTML and "scspell" for source
code.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-08-08 15:42:05 +02:00
Kay Sievers
f7c5b04f69 re-enable failed event tracking
It did not work for the last couple of releases.

If RUN{record_failed}+="..." is given, a non-zero execution will mark
the event as failed. Recorded failed events can be re-triggered with:
  udevadm trigger --type=failed

The failed tracking _might_ be useful for things which might not be
ready to be executed at early bootup, but a bit later when the needed
dependencies are available. In many cases though, it indicates that
something is used in a way it should not.
2009-08-06 16:16:26 +02:00
Kay Sievers
fc206fbe3e update a few years of copyright 2009-08-01 09:39:18 -04:00
Kay Sievers
d5b5a611ae format names are not case insensitive 2009-07-23 20:30:52 +02:00
Kay Sievers
4950b6e6a8 cleanup $attr{} substitution 2009-06-06 04:54:41 +02:00
Kay Sievers
1e03b754ae udevd: convert to event worker processes
Event processes now get re-used after they handled an event. This reduces
pressure on the CPU significantly because cloned event processes no longer
cause page faults in the main daemon. After the events have settled, the
no longer needed worker processes get killed.
2009-06-04 01:44:04 +02:00
Kay Sievers
065db05221 use more efficient string copying 2009-05-20 17:57:52 +02:00
Kay Sievers
a0ee5a05bb remove format char string truncation syntax 2009-05-19 12:56:17 +02:00
Kay Sievers
cb14f4543a handle devtmpfs nodes
UDev follows the kernel given name, and re-uses the kernel created
device node. If the kernel and spcecified udev rules disagree, the
udev specified node node is created and the kernel-created on is
deleted.
2009-05-04 04:52:31 +02:00
Kay Sievers
8e4bd22558 accept DEVNAME from the kernel as a hint for the node name 2009-04-28 15:59:45 +02:00
Kay Sievers
3d3a0a709a use the event udev_device to disable the watch on "remove" 2009-02-24 15:11:17 +01:00
Scott James Remnant
5ae82640c5 Don't add inotify watch until RUN rules processed.
The programs we RUN can open device nodes, and thus we can end up
chasing our own tail.
2009-02-23 17:17:20 +00:00
Scott James Remnant
bd284db142 udevd: optionally watch device nodes with inotify
This allows you to re-process the rules if the content of the device
has been changed, most useful for block subsystem to cause vol_id to
be run again.
2009-02-11 17:38:56 +00:00
Kay Sievers
c807ad918c increase netif renaming timeout from 30 to 90 seconds 2009-01-21 11:17:58 +01:00
Kay Sievers
fc7d16f993 cleanup old names before creating the new names
Scott found that the node /dev/pktcdvd can not be replaced by
/dev/pktcdvd/control by changing the rules, and re-trigger the
event. We used to create the new names before we cleaned up the
old ones, which can not work if we need to create subdir with
the same name.
2009-01-16 21:15:53 +01:00
Kay Sievers
ec2dd02e2a udevadm: test - remove --force option
Since a while we change the database with a "test" run, but do not update
the node and symlinks. We need to "force" all the time, to keep things
in sync.
2009-01-15 20:20:16 +01:00
Kay Sievers
3d7b2831cd libudev: device - add udev_device_get_property_value() 2009-01-06 00:26:28 +01:00
Kay Sievers
1028fe14b6 if needed, store database entries also for devices which do not have a device node 2008-12-28 01:49:01 +01:00
Kay Sievers
e2c9d3c36f fix network interface name swapping 2008-12-02 01:04:23 +01:00
Kay Sievers
5375c80eba fix $links substitution for devices without any link
Reported-by: Michel Hermier <michel.hermier@gmail.com>
2008-11-17 15:24:47 +01:00