Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / usr.bin / trace / ioctl / svrctl.c
blob8708ed221ec8293fb7c78d831d83a18b64ddaa08
2 #include "inc.h"
4 #include <sys/svrctl.h>
6 const char *
7 svrctl_name(unsigned long req)
10 switch (req) {
11 NAME(PMSETPARAM);
12 NAME(PMGETPARAM);
13 NAME(VFSGETPARAM);
14 NAME(VFSSETPARAM);
17 return NULL;
20 int
21 svrctl_arg(struct trace_proc * proc, unsigned long req, void * ptr, int dir)
23 struct sysgetenv *env;
25 switch (req) {
26 case PMSETPARAM:
27 case VFSSETPARAM:
28 if ((env = (struct sysgetenv *)ptr) == NULL)
29 return IF_OUT;
31 put_buf(proc, "key", PF_STRING, (vir_bytes)env->key,
32 env->keylen);
33 put_buf(proc, "value", PF_STRING, (vir_bytes)env->val,
34 env->vallen);
35 return IF_ALL;
37 case PMGETPARAM:
38 case VFSGETPARAM:
39 if ((env = (struct sysgetenv *)ptr) == NULL)
40 return IF_OUT | IF_IN;
43 * So far this is the only IOCTL case where the output depends
44 * on one of the values in the input: if the given key is NULL,
45 * PM provides the entire system environment in return, which
46 * means we cannot just print a single string. We rely on PM
47 * not changing the key field, which (while true) is an
48 * assumption. With the current (simple) model we would have
49 * to save the provided key pointer somewhere otherwise.
51 if (dir == IF_OUT)
52 put_buf(proc, "key", PF_STRING, (vir_bytes)env->key,
53 env->keylen);
54 else
55 put_buf(proc, "value",
56 (env->key != NULL) ? PF_STRING : 0,
57 (vir_bytes)env->val, env->vallen);
58 return IF_ALL;
60 default:
61 return 0;