Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Reduce use of curproc in several places:



details:   https://anonhg.NetBSD.org/src/rev/5e608f81f3e3
branches:  trunk
changeset: 486627:5e608f81f3e3
user:      sommerfeld <sommerfeld%NetBSD.org@localhost>
date:      Sat May 27 00:40:29 2000 +0000

description:
Reduce use of curproc in several places:

 - Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

 - Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

 - Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

 - ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

 - move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

 - simplify interface to ktrwrite()

diffstat:

 sys/arch/alpha/alpha/trap.c           |   10 +-
 sys/arch/amiga/amiga/trap.c           |    8 +-
 sys/arch/arm26/arm26/except.c         |   10 +-
 sys/arch/arm32/arm32/syscall.c        |    8 +-
 sys/arch/atari/atari/trap.c           |    8 +-
 sys/arch/hp300/hp300/trap.c           |    8 +-
 sys/arch/i386/i386/trap.c             |    8 +-
 sys/arch/luna68k/luna68k/trap.c       |   10 +-
 sys/arch/mac68k/mac68k/trap.c         |    8 +-
 sys/arch/mips/mips/trap.c             |   10 +-
 sys/arch/mvme68k/mvme68k/trap.c       |    8 +-
 sys/arch/news68k/news68k/trap.c       |    8 +-
 sys/arch/next68k/next68k/trap.c       |    8 +-
 sys/arch/pc532/pc532/trap.c           |    8 +-
 sys/arch/powerpc/powerpc/trap.c       |   12 +-
 sys/arch/sh3/sh3/trap.c               |    8 +-
 sys/arch/sparc/sparc/trap.c           |   10 +-
 sys/arch/sparc64/sparc64/trap.c       |   12 +-
 sys/arch/sun3/sun3/trap.c             |    8 +-
 sys/arch/vax/vax/trap.c               |    8 +-
 sys/arch/x68k/x68k/trap.c             |    8 +-
 sys/compat/hpux/hpux_compat.c         |    4 +-
 sys/compat/hpux/hpux_net.c            |    6 +-
 sys/compat/netbsd32/netbsd32_netbsd.c |   12 +-
 sys/kern/kern_exec.c                  |    4 +-
 sys/kern/kern_ktrace.c                |  308 +++++++++++++++------------------
 sys/kern/kern_proc.c                  |    9 +-
 sys/kern/kern_prot.c                  |    5 +-
 sys/kern/kern_sig.c                   |   29 +-
 sys/kern/kern_synch.c                 |   26 +-
 sys/kern/sys_generic.c                |   12 +-
 sys/kern/uipc_syscalls.c              |    9 +-
 sys/kern/vfs_lookup.c                 |    4 +-
 sys/sys/ktrace.h                      |   18 +-
 sys/sys/proc.h                        |    8 +-
 35 files changed, 301 insertions(+), 339 deletions(-)

diffs (truncated from 1948 to 300 lines):

diff -r f2dc1a284345 -r 5e608f81f3e3 sys/arch/alpha/alpha/trap.c
--- a/sys/arch/alpha/alpha/trap.c       Sat May 27 00:19:52 2000 +0000
+++ b/sys/arch/alpha/alpha/trap.c       Sat May 27 00:40:29 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.53 2000/05/26 21:19:23 thorpej Exp $ */
+/* $NetBSD: trap.c,v 1.54 2000/05/27 00:40:29 sommerfeld Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.53 2000/05/26 21:19:23 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.54 2000/05/27 00:40:29 sommerfeld Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -678,7 +678,7 @@
        }
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSCALL))
-               ktrsyscall(p->p_tracep, code, callp->sy_argsize, args + hidden);
+               ktrsyscall(p, code, callp->sy_argsize, args + hidden);
 #endif
 #ifdef SYSCALL_DEBUG
        scdebug_call(p, code, args + hidden);
@@ -720,7 +720,7 @@
        userret(p, framep->tf_regs[FRAME_PC], sticks);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, code, error, rval[0]);
+               ktrsysret(p, code, error, rval[0]);
 #endif
 }
 
@@ -740,7 +740,7 @@
        userret(p, p->p_md.md_tf->tf_regs[FRAME_PC], 0);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, SYS_fork, 0, 0);
+               ktrsysret(p, SYS_fork, 0, 0);
 #endif
 }
 
diff -r f2dc1a284345 -r 5e608f81f3e3 sys/arch/amiga/amiga/trap.c
--- a/sys/arch/amiga/amiga/trap.c       Sat May 27 00:19:52 2000 +0000
+++ b/sys/arch/amiga/amiga/trap.c       Sat May 27 00:40:29 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.74 2000/05/26 21:19:26 thorpej Exp $        */
+/*     $NetBSD: trap.c,v 1.75 2000/05/27 00:40:30 sommerfeld Exp $     */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -892,7 +892,7 @@
 #endif
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSCALL))
-               ktrsyscall(p->p_tracep, code, argsize, args);
+               ktrsyscall(p, code, argsize, args);
 #endif
        if (error)
                goto bad;
