[systemd-devel] [PATCH]v2 Add sd_is_special for special file descriptors
William Douglas
william.r.douglas at gmail.com
Wed Jun 15 13:20:43 PDT 2011
Lennart Poettering <lennart at poettering.net> writes:
> On Wed, 15.06.11 11:25, William Douglas (william.r.douglas at gmail.com) wrote:
>
>> >From 85f51557a62be9224ed475047aff503bece342b4 Mon Sep 17 00:00:00 2001
>> From: William Douglas <william.douglas at intel.com>
>> Date: Wed, 15 Jun 2011 11:08:17 -0700
>>
>> With the addition of ListenSpecial as a socket option we need the
>> the usual sd_is_ functions for special files. This patch does
>> that.
>
> ListenSpecial= in systemd is designed so that we can use it to do
> socket-style activation both on files in /proc that have "special"
> behaviour (and are 'regular' files), i.e. /proc/kmsg, as well as device
> nodes in /dev. For example, people could use this to listen on
> /dev/input/event0 and activate a service whenever somebody presses a key
> or so.
>
> sd_is_special() hence should be able to check for both kinds of files,
> too. That means, S_ISCHR needs to be accepted as well as S_ISREG, and in
> the former case we should compare st_rdev, and only in the latter
> st_dev+st_ino.
>
> Otherwise looks fine.
>
> Lennart
Ah right, I was only thinking of getting /proc/kmsg working =P.
I have updated accordingly below.
More information about the systemd-devel
mailing list