diff options
author | jhb <jhb@FreeBSD.org> | 2003-06-09 17:38:32 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-06-09 17:38:32 +0000 |
commit | ae455223406d6a2cafdf2f32371a238a5975973f (patch) | |
tree | 476de6b4741d7af0272c17c44aeeae777d33f434 /sys/kern/kern_ktrace.c | |
parent | 37d801936a730d980f3974cc25bfc18f11d8c1d2 (diff) | |
download | FreeBSD-src-ae455223406d6a2cafdf2f32371a238a5975973f.zip FreeBSD-src-ae455223406d6a2cafdf2f32371a238a5975973f.tar.gz |
- Add a td_pflags field to struct thread for private flags accessed only by
curthread. Unlike td_flags, this field does not need any locking.
- Replace the td_inktr and td_inktrace variables with equivalent private
thread flags.
- Move TDF_OLDMASK over to the private flags field so it no longer requires
sched_lock.
Diffstat (limited to 'sys/kern/kern_ktrace.c')
-rw-r--r-- | sys/kern/kern_ktrace.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 8e97122..ecb2421 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -157,12 +157,12 @@ sysctl_kern_ktrace_request_pool(SYSCTL_HANDLER_ARGS) if (error) return (error); td = curthread; - td->td_inktrace = 1; + td->td_pflags |= TDP_INKTRACE; mtx_lock(&ktrace_mtx); oldsize = ktr_requestpool; newsize = ktrace_resize_pool(wantsize); mtx_unlock(&ktrace_mtx); - td->td_inktrace = 0; + td->td_pflags &= ~TDP_INKTRACE; error = SYSCTL_OUT(req, &oldsize, sizeof(uint)); if (error) return (error); @@ -215,11 +215,11 @@ ktr_getrequest(int type) struct proc *p = td->td_proc; int pm; - td->td_inktrace = 1; + td->td_pflags |= TDP_INKTRACE; mtx_lock(&ktrace_mtx); if (!KTRCHECK(td, type)) { mtx_unlock(&ktrace_mtx); - td->td_inktrace = 0; + td->td_pflags &= ~TDP_INKTRACE; return (NULL); } req = STAILQ_FIRST(&ktr_free); @@ -248,7 +248,7 @@ ktr_getrequest(int type) mtx_unlock(&ktrace_mtx); if (pm) printf("Out of ktrace request objects.\n"); - td->td_inktrace = 0; + td->td_pflags &= ~TDP_INKTRACE; } return (req); } @@ -261,7 +261,7 @@ ktr_submitrequest(struct ktr_request *req) STAILQ_INSERT_TAIL(&ktr_todo, req, ktr_list); sema_post(&ktrace_sema); mtx_unlock(&ktrace_mtx); - curthread->td_inktrace = 0; + curthread->td_pflags &= ~TDP_INKTRACE; } static void @@ -514,7 +514,7 @@ ktrace(td, uap) if (ops != KTROP_CLEARFILE && facs == 0) return (EINVAL); - td->td_inktrace = 1; + td->td_pflags |= TDP_INKTRACE; if (ops != KTROP_CLEAR) { /* * an operation which requires a file argument. @@ -525,7 +525,7 @@ ktrace(td, uap) error = vn_open(&nd, &flags, 0); if (error) { mtx_unlock(&Giant); - td->td_inktrace = 0; + td->td_pflags &= ~TDP_INKTRACE; return (error); } NDFREE(&nd, NDF_ONLY_PNBUF); @@ -534,7 +534,7 @@ ktrace(td, uap) if (vp->v_type != VREG) { (void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td); mtx_unlock(&Giant); - td->td_inktrace = 0; + td->td_pflags &= ~TDP_INKTRACE; return (EACCES); } mtx_unlock(&Giant); @@ -623,7 +623,7 @@ done: (void) vn_close(vp, FWRITE, td->td_ucred, td); mtx_unlock(&Giant); } - td->td_inktrace = 0; + td->td_pflags &= ~TDP_INKTRACE; return (error); #else /* !KTRACE */ return (ENOSYS); |