PROC_PIDLISTFDS is wrong

#1 · closed · 3 comments

View on GitHub ↗

zhangli-pear

I'm trying to retrive fd count for my process by `proc_pidinfo(...,PROC_PIDLISTFDS,...)`, it works in [C demo](https://github.com/palominolabs/get_process_handles/), but rust code does not. Finally, I found the problem. I think correct `PROC_PIDLISTFDS` value is 1, not 2. This is where I found it define. ``` bogon:include zhangli.pear$ pwd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include bogon:include zhangli.pear$ rg PROC_PIDLISTFDS sys/proc_info.h 656:#define PROC_PIDLISTFDS 1 ```

Comments

svartalf

Yeah, you are right, these values are way off. I changed them in `proc_info_consts` branch, can you confirm that they are working correctly for you now?

zhangli-pear

Yes, `PROC_PIDLISTFDS = 2` works well now.

svartalf

Great to hear! Fixed in 8a05df2ef2e9c0ab99c117f7ba6acea957843b04 and published at crates.io. I think it will be also nice to provide safer version in the `darwin-libproc` crate, but it should be done in another issue