---
name: "sd_bus_get_owner_creds"
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_get_name_creds"
---

# sd\_bus\_get\_owner\_creds(3)

Query bus client credentials

Part of [sd\_bus\_get\_name\_creds(3)](/sd_bus_get_name_creds/3.md).

## NAME

sd\_bus\_get\_name\_creds, sd\_bus\_get\_owner\_creds - Query bus client credentials

## SYNOPSIS

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

**int sd\_bus\_get\_name\_creds(sd\_bus \****bus***, const char \****name***, uint64\_t** *mask***, sd\_bus\_creds \*\****creds***);**

**int sd\_bus\_get\_owner\_creds(sd\_bus \****bus***, uint64\_t** *mask***, sd\_bus\_creds \*\****creds***);**

## DESCRIPTION

**sd\_bus\_get\_name\_creds()** queries the credentials of the bus client identified by *name*. The *mask* parameter is a combo of **SD\_BUS\_CREDS\_\*** flags that indicate which credential info the caller is interested in. See [**sd\_bus\_creds\_new\_from\_pid**(3)](/sd_bus_creds_new_from_pid/3.md) for a list of possible flags. On success, *creds* contains a new sd\_bus\_creds instance with the requested information. Ownership of this instance belongs to the caller and it should be freed once no longer needed by calling [**sd\_bus\_creds\_unref**(3)](/sd_bus_creds_unref/3.md).

**sd\_bus\_get\_owner\_creds()** queries the credentials of the creator of the given bus. The *mask* and *creds* parameters behave the same as in **sd\_bus\_get\_name\_creds()**.

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

An argument is invalid.

**-ENOPKG**

The bus cannot be resolved.

**-EPERM**

The bus has already been started.

**-ECHILD**

The bus was created in a different process, library or module instance.

**-ENOMEM**

Memory allocation failed.

## 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\_get\_name\_creds()** and **sd\_bus\_get\_owner\_creds()** were added in version 221.

## SEE ALSO

[**systemd**(1)](/systemd/1.md), [**sd-bus**(3)](/sd-bus/3.md), [**sd\_bus\_creds\_unref**(3)](/sd_bus_creds_unref/3.md)
