pthread_getname_np()

Updated: April 19, 2023

Retrieve the name of a thread

Synopsis:

#include <pthread.h>

int pthread_getname_np(pthread_t tid,
                       char* buffer,
                       int buffersize);

Arguments:

tid
The ID of the thread whose name you want to get, or 0 to get the name of the calling thread.
buffer
A storage place for the name.
buffersize
The size of the buffer, in bytes.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_getname_np() function retrieves the name of the specified thread as a NULL-terminated string up to a maximum size (as determined by the buffersize). If the thread doesn't have a name, the function stores a NULL-terminated empty string in the buffer. The “np” in the function's name stands for “non-POSIX.”

Note: This function was added in the QNX Neutrino Core OS 6.3.2.

Returns:

EOK
Success.
EINVAL
The name buffer length is invalid or smaller than the new name length.
EPERM
You don't have the appropriate permissions to get the name.

Classification:

QNX Neutrino

Safety:  
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes