# define SYS_SETTIME (KERNEL_CALL + 40) /* sys_settime() */
# define SYS_VMCTL (KERNEL_CALL + 43) /* sys_vmctl() */
-# define SYS_SYSCTL (KERNEL_CALL + 44) /* sys_sysctl() */
+
+# define SYS_DIAGCTL (KERNEL_CALL + 44) /* sys_diagctl() */
# define SYS_VTIMER (KERNEL_CALL + 45) /* sys_vtimer() */
# define SYS_RUNCTL (KERNEL_CALL + 46) /* sys_runctl() */
#define SYS_BASIC_CALLS \
SYS_EXIT, SYS_SAFECOPYFROM, SYS_SAFECOPYTO, SYS_VSAFECOPY, SYS_GETINFO, \
SYS_TIMES, SYS_SETALARM, SYS_SETGRANT, \
- SYS_PROFBUF, SYS_SYSCTL, SYS_STATECTL, SYS_SAFEMEMSET
+ SYS_PROFBUF, SYS_DIAGCTL, SYS_STATECTL, SYS_SAFEMEMSET
/* Field names for SYS_MEMSET. */
#define MEM_PTR m2_p1 /* base */
#define VMCTL_CLEARMAPCACHE 32
#define VMCTL_BOOTINHIBIT_CLEAR 33
-/* Codes and field names for SYS_SYSCTL. */
-#define SYSCTL_CODE m1_i1 /* SYSCTL_CODE_* below */
-#define SYSCTL_ARG1 m1_p1
-#define SYSCTL_ARG2 m1_i2
-#define SYSCTL_CODE_DIAG 1 /* Print diagnostics. */
-#define SYSCTL_CODE_STACKTRACE 2 /* Print process stack. */
+/* Codes and field names for SYS_DIAGCTL. */
+#define DIAGCTL_CODE m1_i1 /* DIAGCTL_CODE_* below */
+#define DIAGCTL_ARG1 m1_p1
+#define DIAGCTL_ARG2 m1_i2
+#define DIAGCTL_CODE_DIAG 1 /* Print diagnostics. */
+#define DIAGCTL_CODE_STACKTRACE 2 /* Print process stack. */
#define DIAG_BUFSIZE (80*25)
/* Field names for SYS_VTIMER. */
int sys_readbios(phys_bytes address, void *buf, size_t size);
int sys_settime(int now, clockid_t clk_id, time_t sec, long nsec);
int sys_stime(time_t boottime);
-int sys_sysctl(int ctl, char *arg1, int arg2);
-int sys_sysctl_stacktrace(endpoint_t who);
+int sys_diagctl(int ctl, char *arg1, int arg2);
+int sys_diagctl_stacktrace(endpoint_t who);
int sys_vmctl_get_mapping(int index, phys_bytes *addr, phys_bytes *len,
int *flags);
int sys_vmctl_reply_mapping(int index, vir_bytes addr);
int verify_grant(endpoint_t, endpoint_t, cp_grant_id_t, vir_bytes, int,
vir_bytes, vir_bytes *, endpoint_t *);
-/* system/do_sysctl.c */
-int do_sysctl(struct proc * caller, message *m);
+/* system/do_diagctl.c */
+int do_diagctl(struct proc * caller, message *m);
#if SPROFILE
/* profile.c */
/* System control. */
map(SYS_ABORT, do_abort); /* abort MINIX */
map(SYS_GETINFO, do_getinfo); /* request system information */
- map(SYS_SYSCTL, do_sysctl); /* misc system manipulation */
+ map(SYS_DIAGCTL, do_diagctl); /* diagnostics-related functionality */
/* Profiling. */
map(SYS_SPROF, do_sprofile); /* start/stop statistical profiling */
do_privctl.c \
do_safecopy.c \
do_safememset.c \
- do_sysctl.c \
+ do_diagctl.c \
do_getksig.c \
do_endksig.c \
do_kill.c \
/* The kernel call implemented in this file:
- * m_type: SYS_SYSCTL
+ * m_type: SYS_DIAGCTL
*
* The parameters for this kernel call are:
- * SYSCTL_CODE request
- * and then request-specific arguments in SYSCTL_ARG1 and SYSCTL_ARG2.
+ * DIAGCTL_CODE request
+ * and then request-specific arguments in DIAGCTL_ARG1 and DIAGCTL_ARG2.
*/
#include "kernel/system.h"
/*===========================================================================*
- * do_sysctl *
+ * do_diagctl *
*===========================================================================*/
-int do_sysctl(struct proc * caller, message * m_ptr)
+int do_diagctl(struct proc * caller, message * m_ptr)
{
vir_bytes len, buf;
static char mybuf[DIAG_BUFSIZE];
int s, i, proc_nr;
- switch (m_ptr->SYSCTL_CODE) {
- case SYSCTL_CODE_DIAG:
- buf = (vir_bytes) m_ptr->SYSCTL_ARG1;
- len = (vir_bytes) m_ptr->SYSCTL_ARG2;
+ switch (m_ptr->DIAGCTL_CODE) {
+ case DIAGCTL_CODE_DIAG:
+ buf = (vir_bytes) m_ptr->DIAGCTL_ARG1;
+ len = (vir_bytes) m_ptr->DIAGCTL_ARG2;
if(len < 1 || len > DIAG_BUFSIZE) {
- printf("do_sysctl: diag for %d: len %d out of range\n",
+ printf("do_diagctl: diag for %d: len %d out of range\n",
caller->p_endpoint, len);
return EINVAL;
}
if((s=data_copy_vmcheck(caller, caller->p_endpoint, buf, KERNEL,
(vir_bytes) mybuf, len)) != OK) {
- printf("do_sysctl: diag for %d: len %d: copy failed: %d\n",
+ printf("do_diagctl: diag for %d: len %d: copy failed: %d\n",
caller->p_endpoint, len, s);
return s;
}
kputc(mybuf[i]);
kputc(END_OF_KMESS);
return OK;
- case SYSCTL_CODE_STACKTRACE:
- if(!isokendpt(m_ptr->SYSCTL_ARG2, &proc_nr))
+ case DIAGCTL_CODE_STACKTRACE:
+ if(!isokendpt(m_ptr->DIAGCTL_ARG2, &proc_nr))
return EINVAL;
proc_stacktrace(proc_addr(proc_nr));
return OK;
default:
- printf("do_sysctl: invalid request %d\n", m_ptr->SYSCTL_CODE);
+ printf("do_diagctl: invalid request %d\n", m_ptr->DIAGCTL_CODE);
return(EINVAL);
}
}
sys_abort.c \
sys_clear.c \
sys_cprof.c \
+ sys_diagctl.c \
sys_endsig.c \
sys_exec.c \
sys_exit.c \
sys_sprof.c \
sys_statectl.c \
sys_stime.c \
- sys_sysctl.c \
sys_times.c \
sys_trace.c \
sys_umap.c \
static int buf_count; /* # characters in the buffer */
if ((c == 0 && buf_count > 0) || buf_count == sizeof(print_buf)) {
- sys_sysctl(SYSCTL_CODE_DIAG, print_buf, buf_count);
+ sys_diagctl(DIAGCTL_CODE_DIAG, print_buf, buf_count);
buf_count = 0;
}
if (c != 0) {
--- /dev/null
+
+#include "syslib.h"
+
+int sys_diagctl(int code, char *arg1, int arg2)
+{
+ message m;
+
+ m.DIAGCTL_CODE = code;
+ m.DIAGCTL_ARG1 = arg1;
+ m.DIAGCTL_ARG2 = arg2;
+
+ return(_kernel_call(SYS_DIAGCTL, &m));
+}
+
+int sys_diagctl_stacktrace(endpoint_t ep)
+{
+ return sys_diagctl(DIAGCTL_CODE_STACKTRACE, NULL, ep);
+}
+
+++ /dev/null
-
-#include "syslib.h"
-
-int sys_sysctl(int code, char *arg1, int arg2)
-{
- message m;
-
- m.SYSCTL_CODE = code;
- m.SYSCTL_ARG1 = arg1;
- m.SYSCTL_ARG2 = arg2;
-
- return(_kernel_call(SYS_SYSCTL, &m));
-
-}
-
-int sys_sysctl_stacktrace(endpoint_t ep)
-{
- return sys_sysctl(SYSCTL_CODE_STACKTRACE, NULL, ep);
-}
-
PROCLOOP(rp, oldrp)
PRINTRTS(rp);
printf("\n"); pagelines++;
- sys_sysctl_stacktrace(rp->p_endpoint);
+ sys_diagctl_stacktrace(rp->p_endpoint);
}
}
{
printf("PM: unauthorized call of do_getsysinfo by proc %d '%s'\n",
mp->mp_endpoint, mp->mp_name);
- sys_sysctl_stacktrace(mp->mp_endpoint);
+ sys_diagctl_stacktrace(mp->mp_endpoint);
return EPERM;
}
printf("PM: unauthorized call of do_getprocnr by proc %d\n",
mp->mp_endpoint);
- sys_sysctl_stacktrace(mp->mp_endpoint);
+ sys_diagctl_stacktrace(mp->mp_endpoint);
return EPERM;
}
if (mp->mp_effuid != 0) {
printf("PM: unauthorized call of do_getepinfo_o by proc %d\n",
mp->mp_endpoint);
- sys_sysctl_stacktrace(mp->mp_endpoint);
+ sys_diagctl_stacktrace(mp->mp_endpoint);
return EPERM;
}
/* Print stacktrace if necessary. */
if(SIGS_IS_STACKTRACE(signo)) {
- sys_sysctl_stacktrace(rmp->mp_endpoint);
+ sys_diagctl_stacktrace(rmp->mp_endpoint);
}
if(!SIGS_IS_TERMINATION(signo)) {
if(!(rmp->mp_flags & PRIV_PROC)) {
printf("PM: coredump signal %d for %d / %s\n", signo,
rmp->mp_pid, rmp->mp_name);
- sys_sysctl_stacktrace(rmp->mp_endpoint);
+ sys_diagctl_stacktrace(rmp->mp_endpoint);
}
exit_proc(rmp, 0, TRUE /*dump_core*/);
}
/* Print stacktrace if necessary. */
if(SIGS_IS_STACKTRACE(signo)) {
- sys_sysctl_stacktrace(target);
+ sys_diagctl_stacktrace(target);
}
/* In case of termination signal handle the event. */
panic("file descriptor out-of-range");
f = fp->fp_filp[fild];
if(!f) {
- sys_sysctl_stacktrace(fp->fp_endpoint);
+ sys_diagctl_stacktrace(fp->fp_endpoint);
panic("process %d blocked on empty fd %d",
fp->fp_endpoint, fild);
}
if(!cb) {
printf("VM: mem_file: no callback, returning EFAULT\n");
- sys_sysctl_stacktrace(vmp->vm_endpoint);
+ sys_diagctl_stacktrace(vmp->vm_endpoint);
return EFAULT;
}
if(replymsg->VMV_RESULT != OK) {
#if 0 /* Noisy diagnostic for mmap() by ld.so */
printf("VM: VFS reply failed (%d)\n", replymsg->VMV_RESULT);
- sys_sysctl_stacktrace(vmp->vm_endpoint);
+ sys_diagctl_stacktrace(vmp->vm_endpoint);
#endif
result = origmsg->VMV_RESULT;
} else {
if(!(vr = map_lookup(vmp, addr, NULL))) {
printf("VM: unmap: address 0x%lx not found in %d\n",
addr, target);
- sys_sysctl_stacktrace(target);
+ sys_diagctl_stacktrace(target);
return EFAULT;
}
len = vr->length;
assert(PFERR_NOPAGE(err));
printf("VM: pagefault: SIGSEGV %d bad addr 0x%lx; %s\n",
ep, addr, pf_errstr(err));
- sys_sysctl_stacktrace(ep);
+ sys_diagctl_stacktrace(ep);
}
if((s=sys_kill(vmp->vm_endpoint, SIGSEGV)) != OK)
panic("sys_kill failed: %d", s);