[systemd-devel] sd-bus: get size of array container in D-Bus message

2023-08-02 Thread Stanislav Angelovič
Hi folks, I have a quick question: is there a way to get container size when deserializing an array from a D-Bus message (be it an array of trivial or non-trivial D-Bus types)? Say I enter a container with sd_bus_message_enter_container​, and then, before reading individual elements, I'd like

[systemd-devel] Extend sd_bus_message_append_basic to take length of a string

2023-03-20 Thread Stanislav Angelovič
Hi folks, Does sd-bus API provide a way to append a char string of a basic type (be it SD_BUS_TYPE_STRING​, SD_BUS_TYPE_OBJECT_PATH​, or SD_BUS_TYPE_SIGNATURE​ for that matter) to a D-Bus message while allowing the caller to explicitly specify the length of that char string?

Re: [systemd-devel] sd_bus_get_timeout returns absolute time despite what's documented

2023-01-09 Thread Stanislav Angelovič
Hey Lennart, Yes, I was referring to man pages I read a few years ago when I used sd_bus_get_timeout() for the first time. And, before posting this mail, I also checked on my current Linux development machine, which has systemd v247. So I was not that far :-) The fixed wording in v250 is

[systemd-devel] sd_bus_get_timeout returns absolute time despite what's documented

2023-01-07 Thread Stanislav Angelovič
Hi everyone, According to sd_bus_get_timeout(3) man page, sd_bus_get_timeout() returns "timeout in us to pass to poll()" and it also states that "the returned time-value is relative". However, in reality, this function returns an absolute time point (a-ka relative to the monotonic clock

[systemd-devel] Exception safety od sd-bus

2021-07-22 Thread Stanislav Angelovič
or whatever obscure situations may happen then)? Thanks, Stanislav Angelovič. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] sd-bus change that broke sdbus-c++

2020-06-16 Thread Stanislav Angelovič
Done: https://github.com/systemd/systemd/issues/16193 On Tue, Jun 16, 2020 at 10:50 AM Lennart Poettering wrote: > On Mi, 10.06.20 18:24, Stanislav Angelovič (angelovi...@gmail.com) wrote: > > > Hi folks, > > > > sdbus-c++, a C++ library on top of sd-bus, is based on p

[systemd-devel] sd-bus change that broke sdbus-c++

2020-06-10 Thread Stanislav Angelovič
Hi folks, sdbus-c++, a C++ library on top of sd-bus, is based on plain sd-bus messages to implement the concept of Variant type. Under plain message here I mean one created via `sd_bus_message_new` with the type being _SD_BUS_MESSAGE_TYPE_INVALID. We use such a message as a generic container of

[systemd-devel] sd-bus signal callback return value

2020-03-24 Thread Stanislav Angelovič
Hi folks, Please, what is the difference in sd-bus behavior when my D-Bus signal callback returns a zero return value versus a positive return value? And what's the difference between those return values in D-Bus method callback, D-Bus async method reply callback, D-Bus property get callback,

[systemd-devel] GetMachineId implementation in libsystemd

2019-09-23 Thread Stanislav Angelovič
Hi guys, I have two questions regarding implementation of org.freedesktop.DBus.Peer.GetMachineId() in libsystemd. 1. The method only checks the '/etc/machine-id' file. If libsystemd, which contains sd-bus implementation, which is quite self-contained and systemd-independent, is used in a

Re: [systemd-devel] sd-bus: Enabling free-standing, bus-independent plain messages

2019-05-23 Thread Stanislav Angelovič
Hi Lennart, Sorry for a bit late reply, I've been quite busy recently. > So we could readd the ability to create a bus message with a NULL bus, > but I am a bit concerned that people then always pass NULL which might > ultimately result in constant remarshalling if the message is > eventually

[systemd-devel] sd-bus: Enabling free-standing, bus-independent plain messages

2019-05-12 Thread Stanislav Angelovič
Hi (Lennart :) Quick question: Would it be possible to extend sd-bus to also allow creating messages without requiring a bus? Let me explain: Currently, if we want to create any message in sd-bus, we need a valid bus pointer. That might make perfect sense for messages that come from or will

Re: [systemd-devel] refcount of bus returned from sd_bus_default_system

2019-05-09 Thread Stanislav Angelovič
is that users won't be able to create self-contained Variants (they will have to provide their bus connection explicitly to create a Variant). Thanks a lot! Take care. On Thu, May 9, 2019, 17:02 Lennart Poettering wrote: > On Mi, 08.05.19 22:50, Stanislav Angelovič (angelovi...@gmail.com) wr

[systemd-devel] refcount of bus returned from sd_bus_default_system

