src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/mods/unix/rlimit_keys.go (about) 1 //go:build unix 2 3 package unix 4 5 import "golang.org/x/sys/unix" 6 7 var rlimitKeys = map[int]string{ 8 // The following are defined by POSIX 9 // (https://pubs.opengroup.org/onlinepubs/9699919799/functions/getrlimit.html). 10 // 11 // Note: RLIMIT_AS is defined by POSIX, but missing on OpenBSD 12 // (https://man.openbsd.org/getrlimit.2#BUGS); it is defined on Darwin, but 13 // it's an undocumented alias of RLIMIT_RSS there. 14 unix.RLIMIT_CORE: "core", 15 unix.RLIMIT_CPU: "cpu", 16 unix.RLIMIT_DATA: "data", 17 unix.RLIMIT_FSIZE: "fsize", 18 unix.RLIMIT_NOFILE: "nofile", 19 unix.RLIMIT_STACK: "stack", 20 // The following are not defined by POSIX, but supported by every Unix OS 21 // Elvish supports (Linux, macOS, Free/Net/OpenBSD). See: 22 // 23 // - https://man7.org/linux/man-pages/man2/setrlimit.2.html 24 // - https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getrlimit.2.html 25 // - https://www.freebsd.org/cgi/man.cgi?query=getrlimit 26 // - https://man.netbsd.org/getrlimit.2 27 // - https://man.openbsd.org/getrlimit.2 28 unix.RLIMIT_MEMLOCK: "memlock", 29 unix.RLIMIT_NPROC: "nproc", 30 unix.RLIMIT_RSS: "rss", 31 } 32 33 //lint:ignore U1000 used on some OS 34 func addRlimitKeys(m map[int]string) { 35 for k, v := range m { 36 rlimitKeys[k] = v 37 } 38 }