On Thu, 12 Mar 2015 17:51:00 +0100 Laurent Bercot <ska-dietl...@skarnet.org> wrote:
> On 12/03/2015 16:19, Natanael Copa wrote: > > netlink listener code that needs to be in memory all the time: > > http://git.alpinelinux.org/cgit/ncopa/nldev/tree/nldev.c > > A few comments: ... > - spawn_handler(): would benefit from being implemented via > posix_spawn(), to accommodate noMMU. On the other hand, you'd > need two elements in the posix_spawn_file_actions_t, so depending > on the implementation, that could pull in malloc(). It's a > trade-off. ... > - a pipe does not separate messages like a datagram socket does. > If you get a burst of events and nldev writes them all to the pipe, > nldev-handler won't be able to separate them. You need a message > terminator. In s6-uevent-listener, I simply used an extra \0 as > a message terminator. If you want to do the same: > * line 225: iov.iov_len = sizeof(buf)-1; > * insert after line 273: buf[len++] = 0; I have simplified the long-time living netlink listener more by forwarding the netlink socket and letting the handler read directly from netlink. This factorize out the pipe and remove the need of any micro protocol. It should also make it easier to use posix_spawn() instead of fork/exec. It is much smaller now: http://git.alpinelinux.org/cgit/ncopa/nldev/tree/nldev.c -nc _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox