phunix/minix/lib/libc/sys/svrctl.c
David van Moolenbroek f737eea636 svrctl(2) update
- synchronize request type with ioctl by making it unsigned long;
- unbreak VFS requests, as they were being sent to PM;
- use proper ioctl direction flags (and new numbers) for requests;
- remove some needless header inclusions;
- svrctl is in libc, make its message name reflect this;
- keep backward compatibility: svrctl is part of the userland ABI.

Change-Id: I44902e8d0d11b8ebc1ef3bda94d2202481743c9b
2014-09-29 16:15:21 +00:00

28 lines
587 B
C

/* svrctl() - special server control functions. Author: Kees J. Bot
* 24 Apr 1994
*/
#include <lib.h>
#include <stdio.h>
#include <string.h>
#include <sys/svrctl.h>
int svrctl(unsigned long request, void *argp)
{
message m;
memset(&m, 0, sizeof(m));
m.m_lc_svrctl.request = request;
m.m_lc_svrctl.arg = (vir_bytes)argp;
switch (IOCGROUP(request)) {
case 'M': /* old, phasing out */
case 'P': /* to PM */
return _syscall(PM_PROC_NR, PM_SVRCTL, &m);
case 'F': /* to VFS */
return _syscall(VFS_PROC_NR, VFS_SVRCTL, &m);
default:
errno = EINVAL;
return -1;
}
}