Skip to content

Commit 3d07cbc

Browse files
authored
Merge pull request #4282 from lifubang/fix-comment-ClearRlimitNofileCache
Add a correct GoDoc format comment for ClearRlimitNofileCache
2 parents 4e8cf27 + a35f7d8 commit 3d07cbc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

libcontainer/system/linux.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ import (
1919
//go:linkname syscallOrigRlimitNofile syscall.origRlimitNofile
2020
var syscallOrigRlimitNofile atomic.Pointer[syscall.Rlimit]
2121

22-
// As reported in issue #4195, the new version of go runtime(since 1.19)
23-
// will cache rlimit-nofile. Before executing execve, the rlimit-nofile
24-
// of the process will be restored with the cache. In runc, this will
25-
// cause the rlimit-nofile setting by the parent process for the container
26-
// to become invalid. It can be solved by clearing this cache. But
27-
// unfortunately, go stdlib doesn't provide such function, so we need to
28-
// link to the private var `origRlimitNofile` in package syscall to hack.
22+
// ClearRlimitNofileCache is to clear go runtime's nofile rlimit cache.
2923
func ClearRlimitNofileCache() {
24+
// As reported in issue #4195, the new version of go runtime(since 1.19)
25+
// will cache rlimit-nofile. Before executing execve, the rlimit-nofile
26+
// of the process will be restored with the cache. In runc, this will
27+
// cause the rlimit-nofile setting by the parent process for the container
28+
// to become invalid. It can be solved by clearing this cache. But
29+
// unfortunately, go stdlib doesn't provide such function, so we need to
30+
// link to the private var `origRlimitNofile` in package syscall to hack.
3031
syscallOrigRlimitNofile.Store(nil)
3132
}
3233

0 commit comments

Comments
 (0)