1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 08:26:52 +03:00
Commit Graph

77 Commits

Author SHA1 Message Date
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
b25a94549c do not exports properties starting with a '.'
Private variables can be marked like:
  ENV{.FOO}="bar"
2009-06-28 02:21:58 +02:00
Kay Sievers
6133f3432f cleanup ./configure installation directory options 2009-06-17 02:25:07 +02:00
Kay Sievers
045a3bc89e USE_LOG -> ENABLE_LOGGING, DEBUG -> ENABLE_DEBUG, USE_SELINUX -> WITH_SELINUX 2009-06-14 17:53:15 +02:00
Kay Sievers
32028733ee allow format substitution in path of ATTR{<path>}=="<value>" 2009-06-06 04:52:52 +02:00
Kay Sievers
a25d547dd4 udevd: use enum instead of char in struct declaration 2009-06-05 23:27:11 +02:00
Kay Sievers
bd75fddbcb require key names in uppercase
Drop pretty expensive case-insensitive matching, and key names in
mixed or lowercase are not supported anyway.
2009-05-20 23:45:32 +02:00
Kay Sievers
fb04513470 remove unused GL_FORMAT from rules parser 2009-05-20 23:12:22 +02:00
Kay Sievers
e6c1a2bde7 use openat(), unlinkat(), fstatat() 2009-05-20 18:58:52 +02:00
Kay Sievers
065db05221 use more efficient string copying 2009-05-20 17:57:52 +02:00
Scott James Remnant
055e40edc6 OWNER/GROUP: fix if logic
The introduction of the --resolve-names=early/never code introduced a
bug to the OWNER/GROUP lookup.  Previously if the name had contained $,
lookup would have been performed later; after the patch, the key ended
up being ignored!
2009-05-14 12:42:44 +01:00
Kay Sievers
0c37798916 fix possible endless loop for GOTO to non-existent LABEL
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=526365
2009-05-13 18:01:32 +02:00
Kay Sievers
e3196993f1 remove all PHYSDEVPATH handling and warning about 2009-05-04 22:08:05 +02:00
Kay Sievers
52761bb0a9 IMPORT: 2048 -> 4096 bytes buffer 2009-03-30 20:09:08 +02:00
Michael Prokop
2236ddae2d fix compile error in debug mode
When building with './configure --enable-debug && make' it fails with:
  udev-rules.c: In function ‘dump_token’:
  udev-rules.c:366: error: ‘struct <anonymous>’ has no member named ‘i’

Signed-off-by: Michael Prokop <mika@grml.org>
2009-03-03 17:27:00 +01:00
Kay Sievers
46f194cbde add "nowatch" to disable a default installed watch with a later rule 2009-02-25 11:18:15 +01: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
10b2d011e7 fix NAME= and OPTION+="string_escape=..." logic
Scott discovered this silly bug.
2009-02-08 16:02:15 +01:00
Kay Sievers
647f7c49e8 fix NAME="" logic
Reported-By: Soh Kam Yung <sohkamyung@gmail.com>
2009-01-30 03:53:09 +01:00
Scott James Remnant
5f03ed8a56 Allow user and group lookup to be disabled.
In certain cut-down situations such as an installer or inside the
initramfs, we simply don't have any kind of name service.  While we
could use rules without OWNER or GROUP, it's better to have the same
rules as a full system and have udevd ignore those parts of the rules.

Adds a --resolve-names=never switch to udevd that has this effect.
2009-01-20 21:33:02 +00: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
92e52e2fd1 do not complain about a missing /etc/udev/rules.d/
Scott mentioned that initramfs does not neccessarily have that
directory, so do not log an error.
2009-01-15 17:52:17 +01:00
Kay Sievers
3d7b2831cd libudev: device - add udev_device_get_property_value() 2009-01-06 00:26:28 +01:00
Kay Sievers
0c057e9c75 enable skipping of "naming-only" rules 2009-01-05 02:55:37 +01:00
Kay Sievers
ae2d346642 silence PHYSDEV* warning for WAIT_FOR* rules 2008-11-24 21:24:04 +01:00
Kay Sievers
949075dbbd remove len == 0 check, the index root is always '\0' 2008-11-13 18:21:28 +01:00
Kay Sievers
023ed7b0a3 merge trie nodes, childs and root into a single array 2008-11-13 00:52:12 +01:00
Kay Sievers
0dd9f015d3 reserve child slot 0 2008-11-12 15:01:20 +01:00
Kay Sievers
bcf44d5576 string index - split nodes and childs to allow and unlimited number of childs 2008-11-12 05:50:05 +01:00
Kay Sievers
1c8af93aca silence "comparison between signed and unsigned" 2008-11-11 23:47:01 +01:00
Alan Jenkins
1449a55ded udevd: de-duplicate strings in rules
On my Ubuntu installation this removes 15k of duplicate strings,
using a temporary index of about 25k.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-11-11 22:19:11 +01:00
Kay Sievers
5d6a1fa6e9 convert debug string arrays to functions
On Fri, Nov 7, 2008 at 13:07, Matthias Schwarzott <zzam@gentoo.org> wrote:
> I managed to let udev-131 segfault at startup.
>
> I configured it like this:
> CFLAGS="-Wall -ggdb" ./configure --prefix=/usr --sysconfdir=/etc --exec-prefix=
>
> Running it in gdb shows it segfaults at udev-rules.c:831
>
> (gdb) run
> Starting program: /tmp/udev-131/udev/udevd
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0804ea06 in get_key (udev=0x9175008, line=0xafcdc8f0, key=0xafcdc5d8,
> op=0xafcdc5d0, value=0xafcdc5d4)
>    at udev-rules.c:831
> 831             dbg(udev, "%s '%s'-'%s'\n", operation_str[*op], *key, *value);

