---
name: "rc_runlevel"
section: "3"
platform: "linux"
package: "librc-dev"
version: "0.56-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rc_runlevel"
---

# rc\_runlevel(3)

RC runlevel functions

## NAME

**rc\_runlevel\_get**, **rc\_runlevel\_exists**, **rc\_runlevel\_list**, **rc\_runlevel\_set**, **rc\_runlevel\_starting**, **rc\_runlevel\_stopping** – RC runlevel functions

## LIBRARY

Run Command library (librc, -lrc)

## SYNOPSIS

**#include \<rc.h\>**

*char \** *Fn* *rc\_runlevel\_get* *void*\

*bool* *Fn* *rc\_runlevel\_exists*\

*RC\_STRINGLIST \** *Fn* *rc\_runlevel\_list* *void*\

*bool* *Fn* *rc\_runlevel\_set* *const char \*runlevel*\

*bool* *Fn* *rc\_runlevel\_starting* *void*\

*bool* *Fn* *rc\_runlevel\_stopping* *void*\

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

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

*/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

[malloc(3)](/malloc/3.md), [free(3)](/free/3.md) [rc\_stringlist\_free(3)](/rc_stringlist_free/3.md)

## AUTHORS

Roy Marples \<roy@marples.name\>
