aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-03-22 13:33:14 -0700
committerIan Lance Taylor <iant@google.com>2023-04-14 18:01:07 +0000
commit130a7f8e8d5d3ecb7f17a741cc18e96f134fc38a (patch)
tree51411015b9debbf6c05a5e38861bbe6fdc458d73
parentabb86e6e82ec67f7b7cecd8c6225466b25ca2814 (diff)
downloadgo-130a7f8e8d5d3ecb7f17a741cc18e96f134fc38a.tar.gz
go-130a7f8e8d5d3ecb7f17a741cc18e96f134fc38a.zip
[release-branch.go1.19] syscall: restore original NOFILE rlimit in child process
If we increased the NOFILE rlimit when starting the program, restore the original rlimit when forking a child process. In CL 393354 the os package was changed to raise the open file rlimit at program start. That code is not inherently tied to the os package. This CL moves it into the syscall package. This is a backport of CLs 476096 and 476097 from trunk. For #46279 Fixes #59063 Change-Id: I9be6ecc52d4f82eb226907611aec9df808e1da84 Reviewed-on: https://go-review.googlesource.com/c/go/+/478660 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
-rw-r--r--src/runtime/syscall2_solaris.go2
-rw-r--r--src/runtime/syscall_aix.go10
-rw-r--r--src/runtime/syscall_solaris.go14
-rw-r--r--src/syscall/asm_solaris_amd64.s3
-rw-r--r--src/syscall/exec_bsd.go7
-rw-r--r--src/syscall/exec_freebsd.go7
-rw-r--r--src/syscall/exec_libc.go8
-rw-r--r--src/syscall/exec_libc2.go7
-rw-r--r--src/syscall/exec_linux.go7
-rw-r--r--src/syscall/exec_unix.go5
-rw-r--r--src/syscall/exec_unix_test.go44
-rw-r--r--src/syscall/export_rlimit_test.go14
-rw-r--r--src/syscall/rlimit.go (renamed from src/os/rlimit.go)28
-rw-r--r--src/syscall/rlimit_darwin.go (renamed from src/os/rlimit_darwin.go)8
-rw-r--r--src/syscall/rlimit_stub.go (renamed from src/os/rlimit_stub.go)6
-rw-r--r--src/syscall/rlimit_test.go (renamed from src/os/rlimit_test.go)8
-rw-r--r--src/syscall/syscall_aix.go2
-rw-r--r--src/syscall/syscall_darwin.go2
-rw-r--r--src/syscall/syscall_dragonfly.go2
-rw-r--r--src/syscall/syscall_freebsd.go2
-rw-r--r--src/syscall/syscall_linux.go13
-rw-r--r--src/syscall/syscall_linux_386.go33
-rw-r--r--src/syscall/syscall_linux_amd64.go12
-rw-r--r--src/syscall/syscall_linux_arm.go33
-rw-r--r--src/syscall/syscall_linux_arm64.go18
-rw-r--r--src/syscall/syscall_linux_loong64.go10
-rw-r--r--src/syscall/syscall_linux_mips64x.go12
-rw-r--r--src/syscall/syscall_linux_mipsx.go33
-rw-r--r--src/syscall/syscall_linux_ppc64x.go12
-rw-r--r--src/syscall/syscall_linux_riscv64.go8
-rw-r--r--src/syscall/syscall_linux_s390x.go8
-rw-r--r--src/syscall/syscall_netbsd.go2
-rw-r--r--src/syscall/syscall_openbsd.go2
-rw-r--r--src/syscall/syscall_solaris.go2
-rw-r--r--src/syscall/zsyscall_aix_ppc64.go2
-rw-r--r--src/syscall/zsyscall_darwin_amd64.go2
-rw-r--r--src/syscall/zsyscall_darwin_arm64.go2
-rw-r--r--src/syscall/zsyscall_dragonfly_amd64.go2
-rw-r--r--src/syscall/zsyscall_freebsd_386.go2
-rw-r--r--src/syscall/zsyscall_freebsd_amd64.go2
-rw-r--r--src/syscall/zsyscall_freebsd_arm.go2
-rw-r--r--src/syscall/zsyscall_freebsd_arm64.go2
-rw-r--r--src/syscall/zsyscall_linux_386.go4
-rw-r--r--src/syscall/zsyscall_linux_amd64.go4
-rw-r--r--src/syscall/zsyscall_linux_arm.go4
-rw-r--r--src/syscall/zsyscall_linux_arm64.go4
-rw-r--r--src/syscall/zsyscall_linux_loong64.go2
-rw-r--r--src/syscall/zsyscall_linux_mips.go4
-rw-r--r--src/syscall/zsyscall_linux_mips64.go4
-rw-r--r--src/syscall/zsyscall_linux_mips64le.go4
-rw-r--r--src/syscall/zsyscall_linux_mipsle.go4
-rw-r--r--src/syscall/zsyscall_linux_ppc64.go4
-rw-r--r--src/syscall/zsyscall_linux_ppc64le.go4
-rw-r--r--src/syscall/zsyscall_linux_riscv64.go4
-rw-r--r--src/syscall/zsyscall_linux_s390x.go4
-rw-r--r--src/syscall/zsyscall_netbsd_386.go2
-rw-r--r--src/syscall/zsyscall_netbsd_amd64.go2
-rw-r--r--src/syscall/zsyscall_netbsd_arm.go2
-rw-r--r--src/syscall/zsyscall_netbsd_arm64.go2
-rw-r--r--src/syscall/zsyscall_openbsd_386.go2
-rw-r--r--src/syscall/zsyscall_openbsd_amd64.go2
-rw-r--r--src/syscall/zsyscall_openbsd_arm.go2
-rw-r--r--src/syscall/zsyscall_openbsd_arm64.go2
-rw-r--r--src/syscall/zsyscall_openbsd_mips64.go2
-rw-r--r--src/syscall/zsyscall_solaris_amd64.go2
65 files changed, 381 insertions, 89 deletions
diff --git a/src/runtime/syscall2_solaris.go b/src/runtime/syscall2_solaris.go
index 33104892021..d464f284bcb 100644
--- a/src/runtime/syscall2_solaris.go
+++ b/src/runtime/syscall2_solaris.go
@@ -17,6 +17,7 @@ import _ "unsafe" // for go:linkname
//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
//go:cgo_import_dynamic libc_setgid setgid "libc.so"
//go:cgo_import_dynamic libc_setgroups setgroups "libc.so"
+//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.so"
//go:cgo_import_dynamic libc_setsid setsid "libc.so"
//go:cgo_import_dynamic libc_setuid setuid "libc.so"
//go:cgo_import_dynamic libc_setpgid setpgid "libc.so"
@@ -34,6 +35,7 @@ import _ "unsafe" // for go:linkname
//go:linkname libc_ioctl libc_ioctl
//go:linkname libc_setgid libc_setgid
//go:linkname libc_setgroups libc_setgroups
+//go:linkname libc_setrlimit libc_setrlimit
//go:linkname libc_setsid libc_setsid
//go:linkname libc_setuid libc_setuid
//go:linkname libc_setpgid libc_setpgid
diff --git a/src/runtime/syscall_aix.go b/src/runtime/syscall_aix.go
index f294922e7dd..fdc6eed1c4c 100644
--- a/src/runtime/syscall_aix.go
+++ b/src/runtime/syscall_aix.go
@@ -18,6 +18,7 @@ import "unsafe"
//go:cgo_import_dynamic libc_ioctl ioctl "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_setgid setgid "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_setgroups setgroups "libc.a/shr_64.o"
+//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_setsid setsid "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_setuid setuid "libc.a/shr_64.o"
//go:cgo_import_dynamic libc_setpgid setpgid "libc.a/shr_64.o"
@@ -31,6 +32,7 @@ import "unsafe"
//go:linkname libc_ioctl libc_ioctl
//go:linkname libc_setgid libc_setgid
//go:linkname libc_setgroups libc_setgroups
+//go:linkname libc_setrlimit libc_setrlimit
//go:linkname libc_setsid libc_setsid
//go:linkname libc_setuid libc_setuid
//go:linkname libc_setpgid libc_setpgid
@@ -45,6 +47,7 @@ var (
libc_ioctl,
libc_setgid,
libc_setgroups,
+ libc_setrlimit,
libc_setsid,
libc_setuid,
libc_setpgid libFunc
@@ -199,6 +202,13 @@ func syscall_setgroups1(ngid, gid uintptr) (err uintptr) {
return
}
+//go:linkname syscall_setrlimit1 syscall.setrlimit1
+//go:nosplit
+func syscall_setrlimit1(which uintptr, lim unsafe.Pointer) (err uintptr) {
+ _, err = syscall2(&libc_setrlimit, which, uintptr(lim))
+ return
+}
+
//go:linkname syscall_setsid syscall.setsid
//go:nosplit
func syscall_setsid() (pid, err uintptr) {
diff --git a/src/runtime/syscall_solaris.go b/src/runtime/syscall_solaris.go
index e7bab3b23fb..9faee9ec468 100644
--- a/src/runtime/syscall_solaris.go
+++ b/src/runtime/syscall_solaris.go
@@ -18,6 +18,7 @@ var (
libc_ioctl,
libc_setgid,
libc_setgroups,
+ libc_setrlimit,
libc_setsid,
libc_setuid,
libc_setpgid,
@@ -235,6 +236,19 @@ func syscall_setgroups(ngid, gid uintptr) (err uintptr) {
}
//go:nosplit
+//go:linkname syscall_setrlimit
+//go:cgo_unsafe_args
+func syscall_setrlimit(which uintptr, lim unsafe.Pointer) (err uintptr) {
+ call := libcall{
+ fn: uintptr(unsafe.Pointer(&libc_setrlimit)),
+ n: 2,
+ args: uintptr(unsafe.Pointer(&which)),
+ }
+ asmcgocall(unsafe.Pointer(&asmsysvicall6x), unsafe.Pointer(&call))
+ return call.err
+}
+
+//go:nosplit
//go:linkname syscall_setsid
func syscall_setsid() (pid, err uintptr) {
call := libcall{
diff --git a/src/syscall/asm_solaris_amd64.s b/src/syscall/asm_solaris_amd64.s
index 3672d3667fa..41c56091b7c 100644
--- a/src/syscall/asm_solaris_amd64.s
+++ b/src/syscall/asm_solaris_amd64.s
@@ -60,6 +60,9 @@ TEXT ·setgid(SB),NOSPLIT,$0
TEXT ·setgroups1(SB),NOSPLIT,$0
JMP runtime·syscall_setgroups(SB)
+TEXT ·setrlimit1(SB),NOSPLIT,$0
+ JMP runtime·syscall_setrlimit(SB)
+
TEXT ·setsid(SB),NOSPLIT,$0
JMP runtime·syscall_setsid(SB)
diff --git a/src/syscall/exec_bsd.go b/src/syscall/exec_bsd.go
index 4762ae751a3..2bd8440ac37 100644
--- a/src/syscall/exec_bsd.go
+++ b/src/syscall/exec_bsd.go
@@ -61,6 +61,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
i int
)
+ rlim, rlimOK := origRlimitNofile.Load().(Rlimit)
+
// guard against side effects of shuffling fds below.
// Make sure that nextfd is beyond any currently open files so
// that we can't run the risk of overwriting any of them.
@@ -266,6 +268,11 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
}
+ // Restore original rlimit.
+ if rlimOK && rlim.Cur != 0 {
+ RawSyscall(SYS_SETRLIMIT, uintptr(RLIMIT_NOFILE), uintptr(unsafe.Pointer(&rlim)), 0)
+ }
+
// Time to exec.
_, _, err1 = RawSyscall(SYS_EXECVE,
uintptr(unsafe.Pointer(argv0)),
diff --git a/src/syscall/exec_freebsd.go b/src/syscall/exec_freebsd.go
index 851b8fbd06a..b4132ca3f38 100644
--- a/src/syscall/exec_freebsd.go
+++ b/src/syscall/exec_freebsd.go
@@ -66,6 +66,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
i int
)
+ rlim, rlimOK := origRlimitNofile.Load().(Rlimit)
+
// Record parent PID so child can test if it has died.
ppid, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
@@ -283,6 +285,11 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
}
+ // Restore original rlimit.
+ if rlimOK && rlim.Cur != 0 {
+ RawSyscall(SYS_SETRLIMIT, uintptr(RLIMIT_NOFILE), uintptr(unsafe.Pointer(&rlim)), 0)
+ }
+
// Time to exec.
_, _, err1 = RawSyscall(SYS_EXECVE,
uintptr(unsafe.Pointer(argv0)),
diff --git a/src/syscall/exec_libc.go b/src/syscall/exec_libc.go
index aee1b8c98ab..75a67c94c57 100644
--- a/src/syscall/exec_libc.go
+++ b/src/syscall/exec_libc.go
@@ -53,6 +53,7 @@ func getpid() (pid uintptr, err Errno)
func ioctl(fd uintptr, req uintptr, arg uintptr) (err Errno)
func setgid(gid uintptr) (err Errno)
func setgroups1(ngid uintptr, gid uintptr) (err Errno)
+func setrlimit1(which uintptr, lim unsafe.Pointer) (err Errno)
func setsid() (pid uintptr, err Errno)
func setuid(uid uintptr) (err Errno)
func setpgid(pid uintptr, pgid uintptr) (err Errno)
@@ -87,6 +88,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
i int
)
+ rlim, rlimOK := origRlimitNofile.Load().(Rlimit)
+
// guard against side effects of shuffling fds below.
// Make sure that nextfd is beyond any currently open files so
// that we can't run the risk of overwriting any of them.
@@ -289,6 +292,11 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
}
+ // Restore original rlimit.
+ if rlimOK && rlim.Cur != 0 {
+ setrlimit1(RLIMIT_NOFILE, unsafe.Pointer(&rlim))
+ }
+
// Time to exec.
err1 = execve(
uintptr(unsafe.Pointer(argv0)),
diff --git a/src/syscall/exec_libc2.go b/src/syscall/exec_libc2.go
index 9eb61a5d351..499a5deb7e0 100644
--- a/src/syscall/exec_libc2.go
+++ b/src/syscall/exec_libc2.go
@@ -62,6 +62,8 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
i int
)
+ rlim, rlimOK := origRlimitNofile.Load().(Rlimit)
+
// guard against side effects of shuffling fds below.
// Make sure that nextfd is beyond any currently open files so
// that we can't run the risk of overwriting any of them.
@@ -266,6 +268,11 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
}
}
+ // Restore original rlimit.
+ if rlimOK && rlim.Cur != 0 {
+ rawSyscall(abi.FuncPCABI0(libc_setrlimit_trampoline), uintptr(RLIMIT_NOFILE), uintptr(unsafe.Pointer(&rlim)), 0)
+ }
+
// Time to exec.
_, _, err1 = rawSyscall(abi.FuncPCABI0(libc_execve_trampoline),
uintptr(unsafe.Pointer(argv0)),
diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go
index 554aad412d3..cb7127771ee 100644
--- a/src/syscall/exec_linux.go
+++ b/src/syscall/exec_linux.go
@@ -171,6 +171,8 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att
uidmap, setgroups, gidmap []byte
)
+ rlim, rlimOK := origRlimitNofile.Load().(Rlimit)
+
if sys.UidMappings != nil {
puid = []byte("/proc/self/uid_map\000")
uidmap = formatIDMappings(sys.UidMappings)
@@ -519,6 +521,11 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att
}
}
+ // Restore original rlimit.
+ if rlimOK && rlim.Cur != 0 {
+ rawSetrlimit(RLIMIT_NOFILE, &rlim)
+ }
+
// Enable tracing if requested.
// Do this right before exec so that we don't unnecessarily trace the runtime
// setting up after the fork. See issue #21428.
diff --git a/src/syscall/exec_unix.go b/src/syscall/exec_unix.go
index 286be454d88..40e9b9feda5 100644
--- a/src/syscall/exec_unix.go
+++ b/src/syscall/exec_unix.go
@@ -282,6 +282,11 @@ func Exec(argv0 string, argv []string, envv []string) (err error) {
}
runtime_BeforeExec()
+ rlim, rlimOK := origRlimitNofile.Load().(Rlimit)
+ if rlimOK && rlim.Cur != 0 {
+ Setrlimit(RLIMIT_NOFILE, &rlim)
+ }
+
var err1 error
if runtime.GOOS == "solaris" || runtime.GOOS == "illumos" || runtime.GOOS == "aix" {
// RawSyscall should never be used on Solaris, illumos, or AIX.
diff --git a/src/syscall/exec_unix_test.go b/src/syscall/exec_unix_test.go
index 4253cda5cb6..033f5359552 100644
--- a/src/syscall/exec_unix_test.go
+++ b/src/syscall/exec_unix_test.go
@@ -7,12 +7,15 @@
package syscall_test
import (
+ "bytes"
+ "fmt"
"internal/testenv"
"io"
"math/rand"
"os"
"os/exec"
"os/signal"
+ "strconv"
"syscall"
"testing"
"time"
@@ -345,3 +348,44 @@ func TestExecHelper(t *testing.T) {
t.Error("syscall.Exec returned")
}
+
+// Test that rlimit values are restored by exec.
+func TestRlimitRestored(t *testing.T) {
+ if os.Getenv("GO_WANT_HELPER_PROCESS") != "" {
+ fmt.Println(syscall.OrigRlimitNofile().Cur)
+ os.Exit(0)
+ }
+
+ testenv.MustHaveExec(t)
+
+ orig := syscall.OrigRlimitNofile()
+ if orig.Cur == 0 {
+ t.Skip("skipping test because rlimit not adjusted at startup")
+ }
+
+ executable, err := os.Executable()
+ if err != nil {
+ executable = os.Args[0]
+ }
+
+ cmd := exec.Command(executable, "-test.run=TestRlimitRestored")
+ cmd = testenv.CleanCmdEnv(cmd)
+ cmd.Env = append(cmd.Env, "GO_WANT_HELPER_PROCESS=1")
+
+ out, err := cmd.CombinedOutput()
+ if len(out) > 0 {
+ t.Logf("%s", out)
+ }
+ if err != nil {
+ t.Fatalf("subprocess failed: %v", err)
+ }
+ s := string(bytes.TrimSpace(out))
+ v, err := strconv.ParseUint(s, 10, 64)
+ if err != nil {
+ t.Fatalf("could not parse %q as number: %v", s, v)
+ }
+
+ if v != uint64(orig.Cur) {
+ t.Errorf("exec rlimit = %d, want %d", v, orig)
+ }
+}
diff --git a/src/syscall/export_rlimit_test.go b/src/syscall/export_rlimit_test.go
new file mode 100644
index 00000000000..320e331c588
--- /dev/null
+++ b/src/syscall/export_rlimit_test.go
@@ -0,0 +1,14 @@
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build unix
+
+package syscall
+
+func OrigRlimitNofile() Rlimit {
+ if rlim, ok := origRlimitNofile.Load().(Rlimit); ok {
+ return rlim
+ }
+ return Rlimit{0, 0}
+}
diff --git a/src/os/rlimit.go b/src/syscall/rlimit.go
index a89414d098b..06e7a5d8b14 100644
--- a/src/os/rlimit.go
+++ b/src/syscall/rlimit.go
@@ -4,9 +4,16 @@
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
-package os
+package syscall
-import "syscall"
+import (
+ "sync/atomic"
+)
+
+// origRlimitNofile, if not {0, 0}, is the original soft RLIMIT_NOFILE.
+// When we can assume that we are bootstrapping with Go 1.19,
+// this can be atomic.Pointer[Rlimit].
+var origRlimitNofile atomic.Value // of Rlimit
// Some systems set an artificially low soft limit on open file count, for compatibility
// with code that uses select and its hard-coded maximum file descriptor
@@ -23,10 +30,21 @@ import "syscall"
// Code that really wants Go to leave the limit alone can set the hard limit,
// which Go of course has no choice but to respect.
func init() {
- var lim syscall.Rlimit
- if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &lim); err == nil && lim.Cur != lim.Max {
+ var lim Rlimit
+ if err := Getrlimit(RLIMIT_NOFILE, &lim); err == nil && lim.Cur != lim.Max {
+ origRlimitNofile.Store(lim)
lim.Cur = lim.Max
adjustFileLimit(&lim)
- syscall.Setrlimit(syscall.RLIMIT_NOFILE, &lim)
+ setrlimit(RLIMIT_NOFILE, &lim)
+ }
+}
+
+func Setrlimit(resource int, rlim *Rlimit) error {
+ err := setrlimit(resource, rlim)
+ if err == nil && resource == RLIMIT_NOFILE {
+ // Store zeroes in origRlimitNofile to tell StartProcess
+ // to not adjust the rlimit in the child process.
+ origRlimitNofile.Store(Rlimit{0, 0})
}
+ return err
}
diff --git a/src/os/rlimit_darwin.go b/src/syscall/rlimit_darwin.go
index b28982a83a1..73e49646b30 100644
--- a/src/os/rlimit_darwin.go
+++ b/src/syscall/rlimit_darwin.go
@@ -4,15 +4,13 @@
//go:build darwin
-package os
-
-import "syscall"
+package syscall
// adjustFileLimit adds per-OS limitations on the Rlimit used for RLIMIT_NOFILE. See rlimit.go.
-func adjustFileLimit(lim *syscall.Rlimit) {
+func adjustFileLimit(lim *Rlimit) {
// On older macOS, setrlimit(RLIMIT_NOFILE, lim) with lim.Cur = infinity fails.
// Set to the value of kern.maxfilesperproc instead.
- n, err := syscall.SysctlUint32("kern.maxfilesperproc")
+ n, err := SysctlUint32("kern.maxfilesperproc")
if err != nil {
return
}
diff --git a/src/os/rlimit_stub.go b/src/syscall/rlimit_stub.go
index cbe28400c5b..e8f839dd991 100644
--- a/src/os/rlimit_stub.go
+++ b/src/syscall/rlimit_stub.go
@@ -4,9 +4,7 @@
//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd || solaris
-package os
-
-import "syscall"
+package syscall
// adjustFileLimit adds per-OS limitations on the Rlimit used for RLIMIT_NOFILE. See rlimit.go.
-func adjustFileLimit(lim *syscall.Rlimit) {}
+func adjustFileLimit(lim *Rlimit) {}
diff --git a/src/os/rlimit_test.go b/src/syscall/rlimit_test.go
index c02e36f3f76..e48f45e3aac 100644
--- a/src/os/rlimit_test.go
+++ b/src/syscall/rlimit_test.go
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package os_test
+package syscall_test
import (
- . "os"
+ "os"
"runtime"
"testing"
)
@@ -24,9 +24,9 @@ func TestOpenFileLimit(t *testing.T) {
fileCount = 768
}
- var files []*File
+ var files []*os.File
for i := 0; i < fileCount; i++ {
- f, err := Open("rlimit.go")
+ f, err := os.Open("rlimit.go")
if err != nil {
t.Error(err)
break
diff --git a/src/syscall/syscall_aix.go b/src/syscall/syscall_aix.go
index dbcb7bb7173..421a2caede7 100644
--- a/src/syscall/syscall_aix.go
+++ b/src/syscall/syscall_aix.go
@@ -633,7 +633,7 @@ func PtraceDetach(pid int) (err error) { return ptrace64(PT_DETACH, int64(pid),
//sys Setpriority(which int, who int, prio int) (err error)
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
+//sysnb setrlimit(which int, lim *Rlimit) (err error)
//sys Stat(path string, stat *Stat_t) (err error)
//sys Statfs(path string, buf *Statfs_t) (err error)
//sys Symlink(path string, link string) (err error)
diff --git a/src/syscall/syscall_darwin.go b/src/syscall/syscall_darwin.go
index 663bd98c104..4c3058d96d8 100644
--- a/src/syscall/syscall_darwin.go
+++ b/src/syscall/syscall_darwin.go
@@ -194,7 +194,7 @@ func Kill(pid int, signum Signal) (err error) { return kill(pid, int(signum), 1)
//sys Setprivexec(flag int) (err error)
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
+//sysnb setrlimit(which int, lim *Rlimit) (err error)
//sysnb Setsid() (pid int, err error)
//sysnb Settimeofday(tp *Timeval) (err error)
//sysnb Setuid(uid int) (err error)
diff --git a/src/syscall/syscall_dragonfly.go b/src/syscall/syscall_dragonfly.go
index 1a3cfe51fa4..61fd07a974e 100644
--- a/src/syscall/syscall_dragonfly.go
+++ b/src/syscall/syscall_dragonfly.go
@@ -237,7 +237,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
//sys Setpriority(which int, who int, prio int) (err error)
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
+//sysnb setrlimit(which int, lim *Rlimit) (err error)
//sysnb Setsid() (pid int, err error)
//sysnb Settimeofday(tp *Timeval) (err error)
//sysnb Setuid(uid int) (err error)
diff --git a/src/syscall/syscall_freebsd.go b/src/syscall/syscall_freebsd.go
index 0637215f892..2f28c62dc0f 100644
--- a/src/syscall/syscall_freebsd.go
+++ b/src/syscall/syscall_freebsd.go
@@ -491,7 +491,7 @@ func convertFromDirents11(buf []byte, old []byte) int {
//sys Setpriority(which int, who int, prio int) (err error)
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
+//sysnb setrlimit(which int, lim *Rlimit) (err error)
//sysnb Setsid() (pid int, err error)
//sysnb Settimeofday(tp *Timeval) (err error)
//sysnb Setuid(uid int) (err error)
diff --git a/src/syscall/syscall_linux.go b/src/syscall/syscall_linux.go
index a5ebe5086a5..3afee6217cb 100644
--- a/src/syscall/syscall_linux.go
+++ b/src/syscall/syscall_linux.go
@@ -1018,7 +1018,7 @@ func Getpgrp() (pid int) {
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
-//sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
+//sysnb prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
//sys read(fd int, p []byte) (n int, err error)
//sys Removexattr(path string, attr string) (err error)
//sys Setdomainname(p []byte) (err error)
@@ -1221,3 +1221,14 @@ func Munmap(b []byte) (err error) {
//sys Munlock(b []byte) (err error)
//sys Mlockall(flags int) (err error)
//sys Munlockall() (err error)
+
+// prlimit changes a resource limit. We use a single definition so that
+// we can tell StartProcess to not restore the original NOFILE limit.
+// This is unexported but can be called from x/sys/unix.
+func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+ err = prlimit1(pid, resource, newlimit, old)
+ if err == nil && newlimit != nil && resource == RLIMIT_NOFILE {
+ origRlimitNofile.Store(Rlimit{0, 0})
+ }
+ return err
+}
diff --git a/src/syscall/syscall_linux_386.go b/src/syscall/syscall_linux_386.go
index fc7df8496eb..e2fade82857 100644
--- a/src/syscall/syscall_linux_386.go
+++ b/src/syscall/syscall_linux_386.go
@@ -104,9 +104,9 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
return
}
-//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
+//sysnb setrlimit1(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit(resource int, rlim *Rlimit) (err error) {
err = prlimit(0, resource, rlim, nil)
if err != ENOSYS {
return err
@@ -128,7 +128,34 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) {
return EINVAL
}
- return setrlimit(resource, &rl)
+ return setrlimit1(resource, &rl)
+}
+
+//go:nosplit
+func rawSetrlimit(resource int, rlim *Rlimit) Errno {
+ _, _, errno := RawSyscall6(SYS_PRLIMIT64, 0, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0, 0, 0)
+ if errno != ENOSYS {
+ return errno
+ }
+
+ rl := rlimit32{}
+ if rlim.Cur == rlimInf64 {
+ rl.Cur = rlimInf32
+ } else if rlim.Cur < uint64(rlimInf32) {
+ rl.Cur = uint32(rlim.Cur)
+ } else {
+ return EINVAL
+ }
+ if rlim.Max == rlimInf64 {
+ rl.Max = rlimInf32
+ } else if rlim.Max < uint64(rlimInf32) {
+ rl.Max = uint32(rlim.Max)
+ } else {
+ return EINVAL
+ }
+
+ _, _, errno = RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
+ return errno
}
// Underlying system call writes to newoffset via pointer.
diff --git a/src/syscall/syscall_linux_amd64.go b/src/syscall/syscall_linux_amd64.go
index 0bcc664d32a..4669e9a3e97 100644
--- a/src/syscall/syscall_linux_amd64.go
+++ b/src/syscall/syscall_linux_amd64.go
@@ -4,6 +4,10 @@
package syscall
+import (
+ "unsafe"
+)
+
const _SYS_setgroups = SYS_SETGROUPS
//sys Dup2(oldfd int, newfd int) (err error)
@@ -30,7 +34,7 @@ const _SYS_setgroups = SYS_SETGROUPS
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
//sys Setfsgid(gid int) (err error)
//sys Setfsuid(uid int) (err error)
-//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
+//sysnb setrlimit(resource int, rlim *Rlimit) (err error) = SYS_SETRLIMIT
//sys Shutdown(fd int, how int) (err error)
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
//sys Statfs(path string, buf *Statfs_t) (err error)
@@ -95,6 +99,12 @@ func Time(t *Time_t) (tt Time_t, err error) {
//sys Utime(path string, buf *Utimbuf) (err error)
//sys utimes(path string, times *[2]Timeval) (err error)
+//go:nosplit
+func rawSetrlimit(resource int, rlim *Rlimit) Errno {
+ _, _, errno := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
+ return errno
+}
+
func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: sec, Nsec: nsec}
}
diff --git a/src/syscall/syscall_linux_arm.go b/src/syscall/syscall_linux_arm.go
index 9db702729f8..fcd33aa563e 100644
--- a/src/syscall/syscall_linux_arm.go
+++ b/src/syscall/syscall_linux_arm.go
@@ -156,9 +156,9 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
return
}
-//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
+//sysnb setrlimit1(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit(resource int, rlim *Rlimit) (err error) {
err = prlimit(0, resource, rlim, nil)
if err != ENOSYS {
return err
@@ -180,7 +180,34 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) {
return EINVAL
}
- return setrlimit(resource, &rl)
+ return setrlimit1(resource, &rl)
+}
+
+//go:nosplit
+func rawSetrlimit(resource int, rlim *Rlimit) Errno {
+ _, _, errno := RawSyscall6(SYS_PRLIMIT64, 0, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0, 0, 0)
+ if errno != ENOSYS {
+ return errno
+ }
+
+ rl := rlimit32{}
+ if rlim.Cur == rlimInf64 {
+ rl.Cur = rlimInf32
+ } else if rlim.Cur < uint64(rlimInf32) {
+ rl.Cur = uint32(rlim.Cur)
+ } else {
+ return EINVAL
+ }
+ if rlim.Max == rlimInf64 {
+ rl.Max = rlimInf32
+ } else if rlim.Max < uint64(rlimInf32) {
+ rl.Max = uint32(rlim.Max)
+ } else {
+ return EINVAL
+ }
+
+ _, _, errno = RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
+ return errno
}
func (r *PtraceRegs) PC() uint64 { return uint64(r.Uregs[15]) }
diff --git a/src/syscall/syscall_linux_arm64.go b/src/syscall/syscall_linux_arm64.go
index ef935f3a63e..f73f33dcec5 100644
--- a/src/syscall/syscall_linux_arm64.go
+++ b/src/syscall/syscall_linux_arm64.go
@@ -35,7 +35,7 @@ func EpollCreate(size int) (fd int, err error) {
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
//sys Setfsgid(gid int) (err error)
//sys Setfsuid(uid int) (err error)
-//sysnb setrlimit(resource int, rlim *Rlimit) (err error)
+//sysnb setrlimit1(resource int, rlim *Rlimit) (err error)
//sys Shutdown(fd int, how int) (err error)
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
@@ -147,13 +147,23 @@ func Getrlimit(resource int, rlim *Rlimit) error {
return getrlimit(resource, rlim)
}
-// Setrlimit prefers the prlimit64 system call. See issue 38604.
-func Setrlimit(resource int, rlim *Rlimit) error {
+// setrlimit prefers the prlimit64 system call. See issue 38604.
+func setrlimit(resource int, rlim *Rlimit) error {
err := prlimit(0, resource, rlim, nil)
if err != ENOSYS {
return err
}
- return setrlimit(resource, rlim)
+ return setrlimit1(resource, rlim)
+}
+
+//go:nosplit
+func rawSetrlimit(resource int, rlim *Rlimit) Errno {
+ _, _, errno := RawSyscall6(SYS_PRLIMIT64, 0, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0, 0, 0)
+ if errno != ENOSYS {
+ return errno
+ }
+ _, _, errno = RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
+ return errno
}
func (r *PtraceRegs) PC() uint64 { return r.Pc }
diff --git a/src/syscall/syscall_linux_loong64.go b/src/syscall/syscall_linux_loong64.go
index 99674b4a8ba..8354a7608d1 100644
--- a/src/syscall/syscall_linux_loong64.go
+++ b/src/syscall/syscall_linux_loong64.go
@@ -190,11 +190,17 @@ func Getrlimit(resource int, rlim *Rlimit) error {
return prlimit(0, resource, nil, rlim)
}
-// Setrlimit prefers the prlimit64 system call.
-func Setrlimit(resource int, rlim *Rlimit) error {
+// setrlimit prefers the prlimit64 system call.
+func setrlimit(resource int, rlim *Rlimit) error {
return prlimit(0, resource, rlim, nil)
}
+//go:nosplit
+func rawSetrlimit(resource int, rlim *Rlimit) Errno {
+ _, _, errno := RawSyscall6(SYS_PRLIMIT64, 0, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0, 0, 0)
+ return errno
+}
+
func (r *PtraceRegs) GetEra() uint64 { return r.Era }
func (r *PtraceRegs) SetEra(era uint64) { r.Era = era }
diff --git a/src/syscall/syscall_linux_mips64x.go b/src/syscall/syscall_linux_mips64x.go
index 258eb97b7ed..b03ca2eb9db 100644
--- a/src/syscall/syscall_linux_mips64x.go
+++ b/src/syscall/syscall_linux_mips64x.go
@@ -6,6 +6,10 @@
package syscall
+import (
+ "unsafe"
+)
+
const _SYS_setgroups = SYS_SETGROUPS
//sys Dup2(oldfd int, newfd int) (err error)
@@ -30,7 +34,7 @@ const _SYS_setgroups = SYS_SETGROUPS
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
//sys Setfsgid(gid int) (err error)
//sys Setfsuid(uid int) (err error)
-//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
+//sysnb setrlimit(resource int, rlim *Rlimit) (err error) = SYS_SETRLIMIT
//sys Shutdown(fd int, how int) (err error)
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
//sys Statfs(path string, buf *Statfs_t) (err error)
@@ -86,6 +90,12 @@ func Time(t *Time_t) (tt Time_t, err error) {
//sys Utime(path string, buf *Utimbuf) (err error)
//sys utimes(path string, times *[2]Timeval) (err error)
+//go:nosplit
+func rawSetrlimit(resource int, rlim *Rlimit) Errno {
+ _, _, errno := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
+ return errno
+}
+
func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: sec, Nsec: nsec}
}
diff --git a/src/syscall/syscall_linux_mipsx.go b/src/syscall/syscall_linux_mipsx.go
index 5390277926f..159982b41e8 100644
--- a/src/syscall/syscall_linux_mipsx.go
+++ b/src/syscall/syscall_linux_mipsx.go
@@ -149,9 +149,9 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
return
}
-//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
+//sysnb setrlimit1(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit(resource int, rlim *Rlimit) (err error) {
err = prlimit(0, resource, rlim, nil)
if err != ENOSYS {
return err
@@ -173,7 +173,34 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) {
return EINVAL
}
- return setrlimit(resource, &rl)
+ return setrlimit1(resource, &rl)
+}
+
+//go:nosplit
+func rawSetrlimit(resource int, rlim *Rlimit) Errno {
+ _, _, errno := RawSyscall6(SYS_PRLIMIT64, 0, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0, 0, 0)
+ if errno != ENOSYS {
+ return errno
+ }
+
+ rl := rlimit32{}
+ if rlim.Cur == rlimInf64 {
+ rl.Cur = rlimInf32
+ } else if rlim.Cur < uint64(rlimInf32) {
+ rl.Cur = uint32(rlim.Cur)
+ } else {
+ return EINVAL
+ }
+ if rlim.Max == rlimInf64 {
+ rl.Max = rlimInf32
+ } else if rlim.Max < uint64(rlimInf32) {
+ rl.Max = uint32(rlim.Max)
+ } else {
+ return EINVAL
+ }
+
+ _, _, errno = RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
+ return errno
}
func (r *PtraceRegs) PC() uint64 { return uint64(r.Regs[64]) }
diff --git a/src/syscall/syscall_linux_ppc64x.go b/src/syscall/syscall_linux_ppc64x.go
index 88ad8e4cd4b..56bd6a64229 100644
--- a/src/syscall/syscall_linux_ppc64x.go
+++ b/src/syscall/syscall_linux_ppc64x.go
@@ -6,6 +6,10 @@
package syscall
+import (
+ "unsafe"
+)
+
const _SYS_setgroups = SYS_SETGROUPS
//sys Dup2(oldfd int, newfd int) (err error)
@@ -36,7 +40,7 @@ const _SYS_setgroups = SYS_SETGROUPS
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
//sys Setfsgid(gid int) (err error)
//sys Setfsuid(uid int) (err error)
-//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
+//sysnb setrlimit(resource int, rlim *Rlimit) (err error) = SYS_SETRLIMIT
//sys Shutdown(fd int, how int) (err error)
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
//sys Stat(path string, stat *Stat_t) (err error)
@@ -65,6 +69,12 @@ const _SYS_setgroups = SYS_SETGROUPS
//sys Utime(path string, buf *Utimbuf) (err error)
//sys utimes(path string, times *[2]Timeval) (err error)
+//go:nosplit
+func rawSetrlimit(resource int, rlim *Rlimit) Errno {
+ _, _, errno := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
+ return errno
+}
+
func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: sec, Nsec: nsec}
}
diff --git a/src/syscall/syscall_linux_riscv64.go b/src/syscall/syscall_linux_riscv64.go
index 0ac4c5496ed..6c3846e4478 100644
--- a/src/syscall/syscall_linux_riscv64.go
+++ b/src/syscall/syscall_linux_riscv64.go
@@ -35,7 +35,7 @@ func EpollCreate(size int) (fd int, err error) {
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
//sys Setfsgid(gid int) (err error)
//sys Setfsuid(uid int) (err error)
-//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
+//sysnb setrlimit(resource int, rlim *Rlimit) (err error) = SYS_SETRLIMIT
//sys Shutdown(fd int, how int) (err error)
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
@@ -142,6 +142,12 @@ func utimes(path string, tv *[2]Timeval) (err error) {
return utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
}
+//go:nosplit
+func rawSetrlimit(resource int, rlim *Rlimit) Errno {
+ _, _, errno := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
+ return errno
+}
+
func (r *PtraceRegs) PC() uint64 { return r.Pc }
func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
diff --git a/src/syscall/syscall_linux_s390x.go b/src/syscall/syscall_linux_s390x.go
index 46b252dc95c..77f2b9d0c6b 100644
--- a/src/syscall/syscall_linux_s390x.go
+++ b/src/syscall/syscall_linux_s390x.go
@@ -33,7 +33,7 @@ const _SYS_setgroups = SYS_SETGROUPS
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
//sys Setfsgid(gid int) (err error)
//sys Setfsuid(uid int) (err error)
-//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
+//sysnb setrlimit(resource int, rlim *Rlimit) (err error) = SYS_SETRLIMIT
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
//sys Stat(path string, stat *Stat_t) (err error)
//sys Statfs(path string, buf *Statfs_t) (err error)
@@ -240,6 +240,12 @@ func Shutdown(s, how int) (err error) {
return
}
+//go:nosplit
+func rawSetrlimit(resource int, rlim *Rlimit) Errno {
+ _, _, errno := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
+ return errno
+}
+
func (r *PtraceRegs) PC() uint64 { return r.Psw.Addr }
func (r *PtraceRegs) SetPC(pc uint64) { r.Psw.Addr = pc }
diff --git a/src/syscall/syscall_netbsd.go b/src/syscall/syscall_netbsd.go
index d8efb41d20c..547ca836125 100644
--- a/src/syscall/syscall_netbsd.go
+++ b/src/syscall/syscall_netbsd.go
@@ -221,7 +221,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys Setpriority(which int, who int, prio int) (err error)
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
+//sysnb setrlimit(which int, lim *Rlimit) (err error)
//sysnb Setsid() (pid int, err error)
//sysnb Settimeofday(tp *Timeval) (err error)
//sysnb Setuid(uid int) (err error)
diff --git a/src/syscall/syscall_openbsd.go b/src/syscall/syscall_openbsd.go
index 75217344df1..15c962623f0 100644
--- a/src/syscall/syscall_openbsd.go
+++ b/src/syscall/syscall_openbsd.go
@@ -196,7 +196,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
//sys Setpriority(which int, who int, prio int) (err error)
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
+//sysnb setrlimit(which int, lim *Rlimit) (err error)
//sysnb Setsid() (pid int, err error)
//sysnb Settimeofday(tp *Timeval) (err error)
//sysnb Setuid(uid int) (err error)
diff --git a/src/syscall/syscall_solaris.go b/src/syscall/syscall_solaris.go
index 0363597c9e4..1ebcbacc23a 100644
--- a/src/syscall/syscall_solaris.go
+++ b/src/syscall/syscall_solaris.go
@@ -474,7 +474,7 @@ func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags i
//sys Setpriority(which int, who int, prio int) (err error)
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
-//sysnb Setrlimit(which int, lim *Rlimit) (err error)
+//sysnb setrlimit(which int, lim *Rlimit) (err error)
//sysnb Setsid() (pid int, err error)
//sysnb Setuid(uid int) (err error)
//sys Shutdown(s int, how int) (err error) = libsocket.shutdown
diff --git a/src/syscall/zsyscall_aix_ppc64.go b/src/syscall/zsyscall_aix_ppc64.go
index 39838a42e65..8e404dba17c 100644
--- a/src/syscall/zsyscall_aix_ppc64.go
+++ b/src/syscall/zsyscall_aix_ppc64.go
@@ -1258,7 +1258,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := rawSyscall6(uintptr(unsafe.Pointer(&libc_Setrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_darwin_amd64.go b/src/syscall/zsyscall_darwin_amd64.go
index ee78a572fcb..83b169ace5e 100644
--- a/src/syscall/zsyscall_darwin_amd64.go
+++ b/src/syscall/zsyscall_darwin_amd64.go
@@ -1460,7 +1460,7 @@ func libc_setreuid_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := rawSyscall(abi.FuncPCABI0(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_darwin_arm64.go b/src/syscall/zsyscall_darwin_arm64.go
index ac1eccf7559..c4ade8e6a08 100644
--- a/src/syscall/zsyscall_darwin_arm64.go
+++ b/src/syscall/zsyscall_darwin_arm64.go
@@ -1460,7 +1460,7 @@ func libc_setreuid_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := rawSyscall(abi.FuncPCABI0(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_dragonfly_amd64.go b/src/syscall/zsyscall_dragonfly_amd64.go
index 5d5576d76ff..a591682b7dc 100644
--- a/src/syscall/zsyscall_dragonfly_amd64.go
+++ b/src/syscall/zsyscall_dragonfly_amd64.go
@@ -1066,7 +1066,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_freebsd_386.go b/src/syscall/zsyscall_freebsd_386.go
index 04bad4acc92..f8d910f250f 100644
--- a/src/syscall/zsyscall_freebsd_386.go
+++ b/src/syscall/zsyscall_freebsd_386.go
@@ -1134,7 +1134,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_freebsd_amd64.go b/src/syscall/zsyscall_freebsd_amd64.go
index eeb9c0cb9b5..13d72e48a6f 100644
--- a/src/syscall/zsyscall_freebsd_amd64.go
+++ b/src/syscall/zsyscall_freebsd_amd64.go
@@ -1134,7 +1134,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_freebsd_arm.go b/src/syscall/zsyscall_freebsd_arm.go
index 8ea4282ba45..e67e13b8861 100644
--- a/src/syscall/zsyscall_freebsd_arm.go
+++ b/src/syscall/zsyscall_freebsd_arm.go
@@ -1134,7 +1134,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_freebsd_arm64.go b/src/syscall/zsyscall_freebsd_arm64.go
index 73bf50559d6..6f13d976f78 100644
--- a/src/syscall/zsyscall_freebsd_arm64.go
+++ b/src/syscall/zsyscall_freebsd_arm64.go
@@ -1134,7 +1134,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_386.go b/src/syscall/zsyscall_linux_386.go
index 36a3d7ed391..6f60db46fcc 100644
--- a/src/syscall/zsyscall_linux_386.go
+++ b/src/syscall/zsyscall_linux_386.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1387,7 +1387,7 @@ func getrlimit(resource int, rlim *rlimit32) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func setrlimit(resource int, rlim *rlimit32) (err error) {
+func setrlimit1(resource int, rlim *rlimit32) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_amd64.go b/src/syscall/zsyscall_linux_amd64.go
index 07f328e1e26..6e1139fe98e 100644
--- a/src/syscall/zsyscall_linux_amd64.go
+++ b/src/syscall/zsyscall_linux_amd64.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1318,7 +1318,7 @@ func Setfsuid(uid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_arm.go b/src/syscall/zsyscall_linux_arm.go
index da16796abdf..cb0737b6a52 100644
--- a/src/syscall/zsyscall_linux_arm.go
+++ b/src/syscall/zsyscall_linux_arm.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1590,7 +1590,7 @@ func getrlimit(resource int, rlim *rlimit32) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func setrlimit(resource int, rlim *rlimit32) (err error) {
+func setrlimit1(resource int, rlim *rlimit32) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_arm64.go b/src/syscall/zsyscall_linux_arm64.go
index 73321bd897c..6995aa83528 100644
--- a/src/syscall/zsyscall_linux_arm64.go
+++ b/src/syscall/zsyscall_linux_arm64.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1292,7 +1292,7 @@ func Setfsuid(uid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit1(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_loong64.go b/src/syscall/zsyscall_linux_loong64.go
index b3d703d86b9..c20cd972a2b 100644
--- a/src/syscall/zsyscall_linux_loong64.go
+++ b/src/syscall/zsyscall_linux_loong64.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_mips.go b/src/syscall/zsyscall_linux_mips.go
index 1ef8eebe4fd..51e3e48f8ef 100644
--- a/src/syscall/zsyscall_linux_mips.go
+++ b/src/syscall/zsyscall_linux_mips.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1665,7 +1665,7 @@ func getrlimit(resource int, rlim *rlimit32) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func setrlimit(resource int, rlim *rlimit32) (err error) {
+func setrlimit1(resource int, rlim *rlimit32) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_mips64.go b/src/syscall/zsyscall_linux_mips64.go
index 1ed877ce7ea..4920fcce962 100644
--- a/src/syscall/zsyscall_linux_mips64.go
+++ b/src/syscall/zsyscall_linux_mips64.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1307,7 +1307,7 @@ func Setfsuid(uid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_mips64le.go b/src/syscall/zsyscall_linux_mips64le.go
index 3d7cc9e3733..3f882d83cb2 100644
--- a/src/syscall/zsyscall_linux_mips64le.go
+++ b/src/syscall/zsyscall_linux_mips64le.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1307,7 +1307,7 @@ func Setfsuid(uid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_mipsle.go b/src/syscall/zsyscall_linux_mipsle.go
index 59b49ddf747..b85f6ed40d9 100644
--- a/src/syscall/zsyscall_linux_mipsle.go
+++ b/src/syscall/zsyscall_linux_mipsle.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1665,7 +1665,7 @@ func getrlimit(resource int, rlim *rlimit32) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func setrlimit(resource int, rlim *rlimit32) (err error) {
+func setrlimit1(resource int, rlim *rlimit32) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_ppc64.go b/src/syscall/zsyscall_linux_ppc64.go
index 93632bd1cb4..eca65b9a96d 100644
--- a/src/syscall/zsyscall_linux_ppc64.go
+++ b/src/syscall/zsyscall_linux_ppc64.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1380,7 +1380,7 @@ func Setfsuid(uid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_ppc64le.go b/src/syscall/zsyscall_linux_ppc64le.go
index fc8f6b7bcf9..d86a54083b7 100644
--- a/src/syscall/zsyscall_linux_ppc64le.go
+++ b/src/syscall/zsyscall_linux_ppc64le.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1380,7 +1380,7 @@ func Setfsuid(uid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_riscv64.go b/src/syscall/zsyscall_linux_riscv64.go
index 0efa70715d6..569857153a0 100644
--- a/src/syscall/zsyscall_linux_riscv64.go
+++ b/src/syscall/zsyscall_linux_riscv64.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1292,7 +1292,7 @@ func Setfsuid(uid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_linux_s390x.go b/src/syscall/zsyscall_linux_s390x.go
index 568bb430a64..5dddb541afd 100644
--- a/src/syscall/zsyscall_linux_s390x.go
+++ b/src/syscall/zsyscall_linux_s390x.go
@@ -676,7 +676,7 @@ func PivotRoot(newroot string, putold string) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
+func prlimit1(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
@@ -1350,7 +1350,7 @@ func Setfsuid(uid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(resource int, rlim *Rlimit) (err error) {
+func setrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_netbsd_386.go b/src/syscall/zsyscall_netbsd_386.go
index 9b928592060..e401d02d020 100644
--- a/src/syscall/zsyscall_netbsd_386.go
+++ b/src/syscall/zsyscall_netbsd_386.go
@@ -1030,7 +1030,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_netbsd_amd64.go b/src/syscall/zsyscall_netbsd_amd64.go
index ac34c00b5a2..a4f217b948f 100644
--- a/src/syscall/zsyscall_netbsd_amd64.go
+++ b/src/syscall/zsyscall_netbsd_amd64.go
@@ -1030,7 +1030,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_netbsd_arm.go b/src/syscall/zsyscall_netbsd_arm.go
index 2be5e7baa4d..1f55614f640 100644
--- a/src/syscall/zsyscall_netbsd_arm.go
+++ b/src/syscall/zsyscall_netbsd_arm.go
@@ -1030,7 +1030,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_netbsd_arm64.go b/src/syscall/zsyscall_netbsd_arm64.go
index 02a652bbbb2..be33fcd4128 100644
--- a/src/syscall/zsyscall_netbsd_arm64.go
+++ b/src/syscall/zsyscall_netbsd_arm64.go
@@ -1030,7 +1030,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_openbsd_386.go b/src/syscall/zsyscall_openbsd_386.go
index f7986d5ea5c..fa8cfed613c 100644
--- a/src/syscall/zsyscall_openbsd_386.go
+++ b/src/syscall/zsyscall_openbsd_386.go
@@ -1387,7 +1387,7 @@ func libc_setreuid_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := rawSyscall(abi.FuncPCABI0(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_openbsd_amd64.go b/src/syscall/zsyscall_openbsd_amd64.go
index 605443d8904..4655be87acb 100644
--- a/src/syscall/zsyscall_openbsd_amd64.go
+++ b/src/syscall/zsyscall_openbsd_amd64.go
@@ -1387,7 +1387,7 @@ func libc_setreuid_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := rawSyscall(abi.FuncPCABI0(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_openbsd_arm.go b/src/syscall/zsyscall_openbsd_arm.go
index 0f2312fbc40..bafce134a5f 100644
--- a/src/syscall/zsyscall_openbsd_arm.go
+++ b/src/syscall/zsyscall_openbsd_arm.go
@@ -1387,7 +1387,7 @@ func libc_setreuid_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := rawSyscall(abi.FuncPCABI0(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_openbsd_arm64.go b/src/syscall/zsyscall_openbsd_arm64.go
index 1367e2aba9e..7fc3c67360f 100644
--- a/src/syscall/zsyscall_openbsd_arm64.go
+++ b/src/syscall/zsyscall_openbsd_arm64.go
@@ -1387,7 +1387,7 @@ func libc_setreuid_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := rawSyscall(abi.FuncPCABI0(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_openbsd_mips64.go b/src/syscall/zsyscall_openbsd_mips64.go
index 2cf84653191..2a91c368313 100644
--- a/src/syscall/zsyscall_openbsd_mips64.go
+++ b/src/syscall/zsyscall_openbsd_mips64.go
@@ -1039,7 +1039,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/syscall/zsyscall_solaris_amd64.go b/src/syscall/zsyscall_solaris_amd64.go
index a2bbeed8449..63e0a581b24 100644
--- a/src/syscall/zsyscall_solaris_amd64.go
+++ b/src/syscall/zsyscall_solaris_amd64.go
@@ -959,7 +959,7 @@ func Setreuid(ruid int, euid int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Setrlimit(which int, lim *Rlimit) (err error) {
+func setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&libc_Setrlimit)), 2, uintptr(which), uintptr(unsafe.Pointer(lim)), 0, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)