@@ -143,7 +143,7 @@ static void set_cgroup_v1(const struct CONTAINER *_Nonnull container)
143143 char memory_cgroup_limit_path [PATH_MAX ] = { '\0' };
144144 sprintf (memory_cgroup_limit_path , "/sys/fs/cgroup/memory/%d/memory.limit_in_bytes" , container -> container_id );
145145 fd = open (memory_cgroup_limit_path , O_RDWR | O_CLOEXEC );
146- if (fd < 0 ) {
146+ if (fd < 0 && ! container -> no_warnings ) {
147147 warning ("{yellow}Set memory limit failed{clear}\n" );
148148 goto cpuset ;
149149 }
@@ -157,7 +157,7 @@ static void set_cgroup_v1(const struct CONTAINER *_Nonnull container)
157157 sprintf (memory_cgroup_procs_path , "/sys/fs/cgroup/memory/%d/cgroup.procs" , container -> container_id );
158158 // Add pid to container_id memory cgroup.
159159 fd = open (memory_cgroup_procs_path , O_RDWR | O_CLOEXEC );
160- if (fd < 0 ) {
160+ if (fd < 0 && ! container -> no_warnings ) {
161161 warning ("{yellow}Set memory limit failed{clear}\n" );
162162 goto cpuset ;
163163 }
@@ -170,7 +170,7 @@ static void set_cgroup_v1(const struct CONTAINER *_Nonnull container)
170170 char cpuset_cgroup_mems_path [PATH_MAX ] = { '\0' };
171171 sprintf (cpuset_cgroup_mems_path , "/sys/fs/cgroup/cpuset/%d/cpuset.mems" , container -> container_id );
172172 fd = open (cpuset_cgroup_mems_path , O_RDWR | O_CLOEXEC );
173- if (fd < 0 ) {
173+ if (fd < 0 && ! container -> no_warnings ) {
174174 warning ("{yellow}Set cpuset limit failed{clear}\n" );
175175 // Do not keep the apifs mounted.
176176 umount2 ("/sys/fs/cgroup" , MNT_DETACH | MNT_FORCE );
@@ -181,7 +181,7 @@ static void set_cgroup_v1(const struct CONTAINER *_Nonnull container)
181181 char cpuset_cgroup_cpus_path [PATH_MAX ] = { '\0' };
182182 sprintf (cpuset_cgroup_cpus_path , "/sys/fs/cgroup/cpuset/%d/cpuset.cpus" , container -> container_id );
183183 fd = open (cpuset_cgroup_cpus_path , O_RDWR | O_CLOEXEC );
184- if (fd < 0 ) {
184+ if (fd < 0 && ! container -> no_warnings ) {
185185 warning ("{yellow}Set cpuset limit failed{clear}\n" );
186186 // Do not keep the apifs mounted.
187187 umount2 ("/sys/fs/cgroup" , MNT_DETACH | MNT_FORCE );
@@ -197,7 +197,7 @@ static void set_cgroup_v1(const struct CONTAINER *_Nonnull container)
197197 sprintf (cpuset_cgroup_procs_path , "/sys/fs/cgroup/cpuset/%d/cgroup.procs" , container -> container_id );
198198 // Add pid to container_id cpuset cgroup.
199199 fd = open (cpuset_cgroup_procs_path , O_RDWR | O_CLOEXEC );
200- if (fd < 0 ) {
200+ if (fd < 0 && ! container -> no_warnings ) {
201201 warning ("{yellow}Set cpuset limit failed{clear}\n" );
202202 // Do not keep the apifs mounted.
203203 umount2 ("/sys/fs/cgroup" , MNT_DETACH | MNT_FORCE );
@@ -224,7 +224,7 @@ static void set_cgroup_v2(const struct CONTAINER *_Nonnull container)
224224 sprintf (cgroup_procs_path , "/sys/fs/cgroup/%d/cgroup.procs" , container -> container_id );
225225 // Add pid to container_id cgroup.
226226 int fd = open (cgroup_procs_path , O_RDWR | O_CLOEXEC );
227- if (fd < 0 ) {
227+ if (fd < 0 && ! container -> no_warnings ) {
228228 warning ("{yellow}Set cgroup.procs failed{clear}\n" );
229229 // Do not keep the apifs mounted.
230230 umount2 ("/sys/fs/cgroup" , MNT_DETACH | MNT_FORCE );
@@ -238,7 +238,7 @@ static void set_cgroup_v2(const struct CONTAINER *_Nonnull container)
238238 char cgroup_memlimit_path [PATH_MAX ] = { '\0' };
239239 sprintf (cgroup_memlimit_path , "/sys/fs/cgroup/%d/memory.high" , container -> container_id );
240240 fd = open (cgroup_memlimit_path , O_RDWR | O_CLOEXEC );
241- if (fd < 0 ) {
241+ if (fd < 0 && ! container -> no_warnings ) {
242242 warning ("{yellow}Set memory limit failed{clear}\n" );
243243 // Do not keep the apifs mounted.
244244 umount2 ("/sys/fs/cgroup" , MNT_DETACH | MNT_FORCE );
@@ -255,7 +255,7 @@ static void set_cgroup_v2(const struct CONTAINER *_Nonnull container)
255255 char cgroup_cpuset_path [PATH_MAX ] = { '\0' };
256256 sprintf (cgroup_cpuset_path , "/sys/fs/cgroup/%d/cpuset.cpus" , container -> container_id );
257257 fd = open (cgroup_cpuset_path , O_RDWR | O_CLOEXEC );
258- if (fd < 0 ) {
258+ if (fd < 0 && ! container -> no_warnings ) {
259259 warning ("{yellow}Set cpu limit failed{clear}\n" );
260260 // Do not keep the apifs mounted.
261261 umount2 ("/sys/fs/cgroup" , MNT_DETACH | MNT_FORCE );
0 commit comments