KTRACE code
authorMarc Teitelbaum <marc@ucbvax.Berkeley.EDU>
Wed, 5 Jul 1989 00:52:28 +0000 (16:52 -0800)
committerMarc Teitelbaum <marc@ucbvax.Berkeley.EDU>
Wed, 5 Jul 1989 00:52:28 +0000 (16:52 -0800)
SCCS-vsn: sys/tahoe/tahoe/trap.c 7.2

usr/src/sys/tahoe/tahoe/trap.c

index 29bc8ab..f5bcf9d 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)trap.c      7.1 (Berkeley) %G%
+ *     @(#)trap.c      7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
 #include "reg.h"
 #include "pte.h"
 #include "mtpr.h"
 #include "reg.h"
 #include "pte.h"
 #include "mtpr.h"
-
-#define        SYSCALLTRACE
-#ifdef SYSCALLTRACE
-#include "../sys/syscalls.c"
+#ifdef KTRACE
+#include "ktrace.h"
 #endif
 
 #include "../tahoe/trap.h"
 #endif
 
 #include "../tahoe/trap.h"
@@ -217,7 +215,7 @@ syscall(sp, type, hfs, accmst, acclst, dbl, code, pc, psl)
        register caddr_t params;
        register int i;
        register struct sysent *callp;
        register caddr_t params;
        register int i;
        register struct sysent *callp;
-       register struct proc *p;
+       register struct proc *p = u.u_procp;
        struct timeval syst;
        int opc;
 
        struct timeval syst;
        int opc;
 
@@ -268,24 +266,9 @@ syscall(sp, type, hfs, accmst, acclst, dbl, code, pc, psl)
                        u.u_error = EINTR;
        } else {
                u.u_eosys = NORMALRETURN;
                        u.u_error = EINTR;
        } else {
                u.u_eosys = NORMALRETURN;
-#ifdef SYSCALLTRACE
-               if (syscalltrace) {
-                       register int a;
-                       char *cp;
-
-                       if (code >= nsysent)
-                               printf("0x%x", code);
-                       else
-                               printf("%s", syscallnames[code]);
-                       cp = "(";
-                       for (a = 0; a < callp->sy_narg; a++) {
-                               printf("%s%x", cp, u.u_arg[a]);
-                               cp = ", ";
-                       }
-                       if (a)
-                               printf(")");
-                       printf("\n");
-               }
+#ifdef KTRACE
+               if (KTRPOINT(p, KTR_SYSCALL))
+                       ktrsyscall(p->p_tracep, code, callp->sy_narg);
 #endif
                (*callp->sy_call)();
        }
 #endif
                (*callp->sy_call)();
        }
@@ -302,6 +285,10 @@ syscall(sp, type, hfs, accmst, acclst, dbl, code, pc, psl)
                pc = opc;
        /* else if (u.u_eosys == JUSTRETURN) */
                /* nothing to do */
                pc = opc;
        /* else if (u.u_eosys == JUSTRETURN) */
                /* nothing to do */
+#ifdef KTRACE
+       if (KTRPOINT(p, KTR_SYSRET))
+               ktrsysret(p->p_tracep, code);
+#endif
 done:
        p = u.u_procp;
        if (p->p_cursig || ISSIG(p))
 done:
        p = u.u_procp;
        if (p->p_cursig || ISSIG(p))