If compiled without optimization, the dbg() macro dereferences variables
which are not available. Convert the string array to a function, which just
returns NULL if compiled without DEBUG.
2008-11-07 15:59:58 +01:00
Kay Sievers
e230e966f4 fix size_t compiler warning on 32 bit platforms 2008-11-07 02:58:54 +01:00
Kay Sievers
78230c0dbe cleanup /dev/.udev/queue on startup and exit 2008-11-06 17:43:12 +01:00
Alan Jenkins
3f3aa9f57c udevd: shrink struct token to 12 bytes 2008-11-05 22:28:52 +01:00
Kay Sievers
92f4313665 unify string replacement 2008-11-05 21:49:52 +01:00
Kay Sievers
08e7f22913 info() PROGRAM and IMPORT execution 2008-11-05 04:05:17 +01:00
Kay Sievers
1e78dcbe51 fix list handling in enumerate and rules file sorting 2008-11-04 20:19:01 +01:00
Kay Sievers
4052400fa0 move debugging strings inside #ifdef DEBUG 2008-11-01 21:05:25 +01:00
Kay Sievers
86b5778857 move some info() to dbg() 2008-11-01 20:16:24 +01:00
Kay Sievers
00f98bd2b3 skip entire rule containing device naming keys, if no device can be named
If rules set NAME, SYMLINK, OWNER, GROUP, MODE, events without a device node
and remove events will skip the entire rule. The old parser did the same.
2008-11-01 19:12:20 +01:00
Kay Sievers
0ef254d580 log rules file and line number when NAME, SYMLINK, OWNER, GROUP, MODE, RUN is applied 2008-11-01 18:34:54 +01:00
Alan Jenkins
d15fcce4b3 udevd: be more careful when matching against parents
I'm worried about what will happen with things like

KERNELS=="*" # pointless rule
KERNELS=="doesnt-match" # another pointless rule

Since TK_RULE < TK_M_PARENTS_MAX, we will try to match all three tokens
against parents of the current device.  I can't think of a bad case,
but it's not exactly good either.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-11-01 17:32:16 +01:00
Alan Jenkins
11ae757850 udevd: fix termination of rule execution
LAST_RULE was broken, and I broke TK_END by making it do the same.
It used a "break" which exited the switch statement, but not the loop!

==2953== Invalid read of size 4
==2953==    at 0x4081EE: dump_token (udev-rules.c:859)
==2953==    by 0x40BADB: udev_rules_apply_to_event (udev-rules.c:1849)
==2953==    by 0x403F17: udev_event_execute_rules (udev-event.c:554)
==2953==    by 0x418626: main (test-udev.c:100)
==2953==  Address 0x55ab1f8 is 0 bytes after a block of size 80 alloc'd
==2953==    at 0x4C23082: realloc (vg_replace_malloc.c:429)
==2953==    by 0x40B13B: udev_rules_new (udev-rules.c:1670)
==2953==    by 0x418536: main (test-udev.c:84)
...

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-11-01 17:29:26 +01:00
Kay Sievers
aeb53ca3d6 ATTR{}== always fails if the attribute does not exist 2008-10-29 22:22:12 +01:00
Alan Jenkins
6270756cdc udevd: simplify rules execution loop
cur can't become NULL, and the check for TK_END
can be folded into the switch statement.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-28 10:02:43 +01:00
Kay Sievers
1822e9b033 do not init string arrays, just clear first byte 2008-10-26 02:31:54 +01:00
Kay Sievers
21cfb0436c match_attr() - copy attr value only when needed 2008-10-26 02:16:54 +01:00
Alan Jenkins
cd94c04c51 udevd: avoid implicit memset in match_attr()
Initializing a char array to "" is equivalent to a memset()
call - which is exactly what it gets compiled to.

Fixing this one callsite reduced memset() _user_ cpu cycles
from 2-4% to 0.05% on the EeePC.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-26 02:11:56 +01:00