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

456 Commits

Author SHA1 Message Date
Kay Sievers
1d67ec16c4 fix typo in log message priority handling 2009-12-25 14:47:59 +01:00
Kay Sievers
299650f1e3 udevadm: info - fix info --root --query=name --path= for device without a device node
Subject: Bug#561279: udev: Crash location and first-level cause
Reply-To: Stephen Kitt <steve@sk2.org>, 561279@bugs.debian.org
2009-12-24 20:42:02 +01:00
Martin Pitt
7729cd2fad Clarify RUN/IMPORT documentation
Explain command/argument separation rules, search path, and quoting for RUN and
IMPORT.

http://bugs.debian.org/550206
2009-12-22 13:08:23 +01:00
Kay Sievers
5607391481 update mtime of nodes and links when we re-use them 2009-12-18 21:25:13 +01:00
Kay Sievers
3c1898863f remove remaining support for CONFIG_SYSFS_DEPRECATED 2009-12-15 16:14:14 +01:00
Kay Sievers
86f77493bd test-udev: remove "ignore_device" code 2009-11-16 23:40:27 +01:00
Kay Sievers
6d87ee2e00 print warning for BUS=, SYSFS{}=, ID= 2009-11-16 23:39:33 +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
Kay Sievers
081be002ea udevd: create /dev/.udev/rules.d/ before watching it wit inotify
This should also address:

On Tue, Nov 3, 2009 at 16:21, Marco d'Itri <md@linux.it> wrote:
> udev_rules_new() in udev/udev-rules.c unconditionally creates the
> directory.
> This is a problem because the function is called also by e.g. udevadm
> test, and creating /dev/.udev/ when it does not exist is an unacceptable
> side effect which will break everything else that checks for its
> existence to know if udev is running.
2009-11-04 17:06:52 +01:00
Martin Pitt
495d408b36 fix major fd leak in link handling
link_find_prioritized(): Properly close directory handles to fix a major fd
leak which caused hotplugging to fail entirely in many cases due to having too
many open files.

https://launchpad.net/bugs/463347
2009-11-03 00:03:43 +01:00
Kay Sievers
bc3ec7bd45 unblock signals we might want to handle
On Thu, Oct 29, 2009 at 19:15, Christian P. Schmidt <schmidt@digadd.de> wrote:
> After the getty replaces itself with login the pam module pam_mount
> calls mount. This in turn determines that the partition to be mounted is
> LUKS encrypted, and calls cryptsetup. Cryptsetup receives the password,
> unlocks the partition, and calls udevadm settle in order to avoid some
> problems in interaction with LVM.
>
> udevadm settle never returns.
>
> The problem here is that SIGUSR1 and SIGALRM are both blocked in oldmask
> already, and never reach udevadm. No care is ever taken to ensure those
> signals are not blocked.
2009-10-31 11:53:41 +01:00
Kay Sievers
26347a4c55 use CLOEXEC flags instead of fcntl() 2009-10-30 12:39:04 +01:00
Kay Sievers
bfbf65aad0 remove "last_rule" option
Its use breaks too many things which expect to be run from independent
later rules, and is an idication that something needs to be fixed
properly instead.
2009-10-28 11:45:32 +01:00
Kay Sievers
6834a44299 break loops if util_create_path() returns error
Dangling symlinks in path components return -ENOENT. Do not retry
to create the file in a loop in such case.
2009-10-28 11:37:20 +01:00
Kay Sievers
19711e1933 udevd: serialize events for with the same major/minor
On Wed, Oct 7, 2009 at 21:46, Alan Jenkins <sourcejedi.lkml@googlemail.com> wrote:
> Udev would have avoided the race prior to
>
> 82c785e "udevd: remove check for dev_t, DEVPATH_OLD takes care of that"
>
> (the "check" removed here used to serialize events based on the device
> major:minor number).

