[systemd-devel] byte size that sd_bus_message_read can take.
Lennart Poettering
lennart at poettering.net
Wed Oct 14 06:51:56 PDT 2015
On Fri, 09.10.15 14:14, Jay Lee (leejiyeon.jay at gmail.com) wrote:
> Hi,
>
> I am writing a service using sd-bus API library in systemd211.
> The service runs linux command lines (i.e. iptables ...) from user input.
> It sounds stupid, but the service is needed for my project. :) I am
> wondering how many bytes sd_bus_message_read() can read/send at a time
> because the output size from commands can be huge. It will be awesome if it
> reads infinite, but I have this feeling that it limits the size of bytes to
> read at a time.
Well, firstly, it's limited by the addressable address space on your
arch, hence certainly not more than 2G on 32bit i386.
On classic dbus1 the maxium message size is controlled by the
max_message_size config option, which defaults to 32M iirc. Since
dbus1 copies around memory quite liberally sending huge datagrams is
probably something to avoid.
If kdbus is used then the limit is lifted, and sd-bus if used properly
can be used to send datagrams efficiently that are as large as your
entire address space. This is based on the "memfd" concept, and works
in zero-copy fashion if you make use
sd_bus_message_append_array_memfd() and sd_bus_message_read_array()
and suchlike, so that it is not necessary to copy any memory in and
out of a message.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list