---
name: "sd_bus_get_property_strv"
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_set_property"
---

# sd\_bus\_get\_property\_strv(3)

Set or query D-Bus service properties

Part of [sd\_bus\_set\_property(3)](/sd_bus_set_property/3.md).

## NAME

sd\_bus\_set\_property, sd\_bus\_set\_propertyv, sd\_bus\_get\_property, sd\_bus\_get\_property\_trivial, sd\_bus\_get\_property\_string, sd\_bus\_get\_property\_strv - Set or query D-Bus service properties

## SYNOPSIS

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

**int sd\_bus\_set\_property(sd\_bus \****bus***, const char \****destination***, const char \****path***, const char \****interface***, const char \****member***, sd\_bus\_error \****ret\_error***, const char \****type***, ...);**

**int sd\_bus\_set\_propertyv(sd\_bus \****bus***, const char \****destination***, const char \****path***, const char \****interface***, const char \****member***, sd\_bus\_error \****ret\_error***, const char \****type***, va\_list** *ap***);**

**int sd\_bus\_get\_property(sd\_bus \****bus***, const char \****destination***, const char \****path***, const char \****interface***, const char \****member***, sd\_bus\_error \****ret\_error***, sd\_bus\_message \*\****reply***, const char \****type***);**

**int sd\_bus\_get\_property\_trivial(sd\_bus \****bus***, const char \****destination***, const char \****path***, const char \****interface***, const char \****member***, sd\_bus\_error \****ret\_error***, char** *type***, void \****ret\_ptr***);**

**int sd\_bus\_get\_property\_string(sd\_bus \****bus***, const char \****destination***, const char \****path***, const char \****interface***, const char \****member***, sd\_bus\_error \****ret\_error***, char \*\****ret***);**

**int sd\_bus\_get\_property\_strv(sd\_bus \****bus***, const char \****destination***, const char \****path***, const char \****interface***, const char \****member***, sd\_bus\_error \****ret\_error***, char \*\*\****ret***);**

## DESCRIPTION

These functions set or query D-Bus properties. D-Bus properties are service fields exposed via the **org.freedesktop.DBus.Properties** interface. Under the hood, these functions call methods of the **org.freedesktop.DBus.Properties** interface and as a result their semantics are similar to [**sd\_bus\_call\_method**(3)](/sd_bus_call_method/3.md).

**sd\_bus\_set\_property()** sets a D-Bus property. If setting the property fails or an internal error occurs, an error is returned and an extended description of the error is optionally stored in *ret\_error* if it is not **NULL**. *type* and the arguments that follow it describe the new value of the property and must follow the format described in [**sd\_bus\_message\_append**(3)](/sd_bus_message_append/3.md).

**sd\_bus\_set\_propertyv()** is equivalent to **sd\_bus\_set\_property()**, except that it is called with a "va\_list" instead of a variable number of arguments.

**sd\_bus\_get\_property()** queries a D-Bus property. If retrieving the property fails or an internal error occurs, an error is returned and an extended description of the error is optionally stored in *ret\_error* if it is not **NULL**. On success, the property is stored in *reply*. *type* describes the property type and must follow the format described in [**sd\_bus\_message\_append**(3)](/sd_bus_message_append/3.md).

**sd\_bus\_get\_property\_trivial()**, **sd\_bus\_get\_property\_string()** and **sd\_bus\_get\_property\_strv()** are shorthands for **sd\_bus\_get\_property()** that are used to query basic, string and string vector properties respectively. The caller is responsible for freeing the string and string vector results stored in *ret* by **sd\_bus\_get\_property\_string()** and **sd\_bus\_get\_property\_strv()**.

## RETURN VALUE

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

### Errors

See the [**sd\_bus\_call\_method**(3)](/sd_bus_call_method/3.md) man page for a list of possible errors.

## 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\_set\_property()**, **sd\_bus\_set\_propertyv()**, **sd\_bus\_get\_property()**, **sd\_bus\_get\_property\_trivial()**, **sd\_bus\_get\_property\_string()**, and **sd\_bus\_get\_property\_strv()** were added in version 246.

## SEE ALSO

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