mirror of
https://github.com/troglobit/finit.git
synced 2026-10-31 13:00:32 +00:00
Use finit API to get runlevel instead of utmp
utmp is not available with musl libc
This commit is contained in:
1 parent
f7f222c924
commit
1177c734ce
5 files changed
+42
-18
No files matched your search
@@ -58,23 +58,6 @@ void runlevel_set(int pre, int now)
|
||||
endutent();
|
||||
}
|
||||
|
||||
int runlevel_get(void)
|
||||
{
|
||||
int lvl = '?'; /* Non-existing runlevel */
|
||||
struct utmp *utent;
|
||||
|
||||
setutent();
|
||||
while ((utent = getutent())) {
|
||||
if (utent->ut_type == RUN_LVL) {
|
||||
lvl = utent->ut_pid & 0xFF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
endutent();
|
||||
|
||||
return lvl - '0';
|
||||
}
|
||||
|
||||
/**
|
||||
* runlevel_string - Convert a bit encoded runlevel to .conf syntax
|
||||
* @levels: Bit encoded runlevels
|
||||
|
||||
Reference in new issue
Block a user