---
name: "rc_deptree"
section: "3"
platform: "linux"
package: "librc-dev"
version: "0.56-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rc_deptree"
---

# rc\_deptree(3)

RC dependency tree functions

## NAME

**rc\_deptree\_update**, **rc\_deptree\_update\_needed**, **rc\_deptree\_load**, **rc\_deptree\_depend**, **rc\_deptree\_depends**, **rc\_deptree\_order**, **rc\_deptree\_free** – RC dependency tree functions

## LIBRARY

Run Command library (librc, -lrc)

## SYNOPSIS

**#include \<rc.h\>**

*bool* *Fn* *rc\_deptree\_update* *void*\

*bool* *Fn* *rc\_deptree\_update\_needed* *void*\

*RC\_DEPTREE* *Fn* *rc\_deptree\_load* *void*\

*RC\_STRINGLIST \** *Fo* *rc\_deptree\_depend*\
 *const RC\_DEPTREE \*deptree* *const char \*type* *const char \*service*);

*bool* *Fo* *rc\_deptree\_depends*\
 *const RC\_DEPTREE \*deptree* *const char \*const \*types* *const char \*const \*services* *const char \*runlevel* *int options*);

*RC\_STRINGLIST \** *Fo* *rc\_deptree\_order*\
 *const RC\_DEPTREE \*deptree* *const char \*runlevel* *int options*);

*void* *Fn* *rc\_deptree\_free* *RC\_DEPTREE \*deptree*\

## DESCRIPTION

These functions provide a means of querying the dependencies of OpenRC services.

**rc\_deptree\_update**() updates the service dependency tree, normally */run/openrc/deptree*. **rc\_deptree\_update\_needed**() checks to see if the dependency tree needs updated based on the mtime of it compared to */etc/init.d*, */etc/conf.d*, */usr/local/etc/init.d*, */usr/local/etc/conf.d*, */etc/rc.conf* and any files specified by a service.

**rc\_deptree\_load**() loads the deptree and returns a pointer to it which needs to be freed by **rc\_deptree\_free**() when done.

**rc\_deptree\_depend**(), **rc\_deptree\_depends**() and **rc\_deptree\_order**() return a list of services from the *deptree* based on the *type* or *types* of dependency. *options* can be a bitmask of *RC\_DEP\_TRACE* and *RC\_DEP\_STRICT*. *RC\_DEP\_TRACE* follows each services dependencies right down to the first service needed and *RC\_DEP\_STRICT* only lists services actually needed or in the *runlevel*.

## IMPLEMENTATION NOTES

Each function that returns RC\_STRINGLIST \* should be freed by calling **rc\_stringlist\_free**() when done.

## SEE ALSO

[malloc(3)](/malloc/3.md), [free(3)](/free/3.md), [rc\_stringlist\_free(3)](/rc_stringlist_free/3.md), [openrc-run(8)](/openrc-run/8.md)

## AUTHORS

Roy Marples \<roy@marples.name\>
