---
name: "sd_bus_slot_get_bus"
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_slot_get_bus"
---

# sd\_bus\_slot\_get\_bus(3)

Query information attached to a bus slot object

## NAME

sd\_bus\_slot\_get\_bus, sd\_bus\_slot\_get\_current\_handler, sd\_bus\_slot\_get\_current\_message, sd\_bus\_slot\_get\_current\_userdata - Query information attached to a bus slot object

## SYNOPSIS

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

**typedef int (\*sd\_bus\_message\_handler\_t)(sd\_bus\_message \****m***, void \****userdata***, sd\_bus\_error \****ret\_error***);**

**sd\_bus \*sd\_bus\_slot\_get\_bus(sd\_bus\_slot \****slot***);**

**sd\_bus\_message\_handler\_t sd\_bus\_slot\_get\_current\_handler(sd\_bus\_slot \****slot***);**

**sd\_bus\_message \*sd\_bus\_slot\_get\_current\_message(sd\_bus\_slot \****slot***);**

**void \*sd\_bus\_slot\_get\_current\_userdata(sd\_bus\_slot \****slot***);**

## DESCRIPTION

**sd\_bus\_slot\_get\_bus()** returns the bus object that message *slot* is attached to.

**sd\_bus\_slot\_get\_current\_handler()**, **sd\_bus\_slot\_get\_current\_message()** and **sd\_bus\_slot\_get\_current\_userdata()** return the current handler, message and userdata respectively of the bus *slot* is attached to if we're currently executing the callback associated with *slot*.

## RETURN VALUE

**sd\_bus\_slot\_get\_bus()** always returns the bus object.

On success, **sd\_bus\_slot\_get\_current\_handler()**, **sd\_bus\_slot\_get\_current\_message()** and **sd\_bus\_slot\_get\_current\_userdata()** return the requested object. On failure, they return **NULL**.

## 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\_slot\_get\_bus()**, **sd\_bus\_slot\_get\_current\_handler()**, **sd\_bus\_slot\_get\_current\_message()**, and **sd\_bus\_slot\_get\_current\_userdata()** were added in version 246.

## SEE ALSO

[**systemd**(1)](/systemd/1.md), [**sd-bus**(3)](/sd-bus/3.md)
