summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-07-16 21:00:11 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-07-17 13:01:21 +0200
commit2f0ed531c7f90e1d2d51871c68de7c813c4931c4 (patch)
tree425b9da15d79048172ccd770c80d84da093a0c8c
parenta449e9a2cf4b73163df75674059de04488cd2706 (diff)
downloadpodman-2f0ed531c7f90e1d2d51871c68de7c813c4931c4.tar.gz
podman-2f0ed531c7f90e1d2d51871c68de7c813c4931c4.tar.bz2
podman-2f0ed531c7f90e1d2d51871c68de7c813c4931c4.zip
spec: rework --ulimit host
it seems enough to not specify any ulimit block to maintain the host limits. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r--pkg/spec/spec.go14
-rw-r--r--pkg/spec/spec_linux.go42
-rw-r--r--pkg/spec/spec_unsupported.go7
3 files changed, 1 insertions, 62 deletions
diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go
index 53b73296a..6d8d399f4 100644
--- a/pkg/spec/spec.go
+++ b/pkg/spec/spec.go
@@ -20,12 +20,6 @@ import (
const cpuPeriod = 100000
-type systemUlimit struct {
- name string
- max uint64
- cur uint64
-}
-
func getAvailableGids() (int64, error) {
idMap, err := user.ParseIDMapFile("/proc/self/gid_map")
if err != nil {
@@ -585,13 +579,7 @@ func addRlimits(config *CreateConfig, g *generate.Generator) error {
if len(config.Resources.Ulimit) != 1 {
return errors.New("ulimit can use host only once")
}
- hostLimits, err := getHostRlimits()
- if err != nil {
- return err
- }
- for _, i := range hostLimits {
- g.AddProcessRlimits(i.name, i.max, i.cur)
- }
+ g.Config.Process.Rlimits = nil
break
}
diff --git a/pkg/spec/spec_linux.go b/pkg/spec/spec_linux.go
deleted file mode 100644
index fcdfc5c4e..000000000
--- a/pkg/spec/spec_linux.go
+++ /dev/null
@@ -1,42 +0,0 @@
-//+build linux
-
-package createconfig
-
-import (
- "syscall"
-
- "github.com/pkg/errors"
-)
-
-type systemRlimit struct {
- name string
- value int
-}
-
-var systemLimits = []systemRlimit{
- {"RLIMIT_AS", syscall.RLIMIT_AS},
- {"RLIMIT_CORE", syscall.RLIMIT_CORE},
- {"RLIMIT_CPU", syscall.RLIMIT_CPU},
- {"RLIMIT_DATA", syscall.RLIMIT_DATA},
- {"RLIMIT_FSIZE", syscall.RLIMIT_FSIZE},
- {"RLIMIT_NOFILE", syscall.RLIMIT_NOFILE},
- {"RLIMIT_STACK", syscall.RLIMIT_STACK},
-}
-
-func getHostRlimits() ([]systemUlimit, error) {
- ret := []systemUlimit{}
- for _, i := range systemLimits {
- var l syscall.Rlimit
- if err := syscall.Getrlimit(i.value, &l); err != nil {
- return nil, errors.Wrapf(err, "cannot read limits for %s", i.name)
- }
- s := systemUlimit{
- name: i.name,
- max: l.Max,
- cur: l.Cur,
- }
- ret = append(ret, s)
- }
- return ret, nil
-
-}
diff --git a/pkg/spec/spec_unsupported.go b/pkg/spec/spec_unsupported.go
deleted file mode 100644
index 0f6a9acdc..000000000
--- a/pkg/spec/spec_unsupported.go
+++ /dev/null
@@ -1,7 +0,0 @@
-//+build !linux
-
-package createconfig
-
-func getHostRlimits() ([]systemUlimit, error) {
- return nil, nil
-}