On Thu, 12 Mar 2015 19:05:01 -0400 Michael Conrad <mcon...@intellitree.com> wrote:
> In that case, I would offer this idea: Thanks. Your pseudo code makes perfect sense to me. ... > 3. Then to support the ability to launch mdev connected to a netlink > socket that already exists, and time out when not used, > > mdev_main() { > read_options(); > load_config(); > #ifdef FEATURE_MDEV_NETLINK > if (option_netlink) { > if (!option_netlink_on_stdin) { > close(0); > open_netlink_socket(); > } > while (select([0], timeout)) { > if (recv(0, message)) { > apply_env_from_message(message); > process_request(); > } > } > } > else > #endif > process_request(); > } I have the feeling (without digging into the busybox code) that making mdev suitable for a longlived daemon will not be that easy. I suspect there are lots of error handling that will just exit. A long lived daemon would need log and continue instead. If I am right about that, then those who wants the option_netlink case will probably need run the netlink listener as separate process anyway and instead set the timeout to "never". Then we end up with: mdev_main() { read_options(); load_config(); #ifdef FEATURE_MDEV_STDIN while (select([0], timeout)) { if (recv(0, message)) { apply_env_from_message(message); process_request(); } } #else process_request(); #endif } This would be enough for me. > I think this will be even smaller than what you propose with the fifo. > It will do netlink, it will do the traditional hotplug helper, and even > allow the trick where a tiny daemon monitors netlink and can start mdev > in daemon mode on demand. > > -Mike _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox