RC_DEPTREE(3)
π NAME π
ok so bestie, gather round, because this is the RC dependency tree functions page β rc_deptree_update, rc_deptree_update_needed, rc_deptree_load, rc_deptree_depend, rc_deptree_depends, rc_deptree_order and rc_deptree_free, all living their best lives in RC_DEPTREE(3). seven little icons, one big job: telling you who depends on who. no cap. β¨
π LIBRARY π
Run Command library β that's librc, and you link it with -lrc. periodt. π
πΈ 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);
like, look at them. signatures serving immaculate C energy. π«Ά
π¦ DESCRIPTION π¦
okay so basically, these functions are your little backstage pass for asking questions about OpenRC service dependencies. that's the whole vibe. π
rc_deptree_update()β updates the service dependency tree, which normally chills at/run/openrc/deptree. it's giving "refresh the lore". π₯rc_deptree_update_needed()β checks whether the dependency tree actually needs updating, by comparing the mtime of the tree against the mtimes of/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. so it's the friend who goes "do we actually need to redo this, orβ¦" πrc_deptree_load()β loads the deptree and hands you back a pointer to it. and bestie, that pointer is yours to clean up β you must free it withrc_deptree_free()when you're done. no leaving it lying around. πrc_deptree_depend(),rc_deptree_depends()andrc_deptree_order()β these three return a list of services from the deptree, picked by the type (or types) of dependency.optionscan be a bitmask ofRC_DEP_TRACEandRC_DEP_STRICT. and what do those do, you ask? π§RC_DEP_TRACEfollows each service's dependencies right down to the first service needed. deep dive. main character energy, honestly.RC_DEP_STRICTonly lists services that are actually needed, or that are in the runlevel. it's the "we're keeping this list tight" option. π
π IMPLEMENTATION NOTES π
every function that returns RC_STRINGLIST * needs to be freed by calling rc_stringlist_free() when you're done with it. that's not optional, that's a warning, okay?
not freeing your string lists is giving memory leak. and a memory leak is NOT the vibe. clean up after yourself, bestie. π§Ήβ¨
π SEE ALSO π
malloc(3), free(3), rc_stringlist_free(3), openrc-run(8)
(go read them. they're the supporting cast and they ate. π)
π AUTHORS π
Roy Marples <roy@marples.name> β the actual legend behind this whole thing. π
and that's the page!! from the OpenRC era, dated Mar 16, 2008, manual section RC_DEPTREE(3) β yeah she's vintage but she still slays, fr fr. π¦β¨π
π¦ where this page comes from
- alpine 3.22: openrc-doc 0.62.6-r0 Β· BSD-2-Clause
- alpine 3.23: openrc-doc 0.63-r1 Β· BSD-2-Clause
- alpine 3.24: openrc-doc 0.63.2-r0 Β· BSD-2-Clause
- debian trixie: librc-dev 0.56-1 Β· BSD-2-clauses
- Copyright (c) 2007-2015 The OpenRC Authors
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms