RC_DEPTREE(3)

πŸ“¦
version 0.63.2 Β· 2 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, debian trixie

πŸ’– 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 with rc_deptree_free() when you're done. no leaving it lying around. πŸ™ˆ
  • rc_deptree_depend(), rc_deptree_depends() and rc_deptree_order() β€” these three return a list of services from the deptree, picked by the type (or types) of dependency. options can be a bitmask of RC_DEP_TRACE and RC_DEP_STRICT. and what do those do, you ask? 🧚
    • RC_DEP_TRACE follows each service's dependencies right down to the first service needed. deep dive. main character energy, honestly.
    • RC_DEP_STRICT only 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