[systemd-devel] systemd and kernel process

Steve Dickson SteveD at redhat.com
Sat Oct 3 05:41:34 PDT 2015



On 10/01/2015 03:50 PM, Kay Sievers wrote:
> 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.
Gotcha... 

> 
> 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.
Hmm... Interesting idea... Thanks!

steved.



More information about the systemd-devel mailing list