List of all topics

How can I list all threads in the current process in FreeBSD? Or at least get the number of threads.

I found a Linux system call pstat_getproc that returns a structure containing pst_nlwps , the number of threads. I am looking for something similar to this on FreeBSD.

Or maybe there is something like /dev/fd , but for threads.

All that I can use to get an idea of ​​how many other threads are working.

I want to be able to do this programmatically in C without using an existing application.

+5
source share
1 answer

Use procstat(1) e.g.

 # procstat -t $(pgrep openvpn) PID TID COMM TDNAME CPU PRI STATE WCHAN 537 100051 openvpn - 0 120 sleep select 

which depends on libprocstat(3) .

+2
source

All Articles