summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2000-11-10 18:15:50 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2000-11-10 18:15:50 +0000
commit7c2c0cece14deee41a6cc3def2928808d73881b0 (patch)
tree871f91c39959ffa32ae5ac773513265eb121d8c9 /sys/kern
parent38a9424b2fc187e798fe3a91366490408b112921 (diff)
Change the ktrace interface functions from taking the trace vnode to taking the
traced proc. The vnode is in the proc and all functions need the proc.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_exec.c4
-rw-r--r--sys/kern/kern_ktrace.c63
-rw-r--r--sys/kern/kern_sig.c7
-rw-r--r--sys/kern/kern_synch.c14
-rw-r--r--sys/kern/sys_generic.c10
-rw-r--r--sys/kern/uipc_syscalls.c7
-rw-r--r--sys/kern/vfs_lookup.c4
7 files changed, 50 insertions, 59 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 47d7e22691e..162313d55e4 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.44 2000/09/28 13:41:39 art Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.45 2000/11/10 18:15:46 art Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -618,7 +618,7 @@ sys_execve(p, v, retval)
#ifdef KTRACE
if (KTRPOINT(p, KTR_EMUL))
- ktremul(p->p_tracep, p->p_emul->e_name);
+ ktremul(p, p->p_emul->e_name);
#endif
return (0);
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c
index 1226550a488..85becf736ac 100644
--- a/sys/kern/kern_ktrace.c
+++ b/sys/kern/kern_ktrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_ktrace.c,v 1.21 2000/09/27 16:13:46 mickey Exp $ */
+/* $OpenBSD: kern_ktrace.c,v 1.22 2000/11/10 18:15:46 art Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */
/*
@@ -57,7 +57,7 @@ void ktrinitheader __P((struct ktr_header *, struct proc *, int));
int ktrops __P((struct proc *, struct proc *, int, int, struct vnode *));
int ktrsetchildren __P((struct proc *, struct proc *, int, int,
struct vnode *));
-int ktrwrite __P((struct vnode *, struct ktr_header *));
+int ktrwrite __P((struct proc *, struct ktr_header *));
int ktrcanset __P((struct proc *, struct proc *));
/*
@@ -97,8 +97,8 @@ ktrinitheader(kth, p, type)
}
void
-ktrsyscall(vp, code, argsize, args)
- struct vnode *vp;
+ktrsyscall(p, code, argsize, args)
+ struct proc *p;
register_t code;
size_t argsize;
register_t args[];
@@ -106,7 +106,6 @@ ktrsyscall(vp, code, argsize, args)
struct ktr_header kth;
struct ktr_syscall *ktp;
unsigned int len = sizeof(struct ktr_syscall) + argsize;
- struct proc *p = curproc; /* XXX */
register_t *argp;
int i;
@@ -120,21 +119,20 @@ ktrsyscall(vp, code, argsize, args)
*argp++ = args[i];
kth.ktr_buf = (caddr_t)ktp;
kth.ktr_len = len;
- ktrwrite(vp, &kth);
+ ktrwrite(p, &kth);
free(ktp, M_TEMP);
p->p_traceflag &= ~KTRFAC_ACTIVE;
}
void
-ktrsysret(vp, code, error, retval)
- struct vnode *vp;
+ktrsysret(p, code, error, retval)
+ struct proc *p;
register_t code;
int error;
register_t retval;
{
struct ktr_header kth;
struct ktr_sysret ktp;
- struct proc *p = curproc; /* XXX */
p->p_traceflag |= KTRFAC_ACTIVE;
ktrinitheader(&kth, p, KTR_SYSRET);
@@ -145,47 +143,45 @@ ktrsysret(vp, code, error, retval)
kth.ktr_buf = (caddr_t)&ktp;
kth.ktr_len = sizeof(struct ktr_sysret);
- ktrwrite(vp, &kth);
+ ktrwrite(p, &kth);
p->p_traceflag &= ~KTRFAC_ACTIVE;
}
void
-ktrnamei(vp, path)
- struct vnode *vp;
+ktrnamei(p, path)
+ struct proc *p;
char *path;
{
struct ktr_header kth;
- struct proc *p = curproc; /* XXX */
p->p_traceflag |= KTRFAC_ACTIVE;
ktrinitheader(&kth, p, KTR_NAMEI);
kth.ktr_len = strlen(path);
kth.ktr_buf = path;
- ktrwrite(vp, &kth);
+ ktrwrite(p, &kth);
p->p_traceflag &= ~KTRFAC_ACTIVE;
}
void
-ktremul(vp, emul)
- struct vnode *vp;
+ktremul(p, emul)
+ struct proc *p;
char *emul;
{
struct ktr_header kth;
- struct proc *p = curproc; /* XXX */
p->p_traceflag |= KTRFAC_ACTIVE;
ktrinitheader(&kth, p, KTR_EMUL);
kth.ktr_len = strlen(emul);
kth.ktr_buf = emul;
- ktrwrite(vp, &kth);
+ ktrwrite(p, &kth);
p->p_traceflag &= ~KTRFAC_ACTIVE;
}
void
-ktrgenio(vp, fd, rw, iov, len, error)
- struct vnode *vp;
+ktrgenio(p, fd, rw, iov, len, error)
+ struct proc *p;
int fd;
enum uio_rw rw;
struct iovec *iov;
@@ -195,7 +191,6 @@ ktrgenio(vp, fd, rw, iov, len, error)
struct ktr_genio *ktp;
caddr_t cp;
int resid = len, count;
- struct proc *p = curproc; /* XXX */
int buflen;
if (error)
@@ -231,7 +226,7 @@ ktrgenio(vp, fd, rw, iov, len, error)
kth.ktr_len = count + sizeof(struct ktr_genio);
- if (ktrwrite(vp, &kth) != 0)
+ if (ktrwrite(p, &kth) != 0)
break;
iov->iov_len -= count;
@@ -249,15 +244,14 @@ ktrgenio(vp, fd, rw, iov, len, error)
}
void
-ktrpsig(vp, sig, action, mask, code)
- struct vnode *vp;
+ktrpsig(p, sig, action, mask, code)
+ struct proc *p;
int sig;
sig_t action;
int mask, code;
{
struct ktr_header kth;
struct ktr_psig kp;
- struct proc *p = curproc; /* XXX */
p->p_traceflag |= KTRFAC_ACTIVE;
ktrinitheader(&kth, p, KTR_PSIG);
@@ -268,18 +262,17 @@ ktrpsig(vp, sig, action, mask, code)
kth.ktr_buf = (caddr_t)&kp;
kth.ktr_len = sizeof (struct ktr_psig);
- ktrwrite(vp, &kth);
+ ktrwrite(p, &kth);
p->p_traceflag &= ~KTRFAC_ACTIVE;
}
void
-ktrcsw(vp, out, user)
- struct vnode *vp;
+ktrcsw(p, out, user)
+ struct proc *p;
int out, user;
{
struct ktr_header kth;
struct ktr_csw kc;
- struct proc *p = curproc; /* XXX */
p->p_traceflag |= KTRFAC_ACTIVE;
ktrinitheader(&kth, p, KTR_CSW);
@@ -288,7 +281,7 @@ ktrcsw(vp, out, user)
kth.ktr_buf = (caddr_t)&kc;
kth.ktr_len = sizeof (struct ktr_csw);
- ktrwrite(vp, &kth);
+ ktrwrite(p, &kth);
p->p_traceflag &= ~KTRFAC_ACTIVE;
}
@@ -431,7 +424,7 @@ ktrops(curp, p, ops, facs, vp)
* change/attach request.
*/
if (KTRPOINT(p, KTR_EMUL))
- ktremul(p->p_tracep, p->p_emul->e_name);
+ ktremul(p, p->p_emul->e_name);
return (1);
}
@@ -469,14 +462,14 @@ ktrsetchildren(curp, top, ops, facs, vp)
}
int
-ktrwrite(vp, kth)
- struct vnode *vp;
+ktrwrite(p, kth)
+ struct proc *p;
struct ktr_header *kth;
{
struct uio auio;
struct iovec aiov[2];
- struct proc *p = curproc; /* XXX */
int error;
+ struct vnode *vp = p->p_tracep;
if (vp == NULL)
return 0;
@@ -542,4 +535,4 @@ ktrcanset(callp, targetp)
return (0);
}
-#endif
+#endif \ No newline at end of file
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index caadb6620fa..bb5c923f364 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sig.c,v 1.38 2000/06/05 11:02:50 art Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.39 2000/11/10 18:15:47 art Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
@@ -641,7 +641,7 @@ trapsignal(p, signum, code, type, sigval)
p->p_stats->p_ru.ru_nsignals++;
#ifdef KTRACE
if (KTRPOINT(p, KTR_PSIG))
- ktrpsig(p->p_tracep, signum, ps->ps_sigact[signum],
+ ktrpsig(p, signum, ps->ps_sigact[signum],
p->p_sigmask, code);
#endif
(*p->p_emul->e_sendsig)(ps->ps_sigact[signum], signum,
@@ -1062,8 +1062,7 @@ postsig(signum)
action = ps->ps_sigact[signum];
#ifdef KTRACE
if (KTRPOINT(p, KTR_PSIG))
- ktrpsig(p->p_tracep,
- signum, action, ps->ps_flags & SAS_OLDMASK ?
+ ktrpsig(p, signum, action, ps->ps_flags & SAS_OLDMASK ?
ps->ps_oldmask : p->p_sigmask, 0);
#endif
if (action == SIG_DFL) {
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 8e9570618fc..b04530fefd3 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.28 2000/08/03 14:36:36 mickey Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.29 2000/11/10 18:15:47 art Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -357,7 +357,7 @@ tsleep(ident, priority, wmesg, timo)
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
- ktrcsw(p->p_tracep, 1, 0);
+ ktrcsw(p, 1, 0);
#endif
s = splhigh();
if (cold || panicstr) {
@@ -426,7 +426,7 @@ resume:
if (sig == 0) {
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
- ktrcsw(p->p_tracep, 0, 0);
+ ktrcsw(p, 0, 0);
#endif
return (EWOULDBLOCK);
}
@@ -435,7 +435,7 @@ resume:
if (catch && (sig != 0 || (sig = CURSIG(p)) != 0)) {
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
- ktrcsw(p->p_tracep, 0, 0);
+ ktrcsw(p, 0, 0);
#endif
if (p->p_sigacts->ps_sigintr & sigmask(sig))
return (EINTR);
@@ -443,7 +443,7 @@ resume:
}
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
- ktrcsw(p->p_tracep, 0, 0);
+ ktrcsw(p, 0, 0);
#endif
return (0);
}
@@ -523,7 +523,7 @@ sleep(ident, priority)
p->p_stats->p_ru.ru_nvcsw++;
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
- ktrcsw(p->p_tracep, 1, 0);
+ ktrcsw(p, 1, 0);
#endif
mi_switch();
#ifdef DDB
@@ -532,7 +532,7 @@ sleep(ident, priority)
#endif
#ifdef KTRACE
if (KTRPOINT(p, KTR_CSW))
- ktrcsw(p->p_tracep, 0, 0);
+ ktrcsw(p, 0, 0);
#endif
curpriority = p->p_usrpri;
splx(s);
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 593bd2e42b4..595071f1258 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_generic.c,v 1.27 2000/09/27 16:13:46 mickey Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.28 2000/11/10 18:15:47 art Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
@@ -154,7 +154,7 @@ dofileread(p, fd, fp, buf, nbyte, offset, retval)
cnt -= auio.uio_resid;
#ifdef KTRACE
if (KTRPOINT(p, KTR_GENIO) && error == 0)
- ktrgenio(p->p_tracep, fd, UIO_READ, &ktriov, cnt, error);
+ ktrgenio(p, fd, UIO_READ, &ktriov, cnt, error);
#endif
*retval = cnt;
out:
@@ -275,7 +275,7 @@ dofilereadv(p, fd, fp, iovp, iovcnt, offset, retval)
#ifdef KTRACE
if (ktriov != NULL) {
if (error == 0)
- ktrgenio(p->p_tracep, fd, UIO_READ, ktriov, cnt,
+ ktrgenio(p, fd, UIO_READ, ktriov, cnt,
error);
free(ktriov, M_TEMP);
}
@@ -380,7 +380,7 @@ dofilewrite(p, fd, fp, buf, nbyte, offset, retval)
cnt -= auio.uio_resid;
#ifdef KTRACE
if (KTRPOINT(p, KTR_GENIO) && error == 0)
- ktrgenio(p->p_tracep, fd, UIO_WRITE, &ktriov, cnt, error);
+ ktrgenio(p, fd, UIO_WRITE, &ktriov, cnt, error);
#endif
*retval = cnt;
out:
@@ -502,7 +502,7 @@ dofilewritev(p, fd, fp, iovp, iovcnt, offset, retval)
#ifdef KTRACE
if (ktriov != NULL) {
if (error == 0)
- ktrgenio(p->p_tracep, fd, UIO_WRITE, ktriov, cnt,
+ ktrgenio(p, fd, UIO_WRITE, ktriov, cnt,
error);
free(ktriov, M_TEMP);
}
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 613f1e969d0..786b1ed0bb5 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.32 2000/10/12 09:58:05 itojun Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.33 2000/11/10 18:15:48 art Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -504,8 +504,7 @@ sendit(p, s, mp, flags, retsize)
#ifdef KTRACE
if (ktriov != NULL) {
if (error == 0)
- ktrgenio(p->p_tracep, s, UIO_WRITE,
- ktriov, *retsize, error);
+ ktrgenio(p, s, UIO_WRITE, ktriov, *retsize, error);
free(ktriov, M_TEMP);
}
#endif
@@ -655,7 +654,7 @@ recvit(p, s, mp, namelenp, retsize)
#ifdef KTRACE
if (ktriov != NULL) {
if (error == 0)
- ktrgenio(p->p_tracep, s, UIO_READ,
+ ktrgenio(p, s, UIO_READ,
ktriov, len - auio.uio_resid, error);
free(ktriov, M_TEMP);
}
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 1acc9172103..a26cf001f81 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_lookup.c,v 1.17 1999/04/16 14:04:41 deraadt Exp $ */
+/* $OpenBSD: vfs_lookup.c,v 1.18 2000/11/10 18:15:48 art Exp $ */
/* $NetBSD: vfs_lookup.c,v 1.17 1996/02/09 19:00:59 christos Exp $ */
/*
@@ -116,7 +116,7 @@ namei(ndp)
#ifdef KTRACE
if (KTRPOINT(cnp->cn_proc, KTR_NAMEI))
- ktrnamei(cnp->cn_proc->p_tracep, cnp->cn_pnbuf);
+ ktrnamei(cnp->cn_proc, cnp->cn_pnbuf);
#endif
/*