@@ -938,7 +938,7 @@
        userret(p, frame.f_pc, sticks);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, code, error, rval[0]);
+               ktrsysret(p, code, error, rval[0]);
 #endif
 }
 
@@ -959,7 +959,7 @@
        userret(p, f->f_pc, p->p_sticks);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, SYS_fork, 0, 0);
+               ktrsysret(p, SYS_fork, 0, 0);
 #endif
 }
 
diff -r f2dc1a284345 -r 5e608f81f3e3 sys/arch/arm26/arm26/except.c
--- a/sys/arch/arm26/arm26/except.c     Sat May 27 00:19:52 2000 +0000
+++ b/sys/arch/arm26/arm26/except.c     Sat May 27 00:40:29 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: except.c,v 1.4 2000/05/26 21:19:30 thorpej Exp $ */
+/* $NetBSD: except.c,v 1.5 2000/05/27 00:40:31 sommerfeld Exp $ */
 /*-
  * Copyright (c) 1998, 1999, 2000 Ben Harris
  * All rights reserved.
@@ -32,7 +32,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: except.c,v 1.4 2000/05/26 21:19:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: except.c,v 1.5 2000/05/27 00:40:31 sommerfeld Exp $");
 
 #include "opt_cputypes.h"
 #include "opt_ddb.h"
@@ -254,7 +254,7 @@
 #endif
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSCALL))
-               ktrsyscall(p->p_tracep, code, argsize, args);
+               ktrsyscall(p, code, argsize, args);
 #endif
 
        rval[0] = 0;
@@ -290,7 +290,7 @@
        userret(p, pc, sticks);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, code, error, rval[0]);
+               ktrsysret(p, code, error, rval[0]);
 #endif
 }
 
@@ -315,7 +315,7 @@
        userret(p, tf->tf_r15 & R15_PC, 0);
 #ifdef KTRACE
         if (KTRPOINT(p, KTR_SYSRET))
-                ktrsysret(p->p_tracep, SYS_fork /* XXX */, 0, &tf->tf_r0);
+                ktrsysret(p, SYS_fork /* XXX */, 0, &tf->tf_r0);
 #endif
 }
 
diff -r f2dc1a284345 -r 5e608f81f3e3 sys/arch/arm32/arm32/syscall.c
--- a/sys/arch/arm32/arm32/syscall.c    Sat May 27 00:19:52 2000 +0000
+++ b/sys/arch/arm32/arm32/syscall.c    Sat May 27 00:40:29 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syscall.c,v 1.26 2000/03/13 23:52:27 soren Exp $       */
+/*     $NetBSD: syscall.c,v 1.27 2000/05/27 00:40:31 sommerfeld Exp $  */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -300,7 +300,7 @@
 #endif
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSCALL))
-               ktrsyscall(p->p_tracep, code, argsize, args);
+               ktrsyscall(p, code, argsize, args);
 #endif
        rval[0] = 0;
        rval[1] = frame->tf_r1;
@@ -349,7 +349,7 @@
 
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, code, error, rval[0]);
+               ktrsysret(p, code, error, rval[0]);
 #endif
 }
 
@@ -369,7 +369,7 @@
 
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, SYS_fork, 0, 0);
+               ktrsysret(p, SYS_fork, 0, 0);
 #endif
 }
 
diff -r f2dc1a284345 -r 5e608f81f3e3 sys/arch/atari/atari/trap.c
--- a/sys/arch/atari/atari/trap.c       Sat May 27 00:19:52 2000 +0000
+++ b/sys/arch/atari/atari/trap.c       Sat May 27 00:40:29 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.50 2000/05/26 21:19:34 thorpej Exp $        */
+/*     $NetBSD: trap.c,v 1.51 2000/05/27 00:40:32 sommerfeld Exp $     */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1128,7 +1128,7 @@
 #endif
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSCALL))
-               ktrsyscall(p->p_tracep, code, argsize, args);
+               ktrsyscall(p, code, argsize, args);
 #endif
        if (error)
                goto bad;
