4 #include <sys/svrctl.h>
7 svrctl_name(unsigned long req
)
21 svrctl_arg(struct trace_proc
* proc
, unsigned long req
, void * ptr
, int dir
)
23 struct sysgetenv
*env
;
28 if ((env
= (struct sysgetenv
*)ptr
) == NULL
)
31 put_buf(proc
, "key", PF_STRING
, (vir_bytes
)env
->key
,
33 put_buf(proc
, "value", PF_STRING
, (vir_bytes
)env
->val
,
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.
52 put_buf(proc
, "key", PF_STRING
, (vir_bytes
)env
->key
,
55 put_buf(proc
, "value",
56 (env
->key
!= NULL
) ? PF_STRING
: 0,
57 (vir_bytes
)env
->val
, env
->vallen
);