---
name: "sd_bus_set_method_call_timeout"
section: "3"
platform: "linux"
package: "systemd-libs"
version: "262.1-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/sd_bus_set_method_call_timeout"
---

# sd\_bus\_set\_method\_call\_timeout(3)

Set or query the default D-Bus method call timeout of a bus object

## NAME

sd\_bus\_set\_method\_call\_timeout, sd\_bus\_get\_method\_call\_timeout - Set or query the default D-Bus method call timeout of a bus object

## SYNOPSIS

```
#include <systemd/sd-bus.h>
```

**int sd\_bus\_set\_method\_call\_timeout(sd\_bus \****bus***, uint64\_t** *usec***);**

**int sd\_bus\_get\_method\_call\_timeout(sd\_bus \****bus***, uint64\_t \****ret***);**

## DESCRIPTION

**sd\_bus\_set\_method\_call\_timeout()** sets the default D-Bus method call timeout of *bus* to *usec* microseconds.

**sd\_bus\_get\_method\_call\_timeout()** queries the default D-Bus method call timeout of *bus*. If no method call timeout was set using **sd\_bus\_set\_method\_call\_timeout()**, the timeout is read from the *$SYSTEMD\_BUS\_TIMEOUT* environment variable. If this environment variable is unset or does not contain a valid timeout, the implementation falls back to a predefined method call timeout of 25 seconds. Note that *$SYSTEMD\_BUS\_TIMEOUT* is read once and cached so callers should not rely on being able to change the default method call timeout at runtime by changing the value of *$SYSTEMD\_BUS\_TIMEOUT*. Instead, call **sd\_bus\_set\_method\_call\_timeout()** to change the default method call timeout.

## RETURN VALUE

On success, these functions return a non-negative integer. On failure, they return a negative errno-style error code.

### Errors

Returned errors may indicate the following problems:

**-EINVAL**

The parameters *bus* or *ret* are **NULL**.

Added in version 246.

**-ENOPKG**

Bus object *bus* could not be resolved.

Added in version 246.

## NOTES

Functions described here are available as a shared library, which can be compiled against and linked to with the **libsystemd** [**pkg-config**(1)](/pkg-config/1.md) file.

All functions listed here are thread-agnostic and only a single thread may operate on a given object at any given time. Different threads may access the same object at different times. Multiple independent objects may be used from different threads in parallel.

The code described here uses [**getenv**(3)](/getenv/3.md), which is declared to be not multi-thread-safe. This means that the code calling the functions described here must not call [**setenv**(3)](/setenv/3.md) from a parallel thread. It is recommended to only do calls to **setenv()** from an early phase of the program when no other threads have been started.

## HISTORY

**sd\_bus\_set\_method\_call\_timeout()** and **sd\_bus\_get\_method\_call\_timeout()** were added in version 246.

## SEE ALSO

[**systemd**(1)](/systemd/1.md), [**sd-bus**(3)](/sd-bus/3.md), [**sd\_bus\_call**(3)](/sd_bus_call/3.md)
