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

# [NAME](#NAME)

`rc_runlevel_get`, `rc_runlevel_exists`, `rc_runlevel_list`, `rc_runlevel_set`, `rc_runlevel_starting`, `rc_runlevel_stopping` — RC runlevel functions

# [LIBRARY](#LIBRARY)

Run Command library (librc, -lrc)

# [SYNOPSIS](#SYNOPSIS)

`#include <rc.h>`

`char *`  
`rc_runlevel_get`(`void`);

`bool`  
`rc_runlevel_exists`();

`RC_STRINGLIST *`  
`rc_runlevel_list`(`void`);

`bool`  
`rc_runlevel_set`(`const char *runlevel`);

`bool`  
`rc_runlevel_starting`(`void`);

`bool`  
`rc_runlevel_stopping`(`void`);

# [DESCRIPTION](#DESCRIPTION)

These functions provide a means of querying OpenRC to find out which runlevel we are in and what services are in which runlevel.

# [IMPLEMENTATION NOTES](#IMPLEMENTATION_NOTES)

Each function that returns *char \** returns a malloced NULL terminated string that should be freed when done.

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

# [FILES](#FILES)

/etc/init.d/functions.sh is provided by OpenRC, which allows shell scripts to use the above functions. For historical reasons our verbose functions are prefixed with v instead of suffixed. So einfov becomes veinfo, einfovn becomes veinfon. Rinse and repeat for the other verbose functions.

# [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)

# [AUTHORS](#AUTHORS)

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

March 16, 2008 OpenRC

---

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