1<?xml version='1.0'?>
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 -->
5
6<refentry id="sd_bus_set_method_call_timeout" xmlns:xi="http://www.w3.org/2001/XInclude">
7
8  <refentryinfo>
9    <title>sd_bus_set_method_call_timeout</title>
10    <productname>systemd</productname>
11  </refentryinfo>
12
13  <refmeta>
14    <refentrytitle>sd_bus_set_method_call_timeout</refentrytitle>
15    <manvolnum>3</manvolnum>
16  </refmeta>
17
18  <refnamediv>
19    <refname>sd_bus_set_method_call_timeout</refname>
20    <refname>sd_bus_get_method_call_timeout</refname>
21
22    <refpurpose>Set or query the default D-Bus method call timeout of a bus object</refpurpose>
23  </refnamediv>
24
25  <refsynopsisdiv>
26    <funcsynopsis>
27      <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
28
29      <funcprototype>
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>
33      </funcprototype>
34
35      <funcprototype>
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>
39      </funcprototype>
40    </funcsynopsis>
41  </refsynopsisdiv>
42
43  <refsect1>
44    <title>Description</title>
45
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>
48
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.
58    </para>
59  </refsect1>
60
61  <refsect1>
62    <title>Return Value</title>
63
64    <para>On success, these functions return a non-negative integer. On failure, they return a
65    negative errno-style error code.</para>
66
67    <refsect2>
68      <title>Errors</title>
69
70      <para>Returned errors may indicate the following problems:</para>
71
72      <variablelist>
73        <varlistentry>
74          <term><constant>-EINVAL</constant></term>
75
76          <listitem><para>The parameters <parameter>bus</parameter> or <parameter>ret</parameter>
77          are <constant>NULL</constant>.</para></listitem>
78        </varlistentry>
79
80        <varlistentry>
81          <term><constant>-ENOPKG</constant></term>
82
83          <listitem><para>Bus object <parameter>bus</parameter> could not be resolved.</para>
84          </listitem>
85        </varlistentry>
86      </variablelist>
87
88    </refsect2>
89  </refsect1>
90
91  <xi:include href="libsystemd-pkgconfig.xml" />
92
93  <refsect1>
94    <title>See Also</title>
95
96    <para>
97      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
98      <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
99      <citerefentry><refentrytitle>sd_bus_call</refentrytitle><manvolnum>3</manvolnum></citerefentry>
100    </para>
101  </refsect1>
102
103</refentry>
104