Since this is most easily done with a sequence of system commands, the normal and sane way to do this would be with a shell script, so there is no such API. Many linux daemons are (more and less complicated)
bash shell (aka. the
"command language interpreter") scripts that use system commands, which system commands are written in C. Indeed, the bash shell is derived from an older unix power tool called "the C shell", and many "system commands" are actually part of the shell -- they do not have their own executables.
If you do a bit of research into basic system commands you will realize you do not have to write any new ones for this*, so don't bother using C -- it will just be a string of system(), popen(), etc. I would almost bet that you could learn enough bash to do this in less time than it would take to actually write an awkward and probably inefficient (since you must invoke the shell implicitly to do all that) C program. If you don't use system/exec() calls, this will take you years and ten of thousands of lines of code to re-write commands that already exist.
Advanced Bash-Scripting Guide
You can even ask questions here about that; if no one else will answer them, I will...there are some goofy things about the syntax, like it is whitespace sensitive and heavy on braces. But it has regular expressions, functions, arrays, etc.
You're right, this is a root/sys admin task. So it's about the shell. The bash shell. You don't have to write anything in C, it's already written. I promise you, that is how the pros do it and that is what the shell is for.
*check users logged on: use "who", check the time: use "date", to log a user out: use "kill" to kill all the processes with that user ID (maybe you want to send a message first with "write" or "wall"). To delete files: "rm". To wait, "sleep". To fork, "&". To take the output of a such a SHELL command (who, date) and put into an array for further manipulation analysis, for example, is simple in a SHELL script; to do it in C, a real pain in the