#pragma once #include "system-info.h" // Standard headers. #include #include #include #ifdef __cplusplus extern "C" { #endif extern pid_t gettid(); // This function returns an array of pid containing the pids of all the threads (takss) of the process 'p_pid'. // The last valid entry of this array is the one that is followed by an entry containing 0. // In case of error, this function returns NULL; errno will contains the error and a message was written in syslog. // When the function succeeds, its return value must be deallocated by calling the 'free' function. extern pid_t* listThreadsOfProcess(pid_t p_pid); // This function returns the name of the thread 'p_pid'. // This function is equivalent to pthread_setname_np but with a pid instead of a pthread_t. // 'po_dest' must point to a buffer of, at least, 16 characters. // On success, this function returns 0. Otherwise, it returns -1, errno will contains the error and a message was written in syslog. extern int getThreadName(pid_t p_pid, char* po_dest); #ifndef HAVE_PTHREAD_SETNAME_NP extern int pthread_setname_np(pthread_t p_handle, const char *p_name); #endif #ifdef __cplusplus } #endif