SD\_VARLINK\_IS\_CONNECTED(3) sd\_varlink\_is\_connected SD\_VARLINK\_IS\_CONNECTED(3)

.SH "NAME" sd\_varlink\_is\_connected, sd\_varlink\_is\_idle - Query if a Varlink connection object is currently connected or idle

.SH "SYNOPSIS"

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

.HP 672u **int sd\_varlink\_is\_connected(sd\_varlink \*link);**

.HP 552u **int sd\_varlink\_is\_idle(sd\_varlink \*link);**

.SH "DESCRIPTION"

.PP **sd\_varlink\_is\_connected()** checks whether the specified Varlink connection object is currently connected or whether it has been fully disconnected already.

.PP **sd\_varlink\_is\_idle()** checks whether the specified Varlink connection object is currently connected but idle, i.e. may accept a method call for enqueuing (if client side of a Varlink connection) or is waiting for more incoming method calls to arrive (if server side of a Varlink connection).

.SH "RETURN VALUE"

.PP If the connection is currently connected **sd\_varlink\_is\_connected()** returns a positive non-zero value. If disconnected it returns 0. If the connection currently is idle **sd\_varlink\_is\_idle()** returns a positive non-zero integer. If not, returns 0. On failure, both functions return a negative *errno* error code.

.SS "Errors"

.PP Returned errors may indicate the following problems:

.PP **-EINVAL**

The specified Varlink connection is invalid.

.RE

.SH "NOTES"

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

.PP The code described here uses [**getenv**(3)](/man/os/systemd/getenv.3), which is declared to be not multi-thread-safe. This means that the code calling the functions described here must not call [**setenv**(3)](/man/os/systemd/setenv.3) 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.

.SH "HISTORY"

.PP **sd\_varlink\_is\_connected()** was added in version 259.

.PP **sd\_varlink\_is\_idle()** was added in version 257.

.SH "SEE ALSO"

.PP [**systemd**(1)](/man/os/systemd/systemd.1), [**sd-varlink**(3)](/man/os/systemd/sd-varlink.3)

systemd 262.2

---

Document: sd_varlink_is_connected(3) from systemd 262.2-r1 (Chainguard OS)
Source: https://github.com/systemd/systemd
