From c9cc468949d80c663524f5b764e2c661af13bca2 Mon Sep 17 00:00:00 2001 From: jingrui Date: Sat, 22 Dec 2018 16:25:07 +0800 Subject: [PATCH 03/27] oci: oci: add files cgroups support reason: Add file fds limit cherry-pick from containerd-0.2.8 29b822599b86f823d5a9f94df1cdceea485e0b19 Add file fds limit With the patch(https://lwn.net/Articles/604129/),we can limit the num of open files in container. Change-Id: I72b45430dd7535727c4af9e190bbb345ba8ee316 Signed-off-by: jingrui --- vendor/github.com/opencontainers/runtime-spec/specs-go/config.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vendor/github.com/opencontainers/runtime-spec/specs-go/config.go b/vendor/github.com/opencontainers/runtime-spec/specs-go/config.go index f32698c..ac24cde 100644 --- a/vendor/github.com/opencontainers/runtime-spec/specs-go/config.go +++ b/vendor/github.com/opencontainers/runtime-spec/specs-go/config.go @@ -314,6 +314,12 @@ type LinuxPids struct { Limit int64 `json:"limit"` } +// Files for Linux cgroup 'files' resource management (https://lwn.net/Articles/604129/) +type Files struct { + // Maximum number of open files". + Limit *int64 `json:"limit,omitempty"` +} + // LinuxNetwork identification and priority configuration type LinuxNetwork struct { // Set class identifier for container's network packets @@ -340,6 +346,8 @@ type LinuxResources struct { CPU *LinuxCPU `json:"cpu,omitempty"` // Task resource restriction configuration. Pids *LinuxPids `json:"pids,omitempty"` + // Files resource restriction configuration. + Files *Files `json:"files,omitempty"` // BlockIO restriction configuration BlockIO *LinuxBlockIO `json:"blockIO,omitempty"` // Hugetlb limit (in bytes) -- 2.7.4.3