Forum > Operating Systems

Ubuntu: How to get pthread_t from tid [was: AV when using pthread_getname_np()]

<< < (3/5) > >>

Zvoni:

--- Quote from: Pascal on June 27, 2022, 12:14:26 pm ---Yes, right. The problem i have now is that i only have pid (process_id) and tid (task_id) but i need pthread_id!

--- End quote ---
Are you even calling "pthread_create" anywhere?

Zvoni:

--- Quote from: Pascal on June 27, 2022, 11:42:38 am ---Or should i use reading "/proc/[pid]/task/[tid]/comm"?

--- End quote ---
From the same link: https://linux.die.net/man/3/pthread_getname_np

--- Quote ---Notes

pthread_setname_np() internally writes to the thread specific comm file under /proc filesystem: /proc/self/task/[tid]/comm. pthread_getname_np() retrieves it from the same location. ยด
--- End quote ---

PascalDragon:

--- Quote from: MarkMLl on June 27, 2022, 12:22:38 pm ---even if it needs the good offices of Sven or Marco to get it into the RTL.

--- End quote ---

There is nothing that needs to be implemented in the RTL here, because we're talking about debugging third party applications (Pascal didn't clarify this, but I remembered that they had asked about this functionality in FpDebug some months ago).


--- Quote from: Zvoni on June 27, 2022, 12:53:31 pm ---
--- Quote from: Pascal on June 27, 2022, 12:14:26 pm ---Yes, right. The problem i have now is that i only have pid (process_id) and tid (task_id) but i need pthread_id!

--- End quote ---
Are you even calling "pthread_create" anywhere?

--- End quote ---

No, because this is about debugging third party applications.

MarkMLl:

--- Quote from: PascalDragon on June 27, 2022, 01:24:23 pm ---There is nothing that needs to be implemented in the RTL here, because we're talking about debugging third party applications (Pascal didn't clarify this, but I remembered that they had asked about this functionality in FpDebug some months ago).

--- End quote ---

In that case use /proc etc. without embarrassment, it's what it's for and in the area of per-process data (i.e. as distinct from all the guff about filesystems etc.) is moderately standardised across unix variants.

MarkMLl

Pascal:
Yes, right, it's all about debugging here as mentioned in initial post.

Well, is there really no way to get pthread_t from tid?

I am thinking of adding a lookup array to Threadmanager (rtl/unix/cthreads.pp) which is updated in CBeginThread.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---...AddThread(Do_SysCall(syscall_nr_gettid)), threadid);...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version