rc_deptree - Man Page

RC dependency tree functions

Library

Run Command library (librc, -lrc)

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

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

rc_deptree_update() updates the service dependency tree, normally /lib/rc/init.d/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), free(3), rc_stringlist_free(3), openrc-run(8)

Authors

Roy Marples <roy@marples.name>

Info

March 16, 2008