xref: /minix3/minix/lib/libc/sys/svrctl.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc /*	svrctl() - special server control functions.	Author: Kees J. Bot
2*433d6423SLionel Sambuc  *								24 Apr 1994
3*433d6423SLionel Sambuc  */
4*433d6423SLionel Sambuc #include <lib.h>
5*433d6423SLionel Sambuc #include <stdio.h>
6*433d6423SLionel Sambuc #include <string.h>
7*433d6423SLionel Sambuc #include <sys/svrctl.h>
8*433d6423SLionel Sambuc 
9*433d6423SLionel Sambuc int svrctl(int request, void *argp)
10*433d6423SLionel Sambuc {
11*433d6423SLionel Sambuc 	message m;
12*433d6423SLionel Sambuc 
13*433d6423SLionel Sambuc 	memset(&m, 0, sizeof(m));
14*433d6423SLionel Sambuc 	m.m_lsys_svrctl.request = request;
15*433d6423SLionel Sambuc 	m.m_lsys_svrctl.arg = argp;
16*433d6423SLionel Sambuc 
17*433d6423SLionel Sambuc 	switch ((request >> 8) & 0xFF) {
18*433d6423SLionel Sambuc 	case 'M':
19*433d6423SLionel Sambuc 	case 'S':
20*433d6423SLionel Sambuc 		/* PM handles calls for itself and the kernel. */
21*433d6423SLionel Sambuc 		return _syscall(PM_PROC_NR, PM_SVRCTL, &m);
22*433d6423SLionel Sambuc 	case 'F':
23*433d6423SLionel Sambuc 	case 'I':
24*433d6423SLionel Sambuc 		/* VFS handles calls for itself and inet. */
25*433d6423SLionel Sambuc 		return _syscall(VFS_PROC_NR, VFS_SVRCTL, &m);
26*433d6423SLionel Sambuc 	default:
27*433d6423SLionel Sambuc 		errno = EINVAL;
28*433d6423SLionel Sambuc 		return -1;
29*433d6423SLionel Sambuc 	}
30*433d6423SLionel Sambuc }
31