summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-04-29 20:58:21 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-04-29 20:58:21 +0000
commitb3b22fcbdd1987d8840bf90bfc601c2bcbb007be (patch)
tree343549556f548eb5d96421234050ea27790da9d5
parent07152891c24ab1d43f647d7250f691842a473e84 (diff)
*** empty log message ***
-rw-r--r--proc/info.c90
1 files changed, 42 insertions, 48 deletions
diff --git a/proc/info.c b/proc/info.c
index 936345b9..ac7f3684 100644
--- a/proc/info.c
+++ b/proc/info.c
@@ -457,63 +457,57 @@ S_proc_getprocinfo (struct proc *callerp,
break;
}
- if ((flags & PI_FETCH_THREAD_WAITS)
- && p->p_msgport != MACH_PORT_NULL
- && !p->p_deadmsg)
+ if (flags & PI_FETCH_THREAD_WAITS)
{
- string_t desc;
- size_t desc_len;
-
/* See what thread I is waiting on. */
- if (p->p_msgport == MACH_PORT_NULL)
+ if (p->p_msgport == MACH_PORT_NULL || p->p_deadmsg)
flags &= ~PI_FETCH_THREAD_WAITS; /* Can't return much... */
-#if 0
- else if (nowait_msg_report_wait (p->p_msgport, thds[i]))
-#else
else
-#endif
- strcpy (desc, "failed"); /* Don't know. */
-#if 0
-
- /* See how long DESC is, being sure not to barf if it's
- unterminated (string_t's are fixed length). */
- desc_len =
- ((char *)memchr (desc, '\0', sizeof desc) ?: desc + sizeof desc)
- - desc;
-
- if (waits_used + desc_len + 1 > *waits_len)
- /* Not enough room in WAITS, we must allocate more. */
{
- char *new_waits = 0;
- mach_msg_type_number_t new_len =
- round_page (waits_used + desc_len + 1);
-
- err = vm_allocate (mach_task_self (),
- (vm_address_t *)&new_waits, new_len,1);
- if (err)
- /* Just don't return any more waits information. */
- flags &= ~PI_FETCH_THREAD_WAITS;
- else
+ string_t desc;
+ size_t desc_len;
+
+ if (msg_report_wait (p->p_msgport, thds[i],
+ desc, &pi->threadinfos[i].rpc_block))
+ desc[0] = '\0'; /* Don't know. */
+
+ /* See how long DESC is, being sure not to barf if it's
+ unterminated (string_t's are fixed length). */
+ desc_len = strnlen (desc, sizeof desc);
+
+ if (waits_used + desc_len + 1 > *waits_len)
+ /* Not enough room in WAITS, we must allocate more. */
{
- if (waits_used > 0)
- bcopy (*waits, new_waits, waits_used);
- if (*waits_len > 0 && waits_alloced)
- vm_deallocate (mach_task_self (),
- (vm_address_t)*waits, *waits_len);
- *waits = new_waits;
- *waits_len = new_len;
- waits_alloced = 1;
+ char *new_waits = 0;
+ mach_msg_type_number_t new_len =
+ round_page (waits_used + desc_len + 1);
+
+ err = vm_allocate (mach_task_self (),
+ (vm_address_t *)&new_waits, new_len,1);
+ if (err)
+ /* Just don't return any more waits information. */
+ flags &= ~PI_FETCH_THREAD_WAITS;
+ else
+ {
+ if (waits_used > 0)
+ bcopy (*waits, new_waits, waits_used);
+ if (*waits_len > 0 && waits_alloced)
+ vm_deallocate (mach_task_self (),
+ (vm_address_t)*waits, *waits_len);
+ *waits = new_waits;
+ *waits_len = new_len;
+ waits_alloced = 1;
+ }
}
- }
- if (waits_used + desc_len + 1 > *waits_len)
- /* Append DESC to WAITS. */
- {
- bcopy (desc, *waits + waits_used, desc_len);
- waits_used += desc_len;
- (*waits)[waits_used++] = '\0';
+ if (waits_used + desc_len + 1 > *waits_len)
+ /* Append DESC to WAITS. */
+ {
+ bcopy (desc, *waits + waits_used, desc_len);
+ waits_used += desc_len;
+ (*waits)[waits_used++] = '\0';
+ }
}
-#endif
}
mach_port_deallocate (mach_task_self (), thds[i]);