summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-07-07 03:08:11 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-07-07 03:08:11 +0000
commita727b4630b4119952c10a354a12dc58aaaee8036 (patch)
tree324584688b193f8a942b29a4ce294c4fe173f200 /lib
parent339c2febb85f157eff8eba934d7b1b9dff894e34 (diff)
downloadFreeBSD-src-a727b4630b4119952c10a354a12dc58aaaee8036.zip
FreeBSD-src-a727b4630b4119952c10a354a12dc58aaaee8036.tar.gz
Print thread's scope, also print signal mask for every thread and print
it in one line.
Diffstat (limited to 'lib')
-rw-r--r--lib/libkse/thread/thr_info.c30
-rw-r--r--lib/libpthread/thread/thr_info.c30
2 files changed, 26 insertions, 34 deletions
diff --git a/lib/libkse/thread/thr_info.c b/lib/libkse/thread/thr_info.c
index 4410ace..edfe233 100644
--- a/lib/libkse/thread/thr_info.c
+++ b/lib/libkse/thread/thr_info.c
@@ -147,8 +147,9 @@ dump_thread(int fd, pthread_t pthread, int long_version)
/* Output a record for the thread: */
snprintf(s, sizeof(s),
"--------------------\n"
- "Thread %p (%s) prio %3d, blocked %s, state %s [%s:%d]\n",
+ "Thread %p (%s), scope %s, prio %3d, blocked %s, state %s [%s:%d]\n",
pthread, (pthread->name == NULL) ? "" : pthread->name,
+ pthread->attr.flags & PTHREAD_SCOPE_SYSTEM ? "system" : "process",
pthread->active_priority, (pthread->blocked != 0) ? "yes" : "no",
thread_info[i].name, pthread->fname, pthread->lineno);
__sys_write(fd, s, strlen(s));
@@ -166,29 +167,24 @@ dump_thread(int fd, pthread_t pthread, int long_version)
strcpy(s, "This is the initial thread\n");
__sys_write(fd, s, strlen(s));
}
- /* Check if this is the signal daemon thread: */
- if (pthread == _thr_sig_daemon) {
- /* Output a record for the signal thread: */
- strcpy(s, "This is the signal daemon thread\n");
+ snprintf(s, sizeof(s), "sigmask (hi) ");
+ __sys_write(fd, s, strlen(s));
+ for (i = _SIG_WORDS - 1; i >= 0; i--) {
+ snprintf(s, sizeof(s), "%08x ",
+ pthread->oldsigmask.__bits[i]);
__sys_write(fd, s, strlen(s));
}
+ snprintf(s, sizeof(s), "(lo)\n");
+ __sys_write(fd, s, strlen(s));
+
/* Process according to thread state: */
switch (pthread->state) {
case PS_SIGWAIT:
- snprintf(s, sizeof(s), "sigmask (hi)");
- __sys_write(fd, s, strlen(s));
- for (i = _SIG_WORDS - 1; i >= 0; i--) {
- snprintf(s, sizeof(s), "%08x\n",
- pthread->oldsigmask.__bits[i]);
- __sys_write(fd, s, strlen(s));
- }
- snprintf(s, sizeof(s), "(lo)\n");
- __sys_write(fd, s, strlen(s));
- snprintf(s, sizeof(s), "waitset (hi)");
+ snprintf(s, sizeof(s), "waitset (hi) ");
__sys_write(fd, s, strlen(s));
for (i = _SIG_WORDS - 1; i >= 0; i--) {
- snprintf(s, sizeof(s), "%08x\n",
- pthread->sigmask.__bits[i]);
+ snprintf(s, sizeof(s), "%08x ",
+ ~pthread->sigmask.__bits[i]);
__sys_write(fd, s, strlen(s));
}
snprintf(s, sizeof(s), "(lo)\n");
diff --git a/lib/libpthread/thread/thr_info.c b/lib/libpthread/thread/thr_info.c
index 4410ace..edfe233 100644
--- a/lib/libpthread/thread/thr_info.c
+++ b/lib/libpthread/thread/thr_info.c
@@ -147,8 +147,9 @@ dump_thread(int fd, pthread_t pthread, int long_version)
/* Output a record for the thread: */
snprintf(s, sizeof(s),
"--------------------\n"
- "Thread %p (%s) prio %3d, blocked %s, state %s [%s:%d]\n",
+ "Thread %p (%s), scope %s, prio %3d, blocked %s, state %s [%s:%d]\n",
pthread, (pthread->name == NULL) ? "" : pthread->name,
+ pthread->attr.flags & PTHREAD_SCOPE_SYSTEM ? "system" : "process",
pthread->active_priority, (pthread->blocked != 0) ? "yes" : "no",
thread_info[i].name, pthread->fname, pthread->lineno);
__sys_write(fd, s, strlen(s));
@@ -166,29 +167,24 @@ dump_thread(int fd, pthread_t pthread, int long_version)
strcpy(s, "This is the initial thread\n");
__sys_write(fd, s, strlen(s));
}
- /* Check if this is the signal daemon thread: */
- if (pthread == _thr_sig_daemon) {
- /* Output a record for the signal thread: */
- strcpy(s, "This is the signal daemon thread\n");
+ snprintf(s, sizeof(s), "sigmask (hi) ");
+ __sys_write(fd, s, strlen(s));
+ for (i = _SIG_WORDS - 1; i >= 0; i--) {
+ snprintf(s, sizeof(s), "%08x ",
+ pthread->oldsigmask.__bits[i]);
__sys_write(fd, s, strlen(s));
}
+ snprintf(s, sizeof(s), "(lo)\n");
+ __sys_write(fd, s, strlen(s));
+
/* Process according to thread state: */
switch (pthread->state) {
case PS_SIGWAIT:
- snprintf(s, sizeof(s), "sigmask (hi)");
- __sys_write(fd, s, strlen(s));
- for (i = _SIG_WORDS - 1; i >= 0; i--) {
- snprintf(s, sizeof(s), "%08x\n",
- pthread->oldsigmask.__bits[i]);
- __sys_write(fd, s, strlen(s));
- }
- snprintf(s, sizeof(s), "(lo)\n");
- __sys_write(fd, s, strlen(s));
- snprintf(s, sizeof(s), "waitset (hi)");
+ snprintf(s, sizeof(s), "waitset (hi) ");
__sys_write(fd, s, strlen(s));
for (i = _SIG_WORDS - 1; i >= 0; i--) {
- snprintf(s, sizeof(s), "%08x\n",
- pthread->sigmask.__bits[i]);
+ snprintf(s, sizeof(s), "%08x ",
+ ~pthread->sigmask.__bits[i]);
__sys_write(fd, s, strlen(s));
}
snprintf(s, sizeof(s), "(lo)\n");
OpenPOWER on IntegriCloud