On Wed, Oct 7, 2009 at 22:31, Michael Guntsche <mike@it-loops.com> wrote:
> add      /module/8250_pnp (module)
> remove /devices/platform/serial8250/tty/ttyS0 (tty)
> add      /devices/pnp0/00:05/tty/ttyS0 (tty)
2009-10-08 00:06:23 +02:00
Andrew Church
4daa146bf7 fix wrong parameter size on ioctl FIONREAD
On Wed, Sep 23, 2009 at 23:11, Matthias Schwarzott <zzam@gentoo.org> wrote:
> It is about ioctl failures on amd64:
>   http://bugs.gentoo.org/show_bug.cgi?id=286041
>
> A bad parameter type to an ioctl() call causes udev-146 to generate "error
> getting buffer for inotify" messages in syslog.  The offending code is
> roughly:
>
>    ssize_t nbytes, pos;
>    // ...
>    ioctl(fd, FIONREAD, &nbytes);
>
> where ssize_t is 64 bits on amd64, but the kernel code for FIONREAD (at least
> through gentoo-sources-2.6.31) uses type int:
>
>    p = (void __user *) arg;
>    switch (cmd) {
>    case FIONREAD:
>        // ...
>        ret = put_user(send_len, (int __user *) p);
>
> so the upper 32 bits of "nbytes" are left uninitialized, and the subsequent
> malloc(nbytes) fails unless those 32 bits happen to be zero (or the system has
> a LOT of memory).
2009-09-24 10:53:10 -07:00
Harald Hoyer
6068553195 rename interfaces to <iface>_rename if rename fails 2009-09-18 13:14:30 +02:00
Kay Sievers
bcb8b2315b fix SYMLINK{} option parsing 2009-09-16 18:14:03 +02:00
Kay Sievers
ca508dd94d udevadm: control - remove compat code 2009-09-14 14:29:05 +02:00
Marco d'Itri
2079b52e17 udevadmi: control = exit with rc=2 if there is some system error 2009-09-14 14:05:31 +02:00
Marco d'Itri
bbfeee28fc udevadm: print all messages to stderr with priority higher or equal than LOG_ERR
It is needed to prevent errors in udev from going unnoticed (e.g.
when udevd is not running).
2009-09-14 13:56:38 +02:00
Kay Sievers
b6a2637524 put util_create_path() and file creastion in a retry loop
On 8/29/09, Florian Zumbiehl <florz@florz.de> wrote:
> Could it happen that > util_create_path() and util_delete_path()
> do run in parallel for > the same directory? After all, util_create_path()
> does handle > the case where creation of the directory happens in parallel
> to it running, so it doesn't seem all that unlikely to me ...
2009-09-10 02:08:05 +02:00
Kay Sievers
676d294c23 reorder create_path() and node/link creation to be called in a direct sequence 2009-09-10 01:35:48 +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
Kay Sievers
78715f65c9 fix randonm findings from llvm-clang-analyzer
Thanks to Lennart for the log file!
2009-09-08 22:11:04 +02:00
Kay Sievers
335e316a71 fix whitespace 2009-09-07 12:15:29 +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
Kay Sievers
6d837a5348 udevadm: remove symlink support for old commands 2009-09-07 12:13:49 +02:00
Kay Sievers
77f89e9330 Revert "udev-rules.c: remove 'first_token' variable"
That was a mistake. The variable is needed to be set before
we parse the file. Thanks a lot to Alan Jenkins for spotting
this.

This reverts commit 710fdac1e4.
2009-09-07 12:13:49 +02:00
Florian Zumbiehl
6d691b2bd6 udev-rules.c: parse_file() - fix possible buffer overflow 2009-09-01 13:26:37 +02:00
Kay Sievers
710fdac1e4 udev-rules.c: remove 'first_token' variable 2009-09-01 13:16:48 +02:00
Florian Zumbiehl
9257ecfc19 ude_rules.c: fix possible NULL pointer dereference in get_key() 2009-09-01 12:15:54 +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
ebc1ba78ed inotify_add_watch(): do not store watch, if it failed
On Sun, Aug 30, 2009 at 04:36, Marco d'Itri<md@linux.it> wrote:
> inotify_add_watch may fail in udev_watch_begin, and then a link with
> name -1 is created.
> I do not know why, but it happened once on my system:
>
> lrwxrwxrwx 1 root root 27 Aug  4 11:27 -1 -> /devices/virtual/block/ram8
2009-08-30 20:42:06 +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
Kay Sievers
24d1fea8bd warn about non-readable or empty rules file 2009-08-19 07:34:07 +02:00
Kay Sievers
8e2470d68e print warning for NAME="%k" - it breaks the kernel supplied DEVNAME 2009-08-19 07:31:39 +02:00
Kay Sievers
cb6268f419 udevd: block for 15 seconds after error when too old kernel is detected
The compat code will go away some day and CONFIG_SYSFS_DEPRECATED
kernels fail in too many setups now to be worth to support them.
2009-08-08 22:59:41 +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
Diego Elio 'Flameeyes' Pettenò
59d93adb29 Merge libudev, udev, and the unconditional extras in a single Makefile.am.
Instead of using multiple recursive Makefile.am files, use a single
Makefile.am that sets and builds all the basic suite of libraries and
binaries for udev. This reduces the number of files in the source tree, and
also reduces drastically the build time when using parallel-make.

With this setup, all the compile steps will be executed in parallel, and
just the linking stage will be (partially) serialised on the libraries
creation.
2009-08-07 19:15:28 +02:00
Alan Jenkins
5bdba42ddb man: SYMLINK can be matched as well as assigned
If by-path / by-id links don't quite do what you want, this is a nice
clean way to extend the behaviour.  Real example:

SYMLINK=="serial/by-id/usb-Novatel_Wireless_Inc*CDMA*-if00-port0", \\
 SYMLINK+="cellcard"

Some users ask how to do things like this.

 - create an additional link with a shorter name
 - create a link which matches more loosely
    (omit certain path segments e.g. serial numbers)
 - change permissions on certain USB device nodes

Allow them to realize this without reading the friendly *.c files.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-08-07 14:46:42 +02:00
Alan Jenkins
8e534e2a47 man: fix unused, inaccurate metadata
Dates aren't shown in the manpages.  So they are not really useful,
and no-one is going to remember to update them.

"<refmiscinfo class="version"></refmiscinfo>" sounds even less useful.

I leave the unused "title" and "productname" tags.  They could
theoretically be useful, and aren't hard to maintain.  We just need to
fix the "title" for udevadm.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-08-07 14:46:42 +02:00
Kay Sievers
16dd0aa922 "record_failed" -> "fail_event_on_error" 2009-08-06 19:23:06 +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
2a827c959a make: build internal tools against libudev-private.la 2009-07-25 20:37:45 +02:00
Kay Sievers
d5b5a611ae format names are not case insensitive 2009-07-23 20:30:52 +02:00
Kay Sievers
cf5bd04073 udevadm: trigger - add --sysname-match=
$ udevadm trigger -n -v --subsystem-match=usb --sysname-match=2-1.1*
  /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1
  /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1.1
  /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1.1/2-1.1.1:1.0
  /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1.2
  /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1.2/2-1.1.2:1.0
  /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1.2/2-1.1.2:1.1
  /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1:1.0
2009-07-23 00:02:28 +02:00
Kay Sievers
820fc48f24 udevd: add timestamp to --debug output 2009-07-17 13:26:46 +02:00
Kay Sievers
c380472899 udevd: use bool 2009-07-13 03:33:15 +02:00