strace: Use Qmsg for the trace log (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 8 Feb 2017 23:22:33 +0000 (18:22 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 9 Feb 2017 17:31:41 +0000 (12:31 -0500)
This lets us read a record at a time.  Although the entries are separated
by newlines and we could use getline(), that results in one-byte-at-a-time
reads, which are slow.  We can read one record at a time, thanks to Qmsg.
So long as we read the max size of a systrace record.

Reinstall your kernel headers.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/dev/proc.c
kern/include/ros/syscall.h
kern/include/syscall.h

index 77cd6eb..47bbd5e 100644 (file)
@@ -1389,7 +1389,7 @@ static void procctlreq(struct proc *p, char *va, int n)
                        strace = kzmalloc(sizeof(*p->strace), MEM_WAIT);
                        spinlock_init(&strace->lock);
                        bitmap_set(strace->trace_set, 0, MAX_SYSCALL_NR);
-                       strace->q = qopen(65536, 0, NULL, NULL);
+                       strace->q = qopen(65536, Qmsg, NULL, NULL);
                        /* The queue is reopened and hungup whenever we open the Qstrace
                         * file.  This hangup might not be necessary, but is safer. */
                        qhangup(strace->q, NULL);
index f5075bb..ea1062d 100644 (file)
@@ -13,6 +13,7 @@
 #define SC_ABORT                               0x0010          /* syscall abort attempted */
 
 #define MAX_ERRSTR_LEN                 128
+#define SYSTR_BUF_SZ                   PGSIZE
 
 struct syscall {
        unsigned int                            num;
index cdff324..a383536 100644 (file)
@@ -4,6 +4,7 @@
 #endif
 
 #include <ros/common.h>
+#include <ros/syscall.h>
 #include <process.h>
 #include <kref.h>
 #include <ns.h>
@@ -20,7 +21,6 @@
 #define MAX_ASRC_BATCH                         10
 
 #define SYSTR_RECORD_SZ                                256
-#define SYSTR_BUF_SZ                           PGSIZE
 #define SYSTR_PRETTY_BUF_SZ                    (SYSTR_BUF_SZ -                            \
                                      sizeof(struct systrace_record))
 struct systrace_record {