[systemd-devel] Returning arrays from sd-bus methods

guhan balasubramanian guhan.sac at gmail.com
Sat Jun 24 03:45:34 UTC 2017


I'm currently trying out sd-bus methods for my application. I am in a
situation where I must accept an input and return a byte array based on the

In the vtable. the following declaration is present:
SD_BUS_METHOD("method_id", "x", "ay", method_1, 0)

And inside the definition for method_1, for returning:
uint8_t b[2] = {0x01, 0x02};
sd_bus_reply_method_return(m, "ay", b);

This is giving me a segmentation error when I invoke method_1 using busctl.
I don't think this is the right way I should be returning an array type
from a method.

I am not able to find a reference code / documentation for implementing
such methods. Can someone please help me with the right way to do this?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20170623/4b9bfdef/attachment-0001.html>

More information about the systemd-devel mailing list