[systemd-devel] [PATCH] Add Listen* to dbus properties

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sun Mar 31 20:12:27 PDT 2013


On Sun, Mar 31, 2013 at 06:23:24PM +0300, Oleksii Shevchuk wrote:
> ---
>  src/core/dbus-socket.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
> 
> diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c
> index 2092a63..1dfac6d 100644
> --- a/src/core/dbus-socket.c
> +++ b/src/core/dbus-socket.c
> @@ -63,6 +63,10 @@
>          "  <property name=\"NConnections\" type=\"u\" access=\"read\"/>\n" \
>          "  <property name=\"MessageQueueMaxMessages\" type=\"x\" access=\"read\"/>\n" \
>          "  <property name=\"MessageQueueMessageSize\" type=\"x\" access=\"read\"/>\n" \
> +        "  <property name=\"ListenSocket\" type=\"as\" access=\"read\"/>\n"    \
> +        "  <property name=\"ListenSpecial\" type=\"as\" access=\"read\"/>\n"    \
> +        "  <property name=\"ListenMessageQueue\" type=\"as\" access=\"read\"/>\n"    \
> +        "  <property name=\"ListenFIFO\" type=\"as\" access=\"read\"/>\n"    \
>          "  <property name=\"Result\" type=\"s\" access=\"read\"/>\n"    \
>          "  <property name=\"SmackLabel\" type=\"s\" access=\"read\"/>\n" \
>          "  <property name=\"SmackLabelIPIn\" type=\"s\" access=\"read\"/>\n" \
> @@ -98,6 +102,52 @@ const char bus_socket_invalidating_properties[] =
>  static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_socket_append_bind_ipv6_only, socket_address_bind_ipv6_only, SocketAddressBindIPv6Only);

Hi,
would be great to get this in. But this API is too simple, and some informatino
is lost.

Following systemd.socket(5) I created the following .socket:

[Socket]

ListenStream=/tmp/stream1
ListenDatagram=/tmp/stream2
ListenSequentialPacket=/tmp/stream3

ListenStream=@stream4
ListenDatagram=@stream5
ListenSequentialPacket=@stream6

ListenStream=9999
ListenDatagram=9998

ListenStream=127.0.0.2:9996
ListenDatagram=127.0.0.2:9995

ListenStream=[::1]:9996
ListenDatagram=[::1]:9995

ListenFIFO=/tmp/fifo1

ListenSpecial=/dev/input/event9

ListenNetlink=kobject-uevent

ListenMessageQueue=/msgqueue1

$ gdbus introspect --system --dest org.freedesktop.systemd1 --object-path /org/freedesktop/systemd1/unit/list1_2esocket |grep Listen

      readonly as ListenSocket = ['/tmp/stream1', '/tmp/stream2', '/tmp/stream3', '@stream4', '@stream5', '@stream6', '[::]:9999', '[::]:9998', '127.0.0.2:9996', '127.0.0.2:9995', '[::1]:9996', '[::1]:9995', 'kobject-uevent 0'];
      readonly as ListenSpecial = ['/dev/input/event9'];
      readonly as ListenMessageQueue = ['/msgqueue1'];
      readonly as ListenFIFO = ['/tmp/fifo1'];

As you can see, ListenNetlink=kobject-uevent is "misplaced".

Also, we lost the distinction between Stream, Datagram and SequentialPacket
types. This solution (IMO) would be to use something like .path does:

      readonly a(ss) Paths = [('PathExistsGlob', '/var/spool/cups/d*')];

Since we'll (most probably) be growing further types of Listen,
it might make sense to put everything under one name, to avoid 
API growth:

     Listen = [('Stream', '/tmp/stream1'),
               ...
               ('FIFO', '/tmp/fifo1'), ...];

Zbyszek


More information about the systemd-devel mailing list