RIP, nearly six years old: 0fabbd46e285 ("Syscall tracing")
Signed-off-by: Barret Rhoden <[email protected]>
---
kern/drivers/dev/proc.c | 5 -----
kern/include/kthread.h | 1 -
kern/include/syscall.h | 8 ++------
kern/src/monitor.c | 25 +++++--------------------
kern/src/syscall.c | 40 +---------------------------------------
kern/src/umem.c | 8 +-------
6 files changed, 9 insertions(+), 78 deletions(-)
diff --git a/kern/drivers/dev/proc.c b/kern/drivers/dev/proc.c
index e11f2f7d10f5..102d3511b7e7 100644
--- a/kern/drivers/dev/proc.c
+++ b/kern/drivers/dev/proc.c
@@ -81,7 +81,6 @@ enum {
CMstartstop,
CMstartsyscall,
CMstop,
- CMtrace,
CMwaitstop,
CMwired,
CMcore,
@@ -145,7 +144,6 @@ struct cmdtab proccmd[] = {
{CMstartstop, "startstop", 1},
{CMstartsyscall, "startsyscall", 1},
{CMstop, "stop", 1},
- {CMtrace, "trace", 0},
{CMwaitstop, "waitstop", 1},
{CMwired, "wired", 2},
{CMcore, "core", 2},
@@ -1286,9 +1284,6 @@ static void procctlreq(struct proc *p, char *va, int n)
default:
error(EFAIL, "Command not implemented");
break;
- case CMtrace:
- systrace_trace_pid(p);
- break;
case CMclose:
procctlclosefiles(p, 0, atoi(cb->f[1]));
break;
diff --git a/kern/include/kthread.h b/kern/include/kthread.h
index 0b9f4bf8eaee..70c4b6f30ed1 100644
--- a/kern/include/kthread.h
+++ b/kern/include/kthread.h
@@ -45,7 +45,6 @@ struct kthread {
int flags;
char *name;
char generic_buf[GENBUF_SZ];
- struct systrace_record *trace;
struct systrace_record *strace;
};
diff --git a/kern/include/syscall.h b/kern/include/syscall.h
index 48340320ba46..a4793ef9eaf6 100644
--- a/kern/include/syscall.h
+++ b/kern/include/syscall.h
@@ -52,6 +52,8 @@ struct strace {
struct queue *q;
};
+extern bool systrace_loud;
+
/* Syscall table */
typedef intreg_t (*syscall_t)(struct proc *, uintreg_t, uintreg_t, uintreg_t,
uintreg_t, uintreg_t, uintreg_t);
@@ -78,12 +80,6 @@ void set_cur_errbuf(struct errbuf *ebuf);
char *get_cur_genbuf(void);
void __signal_syscall(struct syscall *sysc, struct proc *p);
-/* Tracing functions */
-void systrace_start(bool silent);
-int systrace_trace_pid(struct proc *p);
-void systrace_stop(void);
-int systrace_reg(bool all, struct proc *p);
-
/* Utility */
bool syscall_uses_fd(struct syscall *sysc, int fd);
void print_sysc(struct proc *p, struct syscall *sysc);
diff --git a/kern/src/monitor.c b/kern/src/monitor.c
index 33ea8dfdefe9..44a8af5a7933 100644
--- a/kern/src/monitor.c
+++ b/kern/src/monitor.c
@@ -700,27 +700,12 @@ int mon_trace(int argc, char **argv, struct hw_trapframe
*hw_tf)
return 1;
}
if (!strcmp(argv[2], "start")) {
- bool all = TRUE;
- bool silent = FALSE;
- struct proc *p = NULL;
- if (argc >= 4) {
- silent = (bool)strtol(argv[3], 0, 0);
- }
- if (argc >= 5) {
- all = FALSE;
- p = pid2proc(strtol(argv[4], 0, 0));
- if (!p) {
- printk("No such process\n");
- return 1;
- }
- }
- systrace_start(silent);
- if (systrace_reg(all, p))
- printk("No room to trace more processes\n");
+ systrace_loud = TRUE;
} else if (!strcmp(argv[2], "stop")) {
- /* Stop. To see the output, kfunc systrace_print and
systrace_clear */
- /* or cat #K/kptrace or /prof/kptrace */
- systrace_stop();
+ systrace_loud = FALSE;
+ } else {
+ printk("Need a start or stop.\n");
+ return 1;
}
} else if (!strcmp(argv[1], "coretf")) {
if (argc != 3) {
diff --git a/kern/src/syscall.c b/kern/src/syscall.c
index 0e2acf54dbd7..c06643e45e38 100644
--- a/kern/src/syscall.c
+++ b/kern/src/syscall.c
@@ -1445,7 +1445,6 @@ static unsigned long sys_populate_va(struct proc *p,
uintptr_t va,
static intreg_t sys_read(struct proc *p, int fd, void *buf, size_t len)
{
struct per_cpu_info *pcpui = &per_cpu_info[core_id()];
- struct systrace_record *t = pcpui->cur_kthread->trace;
ssize_t ret;
struct file *file = get_file_from_fd(&p->open_files, fd);
sysc_save_str("read on fd %d", fd);
@@ -1466,21 +1465,15 @@ static intreg_t sys_read(struct proc *p, int fd, void
*buf, size_t len)
/* plan9, should also handle errors (EBADF) */
ret = sysread(fd, buf, len);
}
-
- if ((ret > 0) && t) {
- t->datalen = MIN(sizeof(t->data), ret);
- memcpy(t->data, buf, t->datalen);
- }
-
return ret;
}
static intreg_t sys_write(struct proc *p, int fd, const void *buf, size_t len)
{
struct per_cpu_info *pcpui = &per_cpu_info[core_id()];
- struct systrace_record *t = pcpui->cur_kthread->trace;
ssize_t ret;
struct file *file = get_file_from_fd(&p->open_files, fd);
+
sysc_save_str("write on fd %d", fd);
/* VFS */
if (file) {
@@ -1496,13 +1489,7 @@ static intreg_t sys_write(struct proc *p, int fd, const
void *buf, size_t len)
/* plan9, should also handle errors */
ret = syswrite(fd, (void*)buf, len);
}
-
- if (t) {
- t->datalen = MIN(sizeof(t->data), len);
- memcpy(t->data, buf, t->datalen);
- }
return ret;
-
}
/* Checks args/reads in the path, opens the file (relative to fromfd if the
path
@@ -2283,7 +2270,6 @@ intreg_t sys_rename(struct proc *p, char *old_path,
size_t old_path_l,
char *new_path, size_t new_path_l)
{
struct per_cpu_info *pcpui = &per_cpu_info[core_id()];
- struct systrace_record *t = pcpui->cur_kthread->trace;
ERRSTACK(1);
int mountpointlen = 0;
char *from_path = copy_in_path(p, old_path, old_path_l);
@@ -2294,9 +2280,6 @@ intreg_t sys_rename(struct proc *p, char *old_path,
size_t old_path_l,
if ((!from_path) || (!to_path))
return -1;
printd("sys_rename :%s: to :%s: : ", from_path, to_path);
- if (t) {
- t->datalen = snprintf((char *)t->data, sizeof(t->data), "Rename
:%s: to :%s:", from_path, to_path);
- }
/* we need a fid for the wstat. */
/* TODO: maybe wrap the 9ns stuff better. sysrename maybe? */
@@ -2677,27 +2660,6 @@ void __signal_syscall(struct syscall *sysc, struct proc
*p)
}
}
-/* If you call this while it is running, it will change the mode */
-void systrace_start(bool silent)
-{
- systrace_loud = TRUE;
-}
-
-int systrace_reg(bool all, struct proc *p)
-{
- return 0;
-}
-
-int systrace_trace_pid(struct proc *p)
-{
- return 0;
-}
-
-void systrace_stop(void)
-{
- systrace_loud = FALSE;
-}
-
bool syscall_uses_fd(struct syscall *sysc, int fd)
{
switch (sysc->num) {
diff --git a/kern/src/umem.c b/kern/src/umem.c
index 51e2307a0a91..012d6f53c87e 100644
--- a/kern/src/umem.c
+++ b/kern/src/umem.c
@@ -217,12 +217,10 @@ uintptr_t uva2kva(struct proc *p, void *uva, size_t len,
int prot)
/* Helper, copies a pathname from the process into the kernel. Returns a
string
* on success, which you must free with free_path. Returns 0 on failure and
- * sets errno. On success, if you are tracing syscalls, it will store the
- * t_path in the trace data, clobbering whatever previously there. */
+ * sets errno. */
char *copy_in_path(struct proc *p, const char *path, size_t path_l)
{
struct per_cpu_info *pcpui = &per_cpu_info[core_id()];
- struct systrace_record *t = pcpui->cur_kthread->trace;
char *t_path;
/* PATH_MAX includes the \0 */
@@ -233,10 +231,6 @@ char *copy_in_path(struct proc *p, const char *path,
size_t path_l)
t_path = user_strdup_errno(p, path, path_l);
if (!t_path)
return 0;
- if (t) {
- t->datalen = MIN(sizeof(t->data), path_l);
- memcpy(t->data, t_path, t->datalen);
- }
return t_path;
}
--
2.8.0.rc3.226.g39d4020
--
You received this message because you are subscribed to the Google Groups
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.