2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id="sd_bus_set_method_call_timeout" xmlns:xi="http://www.w3.org/2001/XInclude">
9 <title>sd_bus_set_method_call_timeout</title>
10 <productname>systemd</productname>
14 <refentrytitle>sd_bus_set_method_call_timeout</refentrytitle>
15 <manvolnum>3</manvolnum>
19 <refname>sd_bus_set_method_call_timeout</refname>
20 <refname>sd_bus_get_method_call_timeout</refname>
22 <refpurpose>Set or query the default D-Bus method call timeout of a bus object</refpurpose>
27 <funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo>
30 <funcdef>int <function>sd_bus_set_method_call_timeout</function></funcdef>
31 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
32 <paramdef>uint64_t <parameter>usec</parameter></paramdef>
36 <funcdef>int <function>sd_bus_get_method_call_timeout</function></funcdef>
37 <paramdef>sd_bus *<parameter>bus</parameter></paramdef>
38 <paramdef>uint64_t *<parameter>ret</parameter></paramdef>
44 <title>Description</title>
46 <para><function>sd_bus_set_method_call_timeout()</function> sets the default D-Bus method call
47 timeout of <parameter>bus</parameter> to <parameter>usec</parameter> microseconds.</para>
49 <para><function>sd_bus_get_method_call_timeout()</function> queries the default D-Bus method
50 call timeout of <parameter>bus</parameter>. If no method call timeout was set using
51 <function>sd_bus_set_method_call_timeout()</function>, the timeout is read from the
52 <varname>$SYSTEMD_BUS_TIMEOUT</varname> environment variable. If this environment variable is
53 unset or does not contain a valid timeout, the implementation falls back to a predefined method
54 call timeout of 25 seconds. Note that <varname>$SYSTEMD_BUS_TIMEOUT</varname> is read once and
55 cached so callers should not rely on being able to change the default method call timeout at
56 runtime by changing the value of <varname>$SYSTEMD_BUS_TIMEOUT</varname>. Instead, call
57 <function>sd_bus_set_method_call_timeout()</function> to change the default method call timeout.
62 <title>Return Value</title>
64 <para>On success, these functions return a non-negative integer. On failure, they return a
65 negative errno-style error code.</para>
70 <para>Returned errors may indicate the following problems:</para>
74 <term><constant>-EINVAL</constant></term>
76 <listitem><para>The parameters <parameter>bus</parameter> or <parameter>ret</parameter>
77 are <constant>NULL</constant>.</para>
79 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
83 <term><constant>-ENOPKG</constant></term>
85 <listitem><para>Bus object <parameter>bus</parameter> could not be resolved.</para>
87 <xi:include href="version-info.xml" xpointer="v246"/>
95 <xi:include href="libsystemd-pkgconfig.xml" />
98 <title>History</title>
99 <para><function>sd_bus_set_method_call_timeout()</function> and
100 <function>sd_bus_get_method_call_timeout()</function> were added in version 246.</para>
104 <title>See Also</title>
107 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
108 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
109 <citerefentry><refentrytitle>sd_bus_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>