xref: /minix3/minix/lib/libc/sys/svrctl.c (revision f737eea6368426d3302d0075f13f73c4bc646e24)
1433d6423SLionel Sambuc /*	svrctl() - special server control functions.	Author: Kees J. Bot
2433d6423SLionel Sambuc  *								24 Apr 1994
3433d6423SLionel Sambuc  */
4433d6423SLionel Sambuc #include <lib.h>
5433d6423SLionel Sambuc #include <stdio.h>
6433d6423SLionel Sambuc #include <string.h>
7433d6423SLionel Sambuc #include <sys/svrctl.h>
8433d6423SLionel Sambuc 
svrctl(unsigned long request,void * argp)9*f737eea6SDavid van Moolenbroek int svrctl(unsigned long request, void *argp)
10433d6423SLionel Sambuc {
11433d6423SLionel Sambuc 	message m;
12433d6423SLionel Sambuc 
13433d6423SLionel Sambuc 	memset(&m, 0, sizeof(m));
14*f737eea6SDavid van Moolenbroek 	m.m_lc_svrctl.request = request;
15*f737eea6SDavid van Moolenbroek 	m.m_lc_svrctl.arg = (vir_bytes)argp;
16433d6423SLionel Sambuc 
17*f737eea6SDavid van Moolenbroek 	switch (IOCGROUP(request)) {
18*f737eea6SDavid van Moolenbroek 	case 'M': /* old, phasing out */
19*f737eea6SDavid van Moolenbroek 	case 'P': /* to PM */
20433d6423SLionel Sambuc 		return _syscall(PM_PROC_NR, PM_SVRCTL, &m);
21*f737eea6SDavid van Moolenbroek 	case 'F': /* to VFS */
22433d6423SLionel Sambuc 		return _syscall(VFS_PROC_NR, VFS_SVRCTL, &m);
23433d6423SLionel Sambuc 	default:
24433d6423SLionel Sambuc 		errno = EINVAL;
25433d6423SLionel Sambuc 		return -1;
26433d6423SLionel Sambuc 	}
27433d6423SLionel Sambuc }
28