How can I list all threads within the current process in FreeBSD? Or at least, get the number of threads running.
I found the Linux system call pstat_getproc
which returns a struct containing pst_nlwps
, the number of threads. I am looking for something similar to this on FreeBSD.
Or perhaps there is something like /dev/fd
but for threads.
Anything I can use to get some kind of idea about how many other threads are running.
I want to be able to do this programmatically in C, not using an existing application.
Use procstat(1)
, eg
# procstat -t $(pgrep openvpn)
PID TID COMM TDNAME CPU PRI STATE WCHAN
537 100051 openvpn - 0 120 sleep select
which depends on libprocstat(3)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With