---
name: "sd_bus_slot_get_current_userdata"
section: "3"
platform: "linux"
package: "libsystemd-dev"
version: "257.13-1~deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/sd_bus_slot_get_bus"
---

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

Query information attached to a bus slot object

Part of [sd\_bus\_slot\_get\_bus(3)](/sd_bus_slot_get_bus/3.md).

## 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.

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)
