Re: A question about communication between kernel, daemon

Kirk Petersen (kirk@eidolon.muppetlabs.com)
Thu, 20 Aug 1998 12:21:07 -0700


> 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.

Well, kerneld used a SysV message queue and people seemed to like it
when that was removed. I think using a kernel-to-userland unix domain
socket is only slightly better. Someone brought up the idea of using
a named pipe, if I remember correctly (actually, I think there was
code written that did this).

Another idea is to make a dummy device (or /proc entry) that lets you
communicate with the kernel. If the kernel needs to send data to the
daemon, have the daemon call read or ioctl and block until there is
info to return. I haven't thought this through, so there might be
problems with it, but the point is, if you are gonna do
kernel-to-userland communication, atleast use something that is likely
to be compiled in all kernels instead of something like SysV IPC or
networking/socket interfaces.

-- 
Kirk Petersen
www.speakeasy.org/~kirk/

- 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