Gets kernel thread table entries.
Standard C library (libc.a)
#include <procinfo.h> #include <sys/types.h>
getthrds ( ProcessIdentifier, ThreadBuffer, ThreadSize, IndexPointer, Count)
struct thrdsinfo *ThreadBuffer;
or struct thrdsinfo64 *ThreadBuffer;
getthrds64 ( ProcessIdentifier, ThreadBuffer, ThreadSize, IndexPointer, Count)
struct thrdentry64 *ThreadBuffer;
The getthrds subroutine returns information about kernel threads, including kernel thread table information defined by the thrdsinfo or thrdsinfo64 structure.
The getthrds subroutine retrieves up to Count kernel thread table entries, starting with the entry corresponding to the thread identifier indicated by IndexPointer, and places them in the array of thrdsinfo or thrdsinfo64, or thrdentry64 structures indicated by the ThreadBuffer parameter.
On return, the kernel thread identifier referenced by IndexPointer is updated to indicate the next kernel thread table entry to be retrieved. The getthrds subroutine returns the number of kernel thread table entries retrieved.
If the ProcessIdentifier parameter indicates a process identifier, only kernel threads belonging to that process are considered. If this parameter is set to -1, all kernel threads are considered.
The getthrds subroutine is normally called repeatedly in a loop, starting with a kernel thread identifier of zero, and looping until the return value is less than Count, indicating that there are no more entries to retrieve.
When used in 32-bit mode, limits larger than can be represented in 32 bits are truncated to RLIM_INFINITY. Large values are truncated to INT_MAX. 64-bit applications are required to use getthrds64() and struct thrdentry64. Note that struct thrdentry64 contains the same information as struct thrdsinfo64 with the only difference being support for the 64-bit tid_t and the 256-bit sigset_t. Application developers are also encouraged to use getthrds64() in 32-bit applications to obtain 64-bit thread information as this interface provides the new, larger types. The getthrds() interface will still be supported for 32-bit applications using struct thrdsinfo or struct thrdsinfo64, but will not be available to 64-bit applications.
If successful, the getthrds subroutine returns the number of kernel thread table entries retrieved; if this is less than the number requested, the end of the kernel thread table has been reached. Otherwise, a value of -1 is returned, and the errno global variable is set to indicate the error.
subroutine fails if the following are true:
|EINVAL||The ThreadSize is invalid, or the IndexPointer parameter does not point to a valid kernel thread identifier, or the Count parameter is not greater than zero.|
|ESRCH||The process specified by the ProcessIdentifier parameter does not exist.|
|EFAULT||The copy operation to one of the buffers failed.|
This subroutine is part of the Base Operating System (BOS) Runtime.
The getpid (getpid, getpgrp, or getppid Subroutine), getpgrp (getpid, getpgrp, or getppid Subroutine), or getppid (getpid, getpgrp, or getppid Subroutine) subroutines, the getprocs (getprocs Subroutine) subroutine.
The ps command.