[systemd-devel] [PATCH 1/2] bus: Add bus_kernel_monitor function

Lennart Poettering lennart at poettering.net
Tue Dec 10 12:34:00 PST 2013


On Tue, 03.12.13 15:17, Lukasz Skalski (l.skalski at partner.samsung.com) wrote:

Applied! Thanks!

What's missing though is the hookup with the match logic. I.e. when the
"eavesdrop" token is used in the match string we need to invoke this
ioctl.

> ---
>  src/libsystemd-bus/bus-kernel.c | 16 ++++++++++++++++
>  src/libsystemd-bus/bus-kernel.h |  2 ++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
> index ca36eb8..603aa97 100644
> --- a/src/libsystemd-bus/bus-kernel.c
> +++ b/src/libsystemd-bus/bus-kernel.c
> @@ -1196,3 +1196,19 @@ int bus_kernel_create_namespace(const char *name, char **s) {
>  
>          return fd;
>  }
> +
> +int bus_kernel_monitor(sd_bus *bus) {
> +        struct kdbus_cmd_monitor cmd_monitor;
> +        int r;
> +
> +        assert(bus);
> +
> +        cmd_monitor.id = 0;
> +        cmd_monitor.flags = KDBUS_MONITOR_ENABLE;
> +
> +        r = ioctl(bus->input_fd, KDBUS_CMD_MONITOR, &cmd_monitor);
> +        if (r < 0)
> +                return -errno;
> +
> +        return 1;
> +}
> diff --git a/src/libsystemd-bus/bus-kernel.h b/src/libsystemd-bus/bus-kernel.h
> index a9dddc2..7ad49a5 100644
> --- a/src/libsystemd-bus/bus-kernel.h
> +++ b/src/libsystemd-bus/bus-kernel.h
> @@ -73,3 +73,5 @@ int bus_kernel_parse_unique_name(const char *s, uint64_t *id);
>  
>  int kdbus_translate_request_name_flags(uint64_t sd_bus_flags, uint64_t *kdbus_flags);
>  int kdbus_translate_attach_flags(uint64_t sd_bus_flags, uint64_t *kdbus_flags);
> +
> +int bus_kernel_monitor(sd_bus *bus);


Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list