|Hi, Recently I pushed new commits to the repository of libnetaid replacing cmake with the autotools. Another first, the addition of the following socket: https://gitea.devuan.dev/aitor_czr/libnetaid/src/branch/master/src/nlsock.c <https://gitea.devuan.dev/aitor_czr/libnetaid/src/branch/master/src/nlsock.c> making use of select() for the system calls. Doing this way, simple-netaid becomes reactive to netlink events using less CPU resource, and essentially remains sleeping until some netlink event requires action (for instance, to update the graphical interface after the ethernet cable has been plugged in). I joined some good ideas from Didier's hopman: https://gitea.devuan.org/kryn/hopman/src/branch/master/hopman-and-select.html <https://gitea.devuan.org/kryn/hopman/src/branch/master/hopman-and-select.html> To verify the reactive behavior of simple-netaid, first build and install the sources of libnetaid: $ ./autogen.sh $ make $ sudo make install The list of build dependencies is: - autoconf - automake - libtool - gettext - intltool - libiw-dev After the installation of libnetaid, build the following program: #include <stdio.h> #include <stdlib.h> #include <simple-netaid/nlsock.h> int main() { for(;;) { int rc = nlsock_monitor(); if( rc == 0) printf("Signal received\n"); } return 0; } You need to pass the flag -lnetaid to the compiler. That is: $ gcc monitor.c -o monitor -lnetaid Now, run the binary as root: $ sudo ./monitor and try connecting or disconnecting your ethernet cable, or making other changes related to the network connection. Cheers, Aitor.|

_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to