RC\_DEPTREE(3) Library Functions Manual (smm) RC\_DEPTREE(3)

# [NAME](#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](#LIBRARY)

Run Command library (librc, -lrc)

# [SYNOPSIS](#SYNOPSIS)

`#include <rc.h>`

`bool`  
`rc_deptree_update`(`void`);

`bool`  
`rc_deptree_update_needed`(`void`);

`RC_DEPTREE`  
`rc_deptree_load`(`void`);

`RC_STRINGLIST *`  
`rc_deptree_depend`(`const RC_DEPTREE *deptree`, `const char *type`, `const char *service`);

`bool`  
`rc_deptree_depends`(`const RC_DEPTREE *deptree`, `const char *const *types`, `const char *const *services`, `const char *runlevel`, `int options`);

`RC_STRINGLIST *`  
`rc_deptree_order`(`const RC_DEPTREE *deptree`, `const char *runlevel`, `int options`);

`void`  
`rc_deptree_free`(`RC_DEPTREE *deptree`);

# [DESCRIPTION](#DESCRIPTION)

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

[`rc_deptree_update`](#rc_deptree_update)() updates the service dependency tree, normally /run/openrc/deptree. [`rc_deptree_update_needed`](#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`](#rc_deptree_load)() loads the deptree and returns a pointer to it which needs to be freed by [`rc_deptree_free`](#rc_deptree_free)() when done.

[`rc_deptree_depend`](#rc_deptree_depend)(), [`rc_deptree_depends`](#rc_deptree_depends)() and [`rc_deptree_order`](#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](#IMPLEMENTATION_NOTES)

Each function that returns *RC\_STRINGLIST \** should be freed by calling `rc_stringlist_free`() when done.

# [SEE ALSO](#SEE_ALSO)

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

# [AUTHORS](#AUTHORS)

Roy Marples &lt;roy@marples.name&gt;

March 16, 2008 OpenRC

---

Document: rc_deptree_order(3) from openrc 0.64.1-r0 (Chainguard OS)
Source: https://github.com/OpenRC/openrc
