1 /* The kernel call implemented in this file:
4 * The parameters for this kernel call are:
6 * and then request-specific arguments in SYSCTL_ARG1 and SYSCTL_ARG2.
9 #include "kernel/system.h"
12 /*===========================================================================*
14 *===========================================================================*/
15 int do_sysctl(struct proc
* caller
, message
* m_ptr
)
18 static char mybuf
[DIAG_BUFSIZE
];
21 switch (m_ptr
->SYSCTL_CODE
) {
22 case SYSCTL_CODE_DIAG
:
23 buf
= (vir_bytes
) m_ptr
->SYSCTL_ARG1
;
24 len
= (vir_bytes
) m_ptr
->SYSCTL_ARG2
;
25 if(len
< 1 || len
> DIAG_BUFSIZE
) {
26 printf("do_sysctl: diag for %d: len %d out of range\n",
27 caller
->p_endpoint
, len
);
30 if((s
=data_copy_vmcheck(caller
, caller
->p_endpoint
, buf
, KERNEL
,
31 (vir_bytes
) mybuf
, len
)) != OK
) {
32 printf("do_sysctl: diag for %d: len %d: copy failed: %d\n",
33 caller
->p_endpoint
, len
, s
);
36 for(i
= 0; i
< len
; i
++)
40 case SYSCTL_CODE_STACKTRACE
:
41 if(!isokendpt(m_ptr
->SYSCTL_ARG2
, &proc_nr
))
43 proc_stacktrace(proc_addr(proc_nr
));
46 printf("do_sysctl: invalid request %d\n", m_ptr
->SYSCTL_CODE
);