Give a hint when 'udevd' is ready to operate
PATCH 1/1 Give a hint when 'udevd' is ready to operate
Hello,
please apply the attached patch. It creates the '/dev/.udev' directory when 'udevd' is ready to operate.
This helps init methods like 'initng' or 'minit' to stop future processing (e.g. invoking 'udevtrigger') until 'udevd' is fully initialized. Currently, there does not seem to exist a way to wait for 'udevd' (resp. to check whether it is ready) and issued uevent's may disappear silently.
With this patch, the init methods can test for /dev/.udev (e.g. waiting actively or using inotify) after 'udevd' has been started.
Enrico
udevd.c renamed from udevd.c.startup +2 -0
@@ -946,6 +946,8 @@chdir ("/" );umask (022 ); +create_path (UDEV_ROOT ); +/* become session leader */ sid =setsid ();dbg ("our session is %d" , sid);
Quoted 3 lines · Enrico Scholz
please apply the attached patch. It creates the '
/dev/.udev' directory when 'udevd' is ready to operate.
This isn't needed.
Start udevd with the --daemon argument, it won't go into the background until it's ready to process events.
So the following code works:
udevd --daemon udevtrigger
Scott
Signature · 2 lines
Scott James Remnant [email protected]
Quoted 7 lines · Scott James Remnant
Quoted 3 lines · Enrico Scholz
please apply the attached patch. It creates the '
/dev/.udev' directory when 'udevd' is ready to operate.This isn't needed.
Quoted 7 lines
Start udevd with the --daemon argument, it won't go into the background until it's ready to process events.
So the following code works:
udevd --daemon udevtrigger
Yeah, that is the usual way and udevd makes sure not to return before it's fully initialized. Waiting for a file from a daemon, just because the minit-like stuff tries to be smart (daemons don't detach) sounds weird. Anyway, the current udevd exports the seqnum of the kernel, so one can wait for that, even when it's a silly workaround a problem that does not exist in reality.
Kay
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 6 lines · Scott James Remnant
Quoted 3 lines
please apply the attached patch. It creates the '
/dev/.udev' directory when 'udevd' is ready to operate.This isn't needed.
Start udevd with the --daemon argument,
Does not work nice with modern init methods like 'initng' and 'minit' because they want to avoid forking daemons. Keeping track of the status of daemons (e.g. needed for the 'respawn' or 'send-signal-to-daemon' feature) is more difficultly when daemon goes into background.
Enrico
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 8 lines · Kay Sievers
Quoted 2 lines
udevd --daemon udevtriggerYeah, that is the usual way and udevd makes sure not to return before it's fully initialized. Waiting for a file from a daemon, just because the minit-like stuff tries to be smart (daemons don't detach) sounds weird. Anyway, the current udevd exports the seqnum of the kernel, so one can wait for that,
Does not work; the first call to export_initial_seqnum() (before fork()) is a noop because
| strlcpy(filename, udev_root, sizeof(filename)); | strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); | fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644);
fails due to the non-existing '/dev/.udev' path. So, my patch should be applied earlier
| udev_rules_init(&rules, 1);
|
| + create_path(udev_root);
| export_initial_seqnum();
|
| if (daemonize) {Enrico
Hi Enrico,
Quoted 2 lines · Enrico Scholz
Does not work nice with modern init methods like 'initng' and 'minit' because they want to avoid forking daemons.
I think that "modern" approach it's not the right one. It shouldn't be the init process the supervisor of the daemons launched at the boot time...
cheers,
Signature · 12 lines
David Gómez Jabber ID: [email protected] ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642 _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 14 lines · Enrico Scholz
Quoted 8 lines · Kay Sievers
Quoted 2 lines
udevd --daemon udevtriggerYeah, that is the usual way and udevd makes sure not to return before it's fully initialized. Waiting for a file from a daemon, just because the minit-like stuff tries to be smart (daemons don't detach) sounds weird. Anyway, the current udevd exports the seqnum of the kernel, so one can wait for that,
Does not work; the first call to
export_initial_seqnum()(beforefork()) is a noop because
Quoted 6 lines
| strlcpy(filename, udev_root, sizeof(filename)); | strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); | fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644);fails due to the non-existing '
/dev/.udev' path. So, my patch should be applied earlier
Just create that directory yourself and wait for the seqnum file to appear. In the devel tree it's already changed 3 days ago, but not in a released version.
Kay
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel