Rename SYSCTL kernel call to DIAGCTL

Change-Id: I1b17373f01808d887dcbeab493838946fbef4ef6
This commit is contained in:
David van Moolenbroek 2013-09-21 00:58:46 +02:00 committed by Lionel Sambuc
parent 9fab85c2de
commit de975579a4
18 changed files with 62 additions and 62 deletions

View file

@ -283,7 +283,8 @@
# 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() */
@ -309,7 +310,7 @@
#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 */
@ -582,12 +583,12 @@
#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. */

View file

@ -69,8 +69,8 @@ int sys_vmctl_enable_paging(void * data);
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);

View file

@ -137,8 +137,8 @@ void hook_ipc_clear(struct proc *proc);
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 */

View file

@ -241,7 +241,7 @@ void system_init(void)
/* 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 */

View file

@ -25,7 +25,7 @@ SRCS+= \
do_privctl.c \
do_safecopy.c \
do_safememset.c \
do_sysctl.c \
do_diagctl.c \
do_getksig.c \
do_endksig.c \
do_kill.c \

View file

@ -1,35 +1,35 @@
/* 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;
}
@ -37,13 +37,13 @@ int do_sysctl(struct proc * caller, message * m_ptr)
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);
}
}

View file

@ -38,6 +38,7 @@ SRCS+= \
sys_abort.c \
sys_clear.c \
sys_cprof.c \
sys_diagctl.c \
sys_endsig.c \
sys_exec.c \
sys_exit.c \
@ -66,7 +67,6 @@ SRCS+= \
sys_sprof.c \
sys_statectl.c \
sys_stime.c \
sys_sysctl.c \
sys_times.c \
sys_trace.c \
sys_umap.c \

View file

@ -20,7 +20,7 @@ void kputc(int 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) {

19
lib/libsys/sys_diagctl.c Normal file
View file

@ -0,0 +1,19 @@
#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);
}

View file

@ -1,20 +0,0 @@
#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);
}

View file

@ -370,7 +370,7 @@ void procstack_dmp()
PROCLOOP(rp, oldrp)
PRINTRTS(rp);
printf("\n"); pagelines++;
sys_sysctl_stacktrace(rp->p_endpoint);
sys_diagctl_stacktrace(rp->p_endpoint);
}
}

View file

@ -142,7 +142,7 @@ int do_getsysinfo()
{
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;
}
@ -190,7 +190,7 @@ int do_getprocnr()
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;
}
@ -267,7 +267,7 @@ int do_getepinfo_o()
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;
}

View file

@ -380,7 +380,7 @@ int ksig; /* non-zero means signal comes from kernel */
/* 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)) {
@ -475,7 +475,7 @@ int signo; /* signal that caused termination */
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*/);
}

View file

@ -540,7 +540,7 @@ static int sef_cb_signal_manager(endpoint_t target, int signo)
/* 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. */

View file

@ -567,7 +567,7 @@ void unpause(void)
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);
}

View file

@ -125,7 +125,7 @@ static int mappedfile_pagefault(struct vmproc *vmp, struct vir_region *region,
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;
}

View file

@ -182,7 +182,7 @@ static void mmap_file_cont(struct vmproc *vmp, message *replymsg, void *cbarg,
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 {
@ -532,7 +532,7 @@ int do_munmap(message *m)
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;

View file

@ -87,7 +87,7 @@ static void handle_pagefault(endpoint_t ep, vir_bytes addr, u32_t err, int retry
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);