1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-11-01 00:51:08 +03:00
Commit Graph

29 Commits

Author SHA1 Message Date
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
Alan Jenkins
3e5c759543 fix handling of string_escape option 2008-10-25 15:19:48 +02:00
Kay Sievers
91a75e4ad4 match KEY="A|B" without temporary string copy 2008-10-25 03:00:03 +02:00
Kay Sievers
39a08013a2 fix "unused" warnings 2008-10-24 17:42:31 +02:00
Kay Sievers
db463fd309 special-case "?*" match to skip fnmatch() 2008-10-24 14:19:42 +02:00
Kay Sievers
ac218d9cc8 determine at rule parse time if we need to call fnmatch()
This cuts down the large rule set's 120.000 calls to fnmatch() to
51.000, and we can just call strcmp for the simple matches.
2008-10-24 13:32:32 +02:00
Kay Sievers
b0f7409f24 distinguish "match" from "assign" by (op < OP_MATCH_MAX) 2008-10-24 11:38:05 +02:00
Kay Sievers
154a7b8428 cache uid/gid during rule parsing
This cuts down the number of parsing /etc/group from ~700 to 11,
with some large rule files installed.
2008-10-24 10:51:04 +02:00
Kay Sievers
34d6a259dc rules: let empty strings added to buffer always return offset 0 2008-10-24 08:07:37 +02:00
Kay Sievers
548459e939 skip SYMLINK rules for devices without a device node 2008-10-23 21:42:23 +02:00
Alan Jenkins
7aeeaedc5f udevd: fix WAIT_FOR_SYSFS execution order
The wait should be ordered after matching KERNEL, ENV, etc.
but before ATTR.

Without this, WAIT_FOR_SYSFS rules will be applied unconditionally
to all events.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-23 20:59:17 +02:00
Alan Jenkins
84629ccd85 udevd: fix memory leak
Re: b99028c963 shrink struct udev_event

TEST 136: test multi matches 2
device '/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0' expecting node 'right'
==15011==
==15011== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1
==15011==    at 0x47F9AB8: malloc (vg_replace_malloc.c:207)
==15011==    by 0x489CB5F: strdup (in /lib32/libc-2.7.so)
==15011==    by 0x8050F40: udev_rules_apply_to_event (udev-rules.c:1973)
==15011==    by 0x804A658: udev_event_execute_rules (udev-event.c:549)
==15011==    by 0x805A636: main (test-udev.c:100)
add:         ok
==15012==
==15012== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1
==15012==    at 0x47F1AB8: malloc (vg_replace_malloc.c:207)
==15012==    by 0x4898B5F: strdup (in /lib32/libc-2.7.so)
==15012==    by 0x8050F40: udev_rules_apply_to_event (udev-rules.c:1973)
==15012==    by 0x804A9DF: udev_event_execute_rules (udev-event.c:658)
==15012==    by 0x805A636: main (test-udev.c:100)
remove:      ok

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-23 11:33:22 +02:00
Kay Sievers
b99028c963 shrink struct udev_event 2008-10-23 02:57:08 +02:00
Kay Sievers
40fd3bc837 shrink struct udev_event 2008-10-23 02:34:22 +02:00
Kay Sievers
6880b25d40 replace in-memory rules array with match/action token list
The in-memory rule array of a common desktop distro install took:
  1151088 bytes
with the token list:
  109232 bytes tokens (6827 * 16 bytes), 71302 bytes buffer
2008-10-23 00:13:59 +02:00
Alan Jenkins
b29a5e4ab9 use more appropriate alternatives to malloc()
Use calloc to request cleared memory instead.
Kernel and libc conspire to make this more efficient.

Also, replace one malloc() + strcpy() with strdup().

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2008-10-21 12:54:57 +02:00
Kay Sievers
94db05d288 replace missing get_attr_value() -> get_sysattr_value() 2008-10-21 12:42:13 +02:00
Kay Sievers
54808d77a3 prefix udev-util.c functions with util_* 2008-10-18 20:12:55 +02:00
Kay Sievers
eb8837e15c udev_list_cleanup() -> udev_list_cleanup_entries() 2008-10-18 19:27:38 +02:00
Kay Sievers
f1128767cb move udev_rules_apply_format() to udev-event.c 2008-10-18 19:19:56 +02:00
Kay Sievers
2d73813ebc udev_rules_run() -> udev_event_execute_run(); 2008-10-18 15:50:16 +02:00
Kay Sievers
d0db192fa5 move run_program to util 2008-10-18 15:25:05 +02:00
Kay Sievers
d7ddce186c make struct udev_rules opaque 2008-10-18 15:02:01 +02:00
Kay Sievers
c7521974a3 merge udev-rules.c and udev-rules-parse.c 2008-10-18 14:33:37 +02:00
Kay Sievers
fc42bd5d6b update rules file parsing 2008-10-17 00:40:03 +02:00
Kay Sievers
bb144ed14d update IMPORT= file/stdout property parsing 2008-10-16 22:41:52 +02:00
Kay Sievers
c28c4486af run_program: prevent empty last argv entry 2008-10-16 21:35:11 +02:00
Kay Sievers
8460299b57 rename udev source files 2008-10-16 18:13:48 +02:00