[systemd-devel] systemd and kernel process

Kay Sievers kay at vrfy.org
Thu Oct 1 12:50:40 PDT 2015


On Thu, Oct 1, 2015 at 9:30 PM, Steve Dickson <SteveD at redhat.com> wrote:
>
>
> On 10/01/2015 09:24 AM, Kay Sievers wrote:
>> On Wed, Sep 30, 2015 at 10:49 PM, Steve Dickson <SteveD at redhat.com> wrote:
>>> Is there a way for systemd to monitor kernel process?
>>> By monitor I mean the existence.
>>
>> No, and there is no plan to do anything like that.
>>
>> Kernel tasks are kernel internals, and userspace must not make any
>> assumptions about them. They can come and go at any time between any
>> kernel versions.
>>
>> Custom tools can do what they need, but systemd should not offer to do
>> that to users.
> First all thanks for the response
>
> kernel process in question is nfsd. The number of thread
> is kept in /proc/fs/nfsd/threads.
>
> So the idea would be doing a systemctl status nfsd
> and number in /proc/fs/nfsd/threads is zero the
> service would be deactive. An non-zero number the
> service would active.
>
> Is this something systemd could be used for?

No, not directly. There is no facility to watch /proc or any other
similar interface for such changes. Plain /proc directories are just
not capable of providing event information to userspace.

The kernel's nfs implementation would need a character device where
events are send out, or possibly a poll()able file in /proc, or
something in /sys/devices/, or a similar approach, where udev can
react to. Such interface could be used to signal systemd that
userspace should react to state changes in the kernel.

Kay


More information about the systemd-devel mailing list