diff --git a/sys/compat/svr4/svr4_stream.c b/sys/compat/svr4/svr4_stream.c index feaedcbcdb45..2ed6121953ce 100644 --- a/sys/compat/svr4/svr4_stream.c +++ b/sys/compat/svr4/svr4_stream.c @@ -227,7 +227,7 @@ svr4_sendit(td, s, mp, flags) if (error == 0) { ktruio.uio_iov = ktriov; ktruio.uio_resid = td->td_retval[0]; - ktrgenio(td->td_proc->p_tracep, s, UIO_WRITE, &ktruio, error); + ktrgenio(s, UIO_WRITE, &ktruio, error); } FREE(ktriov, M_TEMP); } @@ -299,7 +299,7 @@ svr4_recvit(td, s, mp, namelenp) if (error == 0) { ktruio.uio_iov = ktriov; ktruio.uio_resid = len - auio.uio_resid; - ktrgenio(td->td_proc->p_tracep, s, UIO_READ, &ktruio, error); + ktrgenio(s, UIO_READ, &ktruio, error); } FREE(ktriov, M_TEMP); } diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index f3352b91acfe..8a94b0c36b1a 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -184,7 +184,7 @@ dofileread(td, fp, fd, buf, nbyte, offset, flags) /* * if tracing, save a copy of iovec */ - if (KTRPOINT(td->td_proc, KTR_GENIO)) { + if (KTRPOINT(td, KTR_GENIO)) { ktriov = aiov; ktruio = auio; didktr = 1; @@ -202,7 +202,7 @@ dofileread(td, fp, fd, buf, nbyte, offset, flags) if (didktr && error == 0) { ktruio.uio_iov = &ktriov; ktruio.uio_resid = cnt; - ktrgenio(td->td_proc->p_tracep, fd, UIO_READ, &ktruio, error); + ktrgenio(fd, UIO_READ, &ktruio, error); } #endif td->td_retval[0] = cnt; @@ -275,7 +275,7 @@ readv(td, uap) /* * if tracing, save a copy of iovec */ - if (KTRPOINT(td->td_proc, KTR_GENIO)) { + if (KTRPOINT(td, KTR_GENIO)) { MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); ktruio = auio; @@ -293,8 +293,7 @@ readv(td, uap) if (error == 0) { ktruio.uio_iov = ktriov; ktruio.uio_resid = cnt; - ktrgenio(td->td_proc->p_tracep, uap->fd, UIO_READ, &ktruio, - error); + ktrgenio(uap->fd, UIO_READ, &ktruio, error); } FREE(ktriov, M_TEMP); } @@ -408,7 +407,7 @@ dofilewrite(td, fp, fd, buf, nbyte, offset, flags) /* * if tracing, save a copy of iovec and uio */ - if (KTRPOINT(td->td_proc, KTR_GENIO)) { + if (KTRPOINT(td, KTR_GENIO)) { ktriov = aiov; ktruio = auio; didktr = 1; @@ -432,7 +431,7 @@ dofilewrite(td, fp, fd, buf, nbyte, offset, flags) if (didktr && error == 0) { ktruio.uio_iov = &ktriov; ktruio.uio_resid = cnt; - ktrgenio(td->td_proc->p_tracep, fd, UIO_WRITE, &ktruio, error); + ktrgenio(fd, UIO_WRITE, &ktruio, error); } #endif td->td_retval[0] = cnt; @@ -509,7 +508,7 @@ writev(td, uap) /* * if tracing, save a copy of iovec and uio */ - if (KTRPOINT(td->td_proc, KTR_GENIO)) { + if (KTRPOINT(td, KTR_GENIO)) { MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); ktruio = auio; @@ -534,8 +533,7 @@ writev(td, uap) if (error == 0) { ktruio.uio_iov = ktriov; ktruio.uio_resid = cnt; - ktrgenio(td->td_proc->p_tracep, uap->fd, UIO_WRITE, &ktruio, - error); + ktrgenio(uap->fd, UIO_WRITE, &ktruio, error); } FREE(ktriov, M_TEMP); } diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index f80dcc9f9084..b44e644fe2ed 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -578,6 +578,7 @@ sendit(td, s, mp, flags) #ifdef KTRACE struct iovec *ktriov = NULL; struct uio ktruio; + int iovlen; #endif if ((error = fgetsock(td, s, &so, NULL)) != 0) @@ -634,9 +635,8 @@ sendit(td, s, mp, flags) control = 0; } #ifdef KTRACE - if (KTRPOINT(td->td_proc, KTR_GENIO)) { - int iovlen = auio.uio_iovcnt * sizeof (struct iovec); - + if (KTRPOINT(td, KTR_GENIO)) { + iovlen = auio.uio_iovcnt * sizeof (struct iovec); MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); ktruio = auio; @@ -662,7 +662,7 @@ sendit(td, s, mp, flags) if (error == 0) { ktruio.uio_iov = ktriov; ktruio.uio_resid = td->td_retval[0]; - ktrgenio(td->td_proc->p_tracep, s, UIO_WRITE, &ktruio, error); + ktrgenio(s, UIO_WRITE, &ktruio, error); } FREE(ktriov, M_TEMP); } @@ -854,6 +854,7 @@ recvit(td, s, mp, namelenp) #ifdef KTRACE struct iovec *ktriov = NULL; struct uio ktruio; + int iovlen; #endif if ((error = fgetsock(td, s, &so, NULL)) != 0) @@ -873,9 +874,8 @@ recvit(td, s, mp, namelenp) } } #ifdef KTRACE - if (KTRPOINT(td->td_proc, KTR_GENIO)) { - int iovlen = auio.uio_iovcnt * sizeof (struct iovec); - + if (KTRPOINT(td, KTR_GENIO)) { + iovlen = auio.uio_iovcnt * sizeof (struct iovec); MALLOC(ktriov, struct iovec *, iovlen, M_TEMP, M_WAITOK); bcopy((caddr_t)auio.uio_iov, (caddr_t)ktriov, iovlen); ktruio = auio; @@ -895,7 +895,7 @@ recvit(td, s, mp, namelenp) if (error == 0) { ktruio.uio_iov = ktriov; ktruio.uio_resid = len - auio.uio_resid; - ktrgenio(td->td_proc->p_tracep, s, UIO_READ, &ktruio, error); + ktrgenio(s, UIO_READ, &ktruio, error); } FREE(ktriov, M_TEMP); } diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index bb589831e139..8e4af42338fb 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -139,8 +139,11 @@ namei(ndp) } ndp->ni_loopcnt = 0; #ifdef KTRACE - if (KTRPOINT(p, KTR_NAMEI)) - ktrnamei(p->p_tracep, cnp->cn_pnbuf); + if (KTRPOINT(td, KTR_NAMEI)) { + KASSERT(cnp->cn_thread == curthread, + ("namei not using curthread")); + ktrnamei(cnp->cn_pnbuf); + } #endif /*