Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix socket to PID translation on FreeBSD. (#1070)
This file was derived from FreeBSD usr.bin/sockstat/sockstat.c. The logic of socket to PID translation was copied incorrectly. The hash, that sockstat(1) utility has, is completely internal feature, it isn't part of FreeBSD API, it is just to speed things up. So, to use this hash one actually needs to create it: declare array of buckets, populate it with sockets. In the freebsd_socks.c this wasn't done. This fix doesn't create the hash, instead it removes remnants of hashing that was there in sockstat.c. It makes code more simple, but of course slower than original sockstat(1) in case if machine is running zillions of sockets. I decided to go this way simply because I am low on time to invest into psutil, and also because better first provide correct and simple implementation and then improve it, rather than jump for complexity.
- Loading branch information