Luna/libs/libc/src/luna/pstat.cpp
apio d93a4062a2 libc: Do not use the heavy variadic syscall() function for wrappers
That function is meant more for user programs, and should still be rarely used, since it's not portable.
Instead, we already know the number of arguments. We just call __lc_fast_syscallN, which also sets errno.
2022-10-27 17:42:00 +02:00

24 lines
557 B
C++

#include <luna/pstat.h>
#include <luna/syscall.h>
#include <sys/syscall.h>
extern "C"
{
pid_t pstat(pid_t pid, struct pstat* buf)
{
return __lc_fast_syscall2(SYS_pstat, pid, buf);
}
const char* pstatname(struct pstat* buf)
{
switch (buf->pt_state)
{
case PT_IDLE: return "Idle";
case PT_RUNNING: return "Running";
case PT_SLEEPING: return "Sleeping";
case PT_WAITING: return "Waiting";
case PT_ZOMBIE: return "Zombie";
default: return "Unknown";
}
}
}