2019-05-08 Thread Stanislav Angelovič
Heya, when writing sdbus-c++, we've observed that sd_bus_default_system function called in a fresh new thread returns a bus with initial ref count 2. We built our code upon that assumption -- we had to unref the bus twice when the thread local storage got freed, otherwise we'd have gotten memory

[systemd-devel] Build only libsystemd as a shared library

2019-04-23 Thread Stanislav Angelovič
Hi systemd-ers, Having recent systemd sources, how can I build libsystemd.so only? I was able to build the static version with this: meson build/ ninja -C build version.h ninja -C build libsystemd.a But how can I build the shared one? Is there a configuration flag? (I'm not familiar with

[systemd-devel] sd-bus: "cancelling" async method call

2019-04-06 Thread Stanislav Angelovič
Hi, Is there a way in sd-bus to "cancel" an async call issued through sd_bus_call_async() or sd_bus_call_method_async()? Under cancelling here I mean that the call issued can proceed to its end, but I'm just no more interested in results and don't want sd-bus to invoke provided callback when the

Re: [systemd-devel] sd-bus: serving method call message in a separate thread

2019-03-05 Thread Stanislav Angelovič
Hi Lennart, Thanks a lot for your elaborate reply. See inline replies... On Tue, Mar 5, 2019 at 11:27 AM Lennart Poettering wrote: > > On Mo, 04.03.19 21:56, Stanislav Angelovič (angelovi...@gmail.com) wrote: > > > sd-bus doesn't natively care for threads. However it's

[systemd-devel] sd-bus: serving method call message in a separate thread

2019-03-04 Thread Stanislav Angelovič
Hi sd-bus-ers! Quick question: How can I process a method call on service side in a different thread, without creating race condition? Longer version: In sdbus-c++, we are working on server-side asynchronous method call support. In sd-bus, a service handles D-Bus method calls via

[systemd-devel] D-Bus method parameter names in introspection XML

2019-02-18 Thread Stanislav Angelovič
Hi guys, sd-bus implements and automatically provides org.freedesktop.DBus.Introspectable interface for each object vtable. Xml output of Introspect method of that interface provides all necessary information but one -- names of method parameters. It's quite convenient that when one introspects

[systemd-devel] sd-bus: calling D-Bus method from a D-Bus method callback upon the same D-Bus connection

2019-01-26 Thread Stanislav Angelovič
Hi guys, in sd-bus, when D-Bus method callback of my service is invoked (someone is calling me), is it possible to issue another synchronous call to another service upon *the same sd_bus connection*? I.e. does sd_bus instance allow that while it is processing incoming requests and invoking

[systemd-devel] Direct connection between peers in sd-bus

2019-01-17 Thread Stanislav Angelovič
Hi, In sd-bus, I guess it is possible to have a one-to-one connection between a service and a client, i.e. connection without D-bus daemon), am I right? If yes, is there any example (in systemd source tree or elsewhere) of sd-bus one-to-one communication usage that I could look at for inspiration

[systemd-devel] Async server with sd-bus

2018-05-21 Thread Stanislav Angelovič
Hi folks, Suppose we have a server whose methods may take relatively long time and I would like to process them asynchronously within the server, so while a client is waiting for reply to his time-consuming call, other clients (which could be served quickly, for example) are not starved because

Re: [systemd-devel] sd-bus connections & authentication timeout

2017-03-20 Thread Stanislav Angelovič
Hi Jan, thanks for quick response. Instead of sd_bus_process(), we could perhaps use sd_bus_flush() after creating the connection, as that one actually processes the requests until the connection changes state to 'running'. I tried this and it helped. Regarding polling, I understand, but I fear

[systemd-devel] sd-bus connections & authentication timeout

2017-03-20 Thread Stanislav Angelovič
Hi, We use sd-bus for DBus IPC in our own applications. Some applications of ours cause the dbus daemon to issue "Connection has not authenticated soon enough, closing it" message, leading to the org.freedesktop.DBus.Error.Timeout error at the peer side when the connection is used for an IPC

Re: [systemd-devel] sd-bus: Implementing Variant concept: Copying sd-bus message contents

2016-11-29 Thread Stanislav Angelovič
On Mon, Nov 28, 2016 at 6:45 PM, Lennart Poettering <lenn...@poettering.net> wrote: > On Sat, 26.11.16 16:01, Stanislav Angelovič (angelovi...@gmail.com) wrote: > > > Hi, > > > > A quick question: Is it possible to append contents (the serialized data) > > of

[systemd-devel] sd-bus: Implementing Variant concept: Copying sd-bus message contents

2016-11-26 Thread Stanislav Angelovič
Hi, A quick question: Is it possible to append contents (the serialized data) of an sd-bus message to another sd-bus message? Conversely, is it possible to extract a part of sd-bus message contents into a separate message? Details: In the process of creating a method call message, I would like