2

In Linux I can do this by checking the /proc/pid/status file and looking for a line: Threads: 1 (or any number). How can I achieve the same in FreeBSD? I am not interested in any interactive tool. Is there any C function, or a system file? I have tried BSD's procfs and and linprocfs and I could not find any similair feature there.

1 Answers1

5

You want:

procstat -t <pid>

This answer is short, but I'm typing more to get the answer up to the minimum length.

Steve Wills
  • 740
  • 4
  • 8
  • Good breadcrumb, but the question asked for a C function or /proc file. The place to look for the C API calls used appears to be: https://github.com/freebsd/freebsd-src/blob/main/usr.bin/procstat/procstat_basic.c or https://github.com/freebsd/freebsd-src/blob/main/usr.bin/procstat/procstat_threads.c – gps Jan 23 '22 at 21:34