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

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


Hi,

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
input.

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?

Thanks,
Guhan

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-------------- 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