>> - Userland creates an AF_LOCAL SOCK_STREAM socketpair and passes one >> of the resulting socket fds to the kernel, which takes over the >> referenced socket and uses it, with userland reading from and >> writing to the other socket. > I need this for notifying about some event in kernel module with > transferring small data (i.e. uint64_t) and for confirming from user > mode that notification was processed.
Okay. You could use this paradigm, but I suspect it will be simpler from the point of view of the kernel coder to use a custom character special device driver, though of course depending on other details that may or may not do what you want. > Does exist any sample for this kind of above communication ? I used that paradigm when, in 2002, I had the job of taking an experimental encrypted storage paradigm and making it mountable as a filesystem, what on today's NetBSD would probably be done with puffs. I built something philsophically like puffs and then wrote the rest atop that; the puffs-ish thing was built upon the socketpair foundation I sketched in the quote above. This was under 1.4T - it was, after all, 2002 - and as far as I know it was never rolled forward into any other version. But you're welcome to look at the 1.4T code. It's present in my mutant 1.4T tree. My primary distribution mechanism for that is a world-clonable git repo (git://git.rodents-montreal.org/Mouse/netbsd-fork/1.4T/src, from which you want commit 9639069efd43b4c26b7159f3e5d48db1aff0c09e); since you probably want only a small fraction of the files there, you might be better off fetching them from the unpacked view instead. See {ftp,http}://ftp.rodents-montreal.org/pub/mouse/git-unpacked/Mouse/netbsd-fork/1.4T/src/ for that; if you just want the code, see .../1.4T/src/commit/96/9639069efd43b4c26b7159f3e5d48db1aff0c09e/tree/sbin/mount_pfs and .../tree/sys/miscfs/pfs/. There are a few changes elsewhere; you also can fetch .../1.4T/src/diff/f236384-9639069 to get the full diffs for that commit. If you use tools that make you step down one level at a time, you may note the diff/ directory appears empty. It may help to think of it as a mode-111 directory (it isn't, but that's probably the closest Unix-family analog - if you want to know what's truly behind it, see .../mouse/git-unpacked/README). If you dig a bit, you may note the commit's timestamp is in 2011. That is not when I did the work; that is merely when I converted it to a commit in a git repo. /~\ The ASCII Mouse \ / Ribbon Campaign X Against HTML mo...@rodents-montreal.org / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B