IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Apply substitutions before running a program, not while the rule
is parsed. It allows to use environment variables set during rule
processing as command arguments.
We never used any of the libsysfs convenience features. Here we replace
it completely with 300 lines of code, which are much simpler and a bit
faster cause udev(d) does not open any syfs file for a simple event which
does not need any parent device information.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Most of the issues are fixed with the kernel we depend on, for the
remaing ones see the RELEASE-NOTES for a special rule to add.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
It was a workaround for speed up udev "coldplug", where ~800 events
happened a second time during bootup. No need for it with the rules
aleady parsed in the daemon.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
If the kernel forks us as an usermodhelper, we don't have any of
the standard fd's and the first open() will start with fd=0.
This is inherited to all forked childs and confuses later forked
helpers where we want to read from a pipe connected to the helpers
stdout/stderr.
# ls -l /proc/$(pidof udevd)/fd
total 6
dr-x------ 2 root root 0 2005-08-18 12:44 .
dr-xr-xr-x 4 root root 0 2005-08-18 12:44 ..
lrwx------ 1 root root 64 2005-08-18 12:44 0 -> /dev/null
lrwx------ 1 root root 64 2005-08-18 12:44 1 -> socket:[1274617]
lr-x------ 1 root root 64 2005-08-18 12:44 2 -> pipe:[1274618]
l-wx------ 1 root root 64 2005-08-18 12:44 3 -> pipe:[1274618]
lrwx------ 1 root root 64 2005-08-18 12:44 4 -> socket:[1274619]
lrwx------ 1 root root 64 2005-08-18 12:44 5 -> socket:[1274620]
Ouch! This will obviously not redirect sterr, it will kill the pipe
we established between the parent and the child:
devnull = open("/dev/null", O_RDWR);
dup2(devnull, STDERR_FILENO);
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
If USE_DEBUG=true and udev_log="debug", all output of the forked
programs to stdout and stderr is send to syslog.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Rules can be precompiled and stored on disk for initramfs, to avoid
parsing the rules with every event again and again. Also the OWNER and
GROUP names are already resolved to numerical values in the compiled
rules. This flag is used for the upcoming move of the rules parsing
into udevd:
If the real root is mounted udevd is started and parses the rules
only once. The event processes will inherit the already parsed rules
from the daemon, so we want to ignore any precompiled rules and
use the real rules files and watch the filesystem for changes to
reload the rules automatically.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
strlcpy counts the sourec string lengt and is therefore not suitable
to copy a defined length of characters from one string to another.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
RUN="socket:<name>" will send the environment in the kernel uevent
format to the named destination. Using the socket instead of the program
to pass the hotplug events to the HAL daemon, cuts down the running
time of udevstart from 0.8 to 0.4 seconds on my box.
env -i ACTION=add DEVPATH=/block/hda/hda1 strace -s10000 ./udev block
sendto(3, "add@/block/hda/hda1\0
ACTION=add\0DEVPATH=/block/hda/hda1\0UDEV_LOG=3\0
ID_TYPE=disk\0ID_MODEL=HTS726060M9AT00\0ID_SERIAL=MRH401M4G6UM9B\0
ID_REVISION=MH4OA6BA\0ID_BUS=ata\0ID_PATH=pci-0000:00:1f.1-ide-0:0\0
ID_FS_USAGE=other\0ID_FS_TYPE=swap\0ID_FS_VERSION=2\0
ID_FS_UUID=9352cfef-7687-47bc-a2a3-34cf136f72e1\0
ID_FS_LABEL=ThisIsSwap\0ID_FS_LABEL_SAFE=ThisIsSwap\0
DEVNAME=/dev/hda1\0"
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
This cuts down our 600 rules file to 98 kb instead of 1.9 Mb memory
or file-size with precompiled rules.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Handle all events with rules. If udev is expected to handle hotplug.d/
the exernal helper must be called.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Modern rules are expected to call notification and postprocessing with
the RUN key. For compatibility the current behavior can be emulated
with an external helper.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
After the first valid netlink-event all event with a serial number
received on the udevsend socket will be ignored.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
SUBSYSTEM=="block", RUN="/sbin/program"
will execute the program only for block device events.
ACTION="remove", SUBSYSTEM=="block", RUN"/sbin/program"
will execute the program, if a block device is removed.
If we take over the hotplug call and manage the events we don't need
to call the event fake script in dev.d/. Just set all expected values
to the new network interface name and call hotplug.d/. This way the
device renaming is completely handled inside of udev and userspace
can't get confused.