rbtcollins / effective-limits.rs

Estimate effective resource limits for a process e.g. how much RAM is available for use
Apache License 2.0
13 stars 10 forks source link

OpenBSD Support #17

Open hargoniX opened 2 years ago

hargoniX commented 2 years ago

I'd like to build OpenBSD support for rustup (which has this crate as a dependency). However it doesn't compile at the moment since as noted in your libc comments OpenBSD doesn't have the RLIMIT_AS constant. I did a little bit of digging and it appears to me that OpenBSD doesn't have support at all for determining the limit of the virtual memory address space size. Thus I would propose to only request the RLIMIT_DATA (which is supported https://github.com/openbsd/src/blob/master/sys/sys/resource.h#L84) for OpenBSD and use that as a limit. If this seems reasonable I'd happily do a PR for it.

kinnison commented 2 years ago

I guess it might make sense for OpenBSD. If you do a PR, I'd suggest ensuring that behaviour doesn't change for the other platforms though.