@@ -1176,7 +1176,7 @@
        userret(p, &frame, sticks, (u_int)0, 0);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, code, error, rval[0]);
+               ktrsysret(p, code, error, rval[0]);
 #endif
 }
 /*
@@ -1197,6 +1197,6 @@
        userret(p, f, 0, (u_int)0, 0);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, SYS_fork, 0, 0);
+               ktrsysret(p, SYS_fork, 0, 0);
 #endif
 }
diff -r f2dc1a284345 -r 5e608f81f3e3 sys/arch/hp300/hp300/trap.c
--- a/sys/arch/hp300/hp300/trap.c       Sat May 27 00:19:52 2000 +0000
+++ b/sys/arch/hp300/hp300/trap.c       Sat May 27 00:40:29 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.77 2000/05/26 21:19:42 thorpej Exp $        */
+/*     $NetBSD: trap.c,v 1.78 2000/05/27 00:40:32 sommerfeld Exp $     */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1124,7 +1124,7 @@
 #endif
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSCALL))
-               ktrsyscall(p->p_tracep, code, argsize, args);
+               ktrsyscall(p, code, argsize, args);
 #endif
        if (error)
                goto bad;
@@ -1167,7 +1167,7 @@
        userret(p, &frame, sticks, (u_int)0, 0);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, code, error, rval[0]);
+               ktrsysret(p, code, error, rval[0]);
 #endif
 }
 
@@ -1186,6 +1186,6 @@
        userret(p, f, 0, (u_int)0, 0);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, SYS_fork, 0, 0);
+               ktrsysret(p, SYS_fork, 0, 0);
 #endif
 }
diff -r f2dc1a284345 -r 5e608f81f3e3 sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Sat May 27 00:19:52 2000 +0000
+++ b/sys/arch/i386/i386/trap.c Sat May 27 00:40:29 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.137 2000/05/26 21:19:47 thorpej Exp $       */
+/*     $NetBSD: trap.c,v 1.138 2000/05/27 00:40:33 sommerfeld Exp $    */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -759,7 +759,7 @@
 #endif /* SYSCALL_DEBUG */
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSCALL))
-               ktrsyscall(p->p_tracep, code, argsize, args);
+               ktrsyscall(p, code, argsize, args);
 #endif /* KTRACE */
        rval[0] = 0;
        rval[1] = frame.tf_edx;
@@ -804,7 +804,7 @@
        userret(p, frame.tf_eip, sticks);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, code, error, rval[0]);
+               ktrsysret(p, code, error, rval[0]);
 #endif /* KTRACE */
 }
 
@@ -821,6 +821,6 @@
        userret(p, tf->tf_eip, 0);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, SYS_fork, 0, 0);
+               ktrsysret(p, SYS_fork, 0, 0);
 #endif
 }
diff -r f2dc1a284345 -r 5e608f81f3e3 sys/arch/luna68k/luna68k/trap.c
--- a/sys/arch/luna68k/luna68k/trap.c   Sat May 27 00:19:52 2000 +0000
+++ b/sys/arch/luna68k/luna68k/trap.c   Sat May 27 00:40:29 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.5 2000/05/26 21:19:49 thorpej Exp $ */
+/* $NetBSD: trap.c,v 1.6 2000/05/27 00:40:34 sommerfeld Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.5 2000/05/26 21:19:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.6 2000/05/27 00:40:34 sommerfeld Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -1000,7 +1000,7 @@
 #endif
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSCALL))
-               ktrsyscall(p->p_tracep, code, argsize, args);
+               ktrsyscall(p, code, argsize, args);
 #endif
        if (error)
                goto bad;
@@ -1043,7 +1043,7 @@
        userret(p, &frame, sticks, (u_int)0, 0);
 #ifdef KTRACE
        if (KTRPOINT(p, KTR_SYSRET))
-               ktrsysret(p->p_tracep, code, error, rval[0]);
+               ktrsysret(p, code, error, rval[0]);



Home | Main Index | Thread Index | Old Index