diff options
author | David Leonard <d@cvs.openbsd.org> | 1998-11-09 03:13:22 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1998-11-09 03:13:22 +0000 |
commit | ff47464de5e68e9c49fe312c953f54b2e90f546c (patch) | |
tree | 4ec0e7f13d619e1b5bf6abfd7125a4ec17569568 /lib/libpthread/uthread/uthread_info.c | |
parent | 1b2b2c2386c6cc5ebffc769b8a39b80d47e4e0d0 (diff) |
sync with FreeBSD (rwlock, gc thread, man pages)
add (broken) mips md stuff
fix some const warnings
add sigaltstack() stub
another hash at getting shlib auto-init to work (mips/elf and i386/a.out)
Diffstat (limited to 'lib/libpthread/uthread/uthread_info.c')
-rw-r--r-- | lib/libpthread/uthread/uthread_info.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/lib/libpthread/uthread/uthread_info.c b/lib/libpthread/uthread/uthread_info.c index bd829e8be55..9db574e7521 100644 --- a/lib/libpthread/uthread/uthread_info.c +++ b/lib/libpthread/uthread/uthread_info.c @@ -57,6 +57,7 @@ static const struct s_thread_info thread_info[] = { {PS_SELECT_WAIT , "Waiting on select"}, {PS_SLEEP_WAIT , "Sleeping"}, {PS_WAIT_WAIT , "Waiting process"}, + {PS_SIGSUSPEND , "Suspended, waiting for a signal"}, {PS_SIGWAIT , "Waiting for a signal"}, {PS_JOIN , "Waiting to join"}, {PS_SUSPENDED , "Suspended"}, @@ -67,7 +68,7 @@ static const struct s_thread_info thread_info[] = { void _thread_dump_info(void) { - char s[128]; + char s[512]; int fd; int i; int j; @@ -85,14 +86,20 @@ _thread_dump_info(void) _thread_sys_write(fd, s, strlen(s)); /* Enter a loop to report each thread in the global list: */ - for (pthread = _thread_link_list; pthread != NULL; pthread = pthread->nxt) { + for (pthread = _thread_link_list; pthread != NULL; + pthread = pthread->nxt) { /* Find the state: */ - for (j = 0; j < (sizeof(thread_info) / sizeof(struct s_thread_info)) - 1; j++) + for (j = 0; j < (sizeof(thread_info) / + sizeof(struct s_thread_info)) - 1; j++) if (thread_info[j].state == pthread->state) break; /* Output a record for the current thread: */ - sprintf(s, "--------------------\nThread %p (%s) prio %3d state %s [%s:%d]\n", - pthread, (pthread->name == NULL) ? "":pthread->name, pthread->pthread_priority, thread_info[j].name,pthread->fname,pthread->lineno); + snprintf(s, sizeof(s), + "--------------------\nThread %p (%s) prio %3d state %s [%s:%d]\n", + pthread, (pthread->name == NULL) ? + "":pthread->name, pthread->pthread_priority, + thread_info[j].name, + pthread->fname,pthread->lineno); _thread_sys_write(fd, s, strlen(s)); /* Check if this is the running thread: */ @@ -115,13 +122,19 @@ _thread_dump_info(void) case PS_FDR_WAIT: case PS_FDW_WAIT: /* Write the lock details: */ - sprintf(s, "fd %d[%s:%d]", pthread->data.fd.fd, pthread->data.fd.fname, pthread->data.fd.branch); + snprintf(s, sizeof(s), "fd %d[%s:%d]", + pthread->data.fd.fd, + pthread->data.fd.fname, + pthread->data.fd.branch); _thread_sys_write(fd, s, strlen(s)); - sprintf(s, "owner %pr/%pw\n", _thread_fd_table[pthread->data.fd.fd]->r_owner, _thread_fd_table[pthread->data.fd.fd]->w_owner); + snprintf(s, sizeof(s), "owner %pr/%pw\n", + _thread_fd_table[pthread->data.fd.fd]->r_owner, + _thread_fd_table[pthread->data.fd.fd]->w_owner); _thread_sys_write(fd, s, strlen(s)); break; case PS_SIGWAIT: - sprintf(s, "sigmask 0x%08lx\n", (unsigned long)pthread->sigmask); + snprintf(s, sizeof(s), "sigmask 0x%08lx\n", + (unsigned long)pthread->sigmask); _thread_sys_write(fd, s, strlen(s)); break; @@ -149,9 +162,13 @@ _thread_dump_info(void) * Enter a loop to report each thread in the global * dead thread list: */ - for (pthread = _thread_dead; pthread != NULL; pthread = pthread->nxt) { + for (pthread = _thread_dead; pthread != NULL; + pthread = pthread->nxt_dead) { /* Output a record for the current thread: */ - sprintf(s, "Thread %p prio %3d [%s:%d]\n", pthread, pthread->pthread_priority,pthread->fname,pthread->lineno); + snprintf(s, sizeof(s), + "Thread %p prio %3d [%s:%d]\n", + pthread, pthread->pthread_priority, + pthread->fname,pthread->lineno); _thread_sys_write(fd, s, strlen(s)); } } @@ -168,7 +185,8 @@ _thread_dump_info(void) */ if (_thread_fd_table[i] != NULL) { /* Report the file descriptor lock status: */ - sprintf(s, "fd[%3d] read owner %p count %d [%s:%d]\n write owner %p count %d [%s:%d]\n", + snprintf(s, sizeof(s), + "fd[%3d] read owner %p count %d [%s:%d]\n write owner %p count %d [%s:%d]\n", i, _thread_fd_table[i]->r_owner, _thread_fd_table[i]->r_lockcount, |