mirror of
https://github.com/containers/podman.git
synced 2025-07-14 10:09:13 +08:00
Merge pull request #2126 from giuseppe/set-prlimit
podman: bump RLIMIT_NOFILE also without CAP_SYS_RESOURCE
This commit is contained in:
@ -148,16 +148,20 @@ func main() {
|
|||||||
logrus.SetLevel(level)
|
logrus.SetLevel(level)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only if not rootless, set rlimits for open files.
|
rlimits := new(syscall.Rlimit)
|
||||||
// We open numerous FDs for ports opened
|
rlimits.Cur = 1048576
|
||||||
if !rootless.IsRootless() {
|
rlimits.Max = 1048576
|
||||||
rlimits := new(syscall.Rlimit)
|
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil {
|
||||||
rlimits.Cur = 1048576
|
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil {
|
||||||
rlimits.Max = 1048576
|
return errors.Wrapf(err, "error getting rlimits")
|
||||||
|
}
|
||||||
|
rlimits.Cur = rlimits.Max
|
||||||
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil {
|
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, rlimits); err != nil {
|
||||||
return errors.Wrapf(err, "error setting new rlimits")
|
return errors.Wrapf(err, "error setting new rlimits")
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if rootless.IsRootless() {
|
||||||
logrus.Info("running as rootless")
|
logrus.Info("running as rootless")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// +build seccomp ostree selinux varlink exclude_graphdriver_devicemapper
|
// +build seccomp ostree selinux varlink exclude_graphdriver_devicemapper
|
||||||
|
|
||||||
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT
|
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
|
||||||
|
|
||||||
package libpod
|
package libpod
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user