Is there's a conf-* opam package to require to make sure ulimit is available?
ulimit
is not a separate program, it is a builtin utility of any posix-compliant shell. So, a conf-ulimit
package does not make sense. At best, it would be something like conf-bash
or similar, but I don't think those exist.
bash availability seems to be assumed in opam, e.g., package arg-complete
has no dependency on any bash-related stuff, despite being for bash
ulimit is indeed posix, but the stack option I guess @Jason Gross is after is not. See (https://pubs.opengroup.org/onlinepubs/009695399/utilities/ulimit.html).
Thinking about it I darkly remember that on some linux variants ulimit has no effect and that the preferred method is using prlimit these days, but I can't find proper references. prlimit is a separate executable, so one could have a conf package for it.
These settings is more about the process tree and system calls than about specific commands.
https://linux.die.net/man/2/setrlimit
https://linux.die.net/man/2/prctl
@Michael Soegtrop ulimit -m
is indeed useless (too complex) since ages, could that be what you're thinking? ulimit -s
seems easier to guarantee
@Paolo Giarrusso sorry I can't remember the details but I darkly remember that I have read somewhere that cause of some changes in modern Linux ulimit is not reliable any more and one should use prlimit now. But the main point is that since prlimit is a separate executable it is easier to guarantee to exist, but then it is likely harder to use.
Anyway, I would say we can use ulimit -s
without any extra precautions and further discuss this in case there are actual issues with it. Hopefully if a shell does not support it, it results in an immediate error.
FYI, we use ulimit also in the certicoq package
(for stack size)
Last updated: Jun 05 2023 at 10:01 UTC