[rtems-libbsd commit] SLEEPQUEUE(9): Add wmesg to thread wait info

Sebastian Huber sebh at rtems.org
Tue Jan 31 09:11:23 UTC 2017


Module:    rtems-libbsd
Branch:    master
Commit:    1fd5083234c1657b9d7c22dcc2cd31255176c8e6
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=1fd5083234c1657b9d7c22dcc2cd31255176c8e6

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jan 31 09:50:45 2017 +0100

SLEEPQUEUE(9): Add wmesg to thread wait info

---

 freebsd/sys/kern/subr_sleepqueue.c | 5 ++++-
 freebsd/sys/sys/proc.h             | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/freebsd/sys/kern/subr_sleepqueue.c b/freebsd/sys/kern/subr_sleepqueue.c
index d0288d6..971f92d 100644
--- a/freebsd/sys/kern/subr_sleepqueue.c
+++ b/freebsd/sys/kern/subr_sleepqueue.c
@@ -399,12 +399,13 @@ sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags,
 	executing = td->td_thread;
 	_Thread_Wait_acquire_default(executing, &lock_context);
 	td->td_sq_state = TD_SQ_TIRED;
+	executing->Wait.return_argument_second.immutable_object = wmesg;
 #endif /* __rtems__ */
 	td->td_sleepqueue = NULL;
 	td->td_sqqueue = queue;
 	td->td_wchan = wchan;
-	td->td_wmesg = wmesg;
 #ifndef __rtems__
+	td->td_wmesg = wmesg;
 	if (flags & SLEEPQ_INTERRUPTIBLE) {
 		td->td_flags |= TDF_SINTR;
 		td->td_flags &= ~TDF_SLEEPABORT;
@@ -968,7 +969,9 @@ sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri)
 	_Thread_Wait_acquire_default_critical(thread, &lock_context);
 #endif /* __rtems__ */
 
+#ifndef __rtems__
 	td->td_wmesg = NULL;
+#endif /* __rtems__ */
 	td->td_wchan = NULL;
 #ifndef __rtems__
 	td->td_flags &= ~TDF_SINTR;
diff --git a/freebsd/sys/sys/proc.h b/freebsd/sys/sys/proc.h
index 81d96de..ee43997 100644
--- a/freebsd/sys/sys/proc.h
+++ b/freebsd/sys/sys/proc.h
@@ -260,8 +260,8 @@ struct thread {
 #endif /* __rtems__ */
 	int		td_sqqueue;	/* (t) Sleepqueue queue blocked on. */
 	void		*td_wchan;	/* (t) Sleep address. */
-	const char	*td_wmesg;	/* (t) Reason for sleep. */
 #ifndef __rtems__
+	const char	*td_wmesg;	/* (t) Reason for sleep. */
 	volatile u_char td_owepreempt;  /* (k*) Preempt on last critical_exit */
 	u_char		td_tsqueue;	/* (t) Turnstile queue blocked on. */
 	short		td_locks;	/* (k) Debug: count of non-spin locks */



More information about the vc mailing list