Re: A question about communication between kernel, daemon

H. Peter Anvin (hpa@transmeta.com)
21 Aug 1998 02:13:59 GMT


Followup to: <19980820180530.9736.qmail@hotmail.com>
By author: "Cook Dan" <tricountry@hotmail.com>
In newsgroup: linux.dev.kernel
>
> Hello,
>
> I have a question about the communication between Linux kernel, and
> one daemon on that host. What is the better way to let kernel inform
> a daemon something happened. I know signal should work, But somehow
> I do not want to use it. I did not use unix socket before, But since
> unix socket will use a file, It seems it can not be used in kernel.
>
> The problem I ran into looks like this:
>
> Kernel receive a message, this message is not aimed to one application,
> but the kernel needs to handle it, and will pass
> this message to a daemon after the kernel handling. And daemon
> will also handle this message.
>
> Thanks. Please also cc to me.
>

autofs uses a pipe, which works great as long as you don't need to
handle messages larger than PIPE_BUF (4K); if so then you need a
semaphore around the places in the kernel which write to the pipe to
avoid interleaved packet fragments.

It's really easy to do, to. Look at fs/autofs/inode.c and look for
"fget".

-hpa

-- 
    PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD  1E DF FE 69 EE 35 BD 74
    See http://www.zytor.com/~hpa/ for web page and full PGP public key
        I am Bahá'í -- ask me about it or see http://www.bahai.org/
   "To love another person is to see the face of God." -- Les Misérables

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html