I created some basic support for 0MQ sockets in Linux kernel modules: http://git.mah.priv.at/gitweb/kzmq.git
- Michael --- README --- kzmq - 0MQ sockets for Linux kernel modules =========================================== This is a first cut of a kernel-level implementation of ZMQ sockets. It serves a limited purpose - to enable kernel modules to act as 0MQ sockets (TCP only) - it is NOT a general socket implementation for the linux kernel. example: The kzmq module implements a ZMQ REQ socket which connects to a userland REP listener. You need pyzmq installed for the userland responder. runnning the example: $ make $ python userland.py & $ ./load $ dmesg $ ./unload TODO: - bring function naming more in line with czmq - the debug output is naive - strings assumed - reconnect on failure is not yet automatic - tested on 2.6.32-32-generic only as of now Parts reused: ------------- ksocket library: http://ksocket.sourceforge.net/ by [email protected] sp_encoder, sp_decoder: https://github.com/250bpm/linux-2.6/tree/sp-v2.6.36/net/sp by Martin Sustrik and Martin Lucina Michael Haberler fecit A.D. 2012 Unix domain sockets: -------------------- I tried Unix domain sockets, and they work in principle; however, there's one scenario I'm unable to resolve and which make Unix domain sockets pretty much unusable for this purpose: - userland server binds ipc://tmp/foo , which creates the socket path '/tmp/foo' - kmod loaded, connects to '/tmp/foo', interaction fine - I unload the kmod AND '/tmp/foo' --> gets unlinked <---, preventing other clients to connect to server - kmod loaded again: complains about '/tmp/foo' ENOENT - of course, since the unload unlinked it :-/ obviously this has to do with ownership of the socket created in the module, and a cleanup routine called on the socket when the module gets unloaded; I'd like to prevent the kmod unlinking the socket path, but I dont get it how, and actually why it does that - it shouldnt be its business in the first place since it didnt bind() it. _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
