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