pthread_getthrds_np Subroutine
Purpose
Retrieves register and stack information for threads.
Library
Threads Library (libpthreads.a
)
Syntax
#include <pthread.h>
int pthread_getthrds_np (thread, mode, buf, bufsize, regbuf, regbufsize)
pthread_t *ptid;
int mode;
struct __pthrdsinfo *buf;
int bufsize;
void *regbuf;
int *regbufsize;
Description
The pthread_getthrds_np
subroutine retrieves information
on the state of the thread thread and its underlying kernel thread, including register and
stack information. The thread thread must be in suspended state to provide register
information for threads.
Parameters
Item | Description |
---|---|
thread | The pointer to the thread. On input it identifies the target thread of the operation, or 0
to operate on the first entry in the list of threads. On output it identifies the next entry in the
list of threads, or 0 if the end of the list has been reached. pthread_getthrds_np can be
used to traverse the whole list of threads by starting with thread pointing to 0
and calling pthread_getthrds_np repeatedly until it returns with thread
pointing to 0. |
mode | Specifies the type of query. These values can be bitwise or'ed together to specify more than
one type of query.
|
buf | Specifies the address of the struct __pthrdsinfo structure that will be filled in by
pthread_getthrds_np . On return, this structure holds the following data (depending on the
type of query requested):
If the
|
bufsize | The size of the __pthrdsinfo or __pthrdsinfox structure in
bytes. |
regbuf | The location of the buffer to hold the register save data and to pass the TLS information from the kernel if the thread is in a system call. |
regbufsize | The pointer to the size of the regbuf buffer. On input, it identifies the
maximum size of the buffer in bytes. On output, it identifies the number of bytes of register save
data and pass the TLS information. If the thread is not in a system call, there is no
register save data returned from the kernel, and regbufsize is 0. If the size of
the register save data is larger than the input value of regbufsize, the number
of bytes specified by the input value of regbufsize is copied to
regbuf, pthread_getthrds_np() returns ERANGE, and the output value of
regbufsize specifies the number of bytes required to hold all of the register
save data. |
Return Values
If successful, the pthread_getthrds_np
function
returns zero. Otherwise, an error number is returned to indicate the
error.
Error Codes
The pthread_getthrds_np
function will fail
if:
Item | Description |
---|---|
EINVAL |
Either thread or buf is NULL, or
bufsize is not equal to the size of the __pthrdsinfo structure in the
library. |
ESRCH |
No thread could be found corresponding to that specified by the thread ID thread. |
ERANGE |
regbuf was not large enough to handle all of the register save data. |
ENOMEM |
Insufficient memory exists to perform this operation. |