setup: provide helpers to inquire about necessary mlock sizes

5.12 and up will not require rlimit memlock allocations, but older
ones do. It can be hard for applications to know how much they need
without trial and error, so provide a set of helpers for them to
query it instead.

It's a bit ugly as it's mostly duplication of what the kernel does,
but as that code is now static and won't be updated as no new kernels
require memlock, that's probably not a huge issue.

Fixes: https://github.com/axboe/liburing/issues/246
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 files changed