Hi Julien, As a followup to <https://issues.guix.gnu.org/63516>, here is code that lets us wait for a link to show up “the right way”—i.e., without polling. It works over SOCK_NONBLOCK sockets, for use in Fibers programs.
I tested it in a VM created with ‘guix system vm’. If the “ens3” device is already there, (wait-for-link "ens3") returns immediately. Then I ran “rmmod e1000” to make the device disappear, and made another (wait-for-link "ens3") call: that call returns once I’ve run “modprobe e1000” in another terminal. Wonderful. :-) Now, it would be good to have a test suite that can run without complicated setups. We should check the strategy used by libnl, systemd, and the likes. Thoughts? Ludo’. Ludovic Courtès (11): connection: Remove unused procedure. connection: Use Guile's 'socket' procedure to open a socket. connection: Throw upon errors in FFI bindings. connection: Add support for suspendable sockets. connection: Allow users to pass extra SOCK_ flags to 'socket'. link: Extract 'new-link-message->link'. addr: Extract 'new-address-message->address'. connection: Add 'add-socket-membership'. error: Add 'sub-type' field to '&netlink-decoder-error' and use it. doc: Add indexes. link: Add 'wait-for-link'. doc/guile-netlink.texi | 51 +++++++++++++++-- ip/addr.scm | 46 +++++++-------- ip/link.scm | 122 ++++++++++++++++++++++++++++++--------- ip/route.scm | 6 +- netlink/connection.scm | 126 +++++++++++++++++++++++++++-------------- netlink/constant.scm | 40 +++++++++++++ netlink/data.scm | 13 +++-- netlink/error.scm | 4 +- 8 files changed, 303 insertions(+), 105 deletions(-) base-commit: beceb4cfea4739954e558411f46e07425891c774 -- 2.40.1