I have to write an application that will get tids of any other process than mine. I was wondering if anyone can give me a hint or something??? I know that, with devctl, i can get number of threads and tids always start from 1. The problem occurs when some threads finish and new start then number of threads may stay the same, but ids might be huge numbers.
What i have tried so far is something like that:
int i, fd, status;
/* opening process as file here*/
tstatus.tid = 1;
status = devctl(fd, DCMD_PROC_TIDSTATUS, &tstatus, sizeof(tstatus), NULL);
if (status != EOK)
printf(“Error no more threads\n”);
printf(“We have a thread with id: %d\n”, tstatus.tid);
I hope i explained my problem well. Thank you.
Edit: I edited this post because some of the stuff was invalid and I figured them by myself.
Edit2: I change code a little bit and this works. Please correct me if i am wrong.
The source to pidin is available on cvs.qnx.com. You should find what you need in there.
Yes i have checked this program before but took closer look today at it and as far as i see it does the same thing as i did. So i guess this is a way to go. Well i just have to check the flags in the status structure if thread is alive or not.
There is a book by Robern Krten called ‘The QNX Cookbook - recipies for QNX programmers’. In chapter 5 he describes and gives the source code to a Thread Fingerprint Utility he wrote. It’s purpose was to identify the various threads in any process.
You might want to see about getting a copy of this book if this is important. It’s a very good book and well worth having.
Thank you Tim! I will check out this book and yes its kind of important … we are doing college project for QNX and have major problems with finding any documentation. Basically, the only source of information was in the code written by a Kris Warkentin (found on google) and the pidin tool. I think we already got everything we needed, but who know what traps are there.