From fa4f951026f697bc042422d95a0806dcbab7ddd0 Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Fri, 29 Sep 2023 06:06:40 +0000 Subject: syscall: make origRlimitNofile atomic.Pointer[Rlimit] Currently we are bootstrapping with Go 1.20, origRlimitNofile can be changed to atomic.Pointer[Rlimit]. Change-Id: I00ce9d1a9030bd5dbd34e3dc6c4e38683a87be86 GitHub-Last-Rev: f2ccdb38412019d10661ed6be42086b445e411bf GitHub-Pull-Request: golang/go#63274 Reviewed-on: https://go-review.googlesource.com/c/go/+/531516 LUCI-TryBot-Result: Go LUCI Reviewed-by: qiulaidongfeng <2645477756@qq.com> Auto-Submit: Ian Lance Taylor Reviewed-by: Ian Lance Taylor Reviewed-by: Than McIntosh --- src/syscall/exec_linux.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/syscall/exec_linux.go') diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go index ac06fbf824..e1c71b5a34 100644 --- a/src/syscall/exec_linux.go +++ b/src/syscall/exec_linux.go @@ -248,7 +248,7 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att c uintptr ) - rlim, rlimOK := origRlimitNofile.Load().(Rlimit) + rlim := origRlimitNofile.Load() if sys.UidMappings != nil { puid = []byte("/proc/self/uid_map\000") @@ -628,8 +628,8 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att } // Restore original rlimit. - if rlimOK && rlim.Cur != 0 { - rawSetrlimit(RLIMIT_NOFILE, &rlim) + if rlim != nil { + rawSetrlimit(RLIMIT_NOFILE, rlim) } // Enable tracing if requested. -- cgit v1.3