]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: always use prlimit for getrlimit/setrlimit on Linux
authorIan Lance Taylor <iant@golang.org>
Wed, 28 Aug 2024 23:20:44 +0000 (16:20 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 30 Aug 2024 19:26:45 +0000 (19:26 +0000)
Linux added the prlimit system call in version 2.6.36.
As our minimum Linux kernel version is now 3.2,
simplify the various getrlimit/setlrimit implementations
to just always use prlimit.

For #67001

Change-Id: I2512c21c947d0bc83f8f9077c143163fd8d83be3
Reviewed-on: https://go-review.googlesource.com/c/go/+/609178
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

24 files changed:
src/syscall/exec_linux.go
src/syscall/syscall_linux.go
src/syscall/syscall_linux_386.go
src/syscall/syscall_linux_amd64.go
src/syscall/syscall_linux_arm.go
src/syscall/syscall_linux_arm64.go
src/syscall/syscall_linux_loong64.go
src/syscall/syscall_linux_mips64x.go
src/syscall/syscall_linux_mipsx.go
src/syscall/syscall_linux_ppc64x.go
src/syscall/syscall_linux_riscv64.go
src/syscall/syscall_linux_s390x.go
src/syscall/zsyscall_linux_386.go
src/syscall/zsyscall_linux_amd64.go
src/syscall/zsyscall_linux_arm.go
src/syscall/zsyscall_linux_arm64.go
src/syscall/zsyscall_linux_mips.go
src/syscall/zsyscall_linux_mips64.go
src/syscall/zsyscall_linux_mips64le.go
src/syscall/zsyscall_linux_mipsle.go
src/syscall/zsyscall_linux_ppc64.go
src/syscall/zsyscall_linux_ppc64le.go
src/syscall/zsyscall_linux_riscv64.go
src/syscall/zsyscall_linux_s390x.go

index e4b9ce1bf47da34845348577a8e1aaba442c24a5..5ef62450a874764bc5589d768ac9f64f16c4142f 100644 (file)
@@ -632,7 +632,7 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att
 
        // Restore original rlimit.
        if rlim != nil {
-               rawSetrlimit(RLIMIT_NOFILE, rlim)
+               RawSyscall6(SYS_PRLIMIT64, 0, RLIMIT_NOFILE, uintptr(unsafe.Pointer(rlim)), 0, 0, 0)
        }
 
        // Enable tracing if requested.
index 032936398bd9f2975e6ac7da0850469343ebc109..1fe422d691c1751797a80da424ee8b2a57ce0e45 100644 (file)
@@ -1288,6 +1288,17 @@ func Munmap(b []byte) (err error) {
 //sys  Mlockall(flags int) (err error)
 //sys  Munlockall() (err error)
 
+func Getrlimit(resource int, rlim *Rlimit) (err error) {
+       // prlimit1 is the same as prlimit when newlimit == nil
+       return prlimit1(0, resource, nil, rlim)
+}
+
+// setrlimit sets a resource limit.
+// The Setrlimit function is in rlimit.go, and calls this one.
+func setrlimit(resource int, rlim *Rlimit) (err error) {
+       return prlimit(0, resource, rlim, nil)
+}
+
 // prlimit changes a resource limit. We use a single definition so that
 // we can tell StartProcess to not restore the original NOFILE limit.
 //
index a559f7e288ac5cdc923e127bec2755428a0e2210..a90565a001ad77d0bc7848cf249145b6cdc6da51 100644 (file)
@@ -72,96 +72,6 @@ func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int6
        return mmap2(addr, length, prot, flags, fd, page)
 }
 
-type rlimit32 struct {
-       Cur uint32
-       Max uint32
-}
-
-//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
-
-const rlimInf32 = ^uint32(0)
-const rlimInf64 = ^uint64(0)
-
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
-       err = prlimit(0, resource, nil, rlim)
-       if err != ENOSYS {
-               return err
-       }
-
-       rl := rlimit32{}
-       err = getrlimit(resource, &rl)
-       if err != nil {
-               return
-       }
-
-       if rl.Cur == rlimInf32 {
-               rlim.Cur = rlimInf64
-       } else {
-               rlim.Cur = uint64(rl.Cur)
-       }
-
-       if rl.Max == rlimInf32 {
-               rlim.Max = rlimInf64
-       } else {
-               rlim.Max = uint64(rl.Max)
-       }
-       return
-}
-
-//sysnb setrlimit1(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
-
-func setrlimit(resource int, rlim *Rlimit) (err error) {
-       err = prlimit(0, resource, rlim, nil)
-       if err != ENOSYS {
-               return err
-       }
-
-       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
-       }
-
-       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.
 // Implemented in assembly to avoid allocation.
 func seek(fd int, offset int64, whence int) (newoffset int64, err Errno)
index ec52f8a4bd9ec4d5c6ccdf1c86efee8e6539a2d7..725ebdba22f95aee5d905fd566f0214290031e41 100644 (file)
@@ -4,10 +4,6 @@
 
 package syscall
 
-import (
-       "unsafe"
-)
-
 const (
        _SYS_setgroups  = SYS_SETGROUPS
        _SYS_clone3     = 435
@@ -23,7 +19,6 @@ const (
 //sysnb        Getegid() (egid int)
 //sysnb        Geteuid() (euid int)
 //sysnb        Getgid() (gid int)
-//sysnb        Getrlimit(resource int, rlim *Rlimit) (err error)
 //sysnb        Getuid() (uid int)
 //sysnb        InotifyInit() (fd int, err error)
 //sys  Ioperm(from int, num int, on int) (err error)
@@ -38,7 +33,6 @@ const (
 //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) = 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)
@@ -103,12 +97,6 @@ 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}
 }
index a6d92cea1317e8da8012c0b5e721d2b72936f682..2019b15169d56bda641a5c04daaee5c03b28a7a0 100644 (file)
@@ -124,96 +124,6 @@ func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int6
        return mmap2(addr, length, prot, flags, fd, page)
 }
 
-type rlimit32 struct {
-       Cur uint32
-       Max uint32
-}
-
-//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
-
-const rlimInf32 = ^uint32(0)
-const rlimInf64 = ^uint64(0)
-
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
-       err = prlimit(0, resource, nil, rlim)
-       if err != ENOSYS {
-               return err
-       }
-
-       rl := rlimit32{}
-       err = getrlimit(resource, &rl)
-       if err != nil {
-               return
-       }
-
-       if rl.Cur == rlimInf32 {
-               rlim.Cur = rlimInf64
-       } else {
-               rlim.Cur = uint64(rl.Cur)
-       }
-
-       if rl.Max == rlimInf32 {
-               rlim.Max = rlimInf64
-       } else {
-               rlim.Max = uint64(rl.Max)
-       }
-       return
-}
-
-//sysnb setrlimit1(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
-
-func setrlimit(resource int, rlim *Rlimit) (err error) {
-       err = prlimit(0, resource, rlim, nil)
-       if err != ENOSYS {
-               return err
-       }
-
-       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
-       }
-
-       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]) }
 
 func (r *PtraceRegs) SetPC(pc uint64) { r.Uregs[15] = uint32(pc) }
index b87b51c0c04e44eceaef3c30f82eb28a27122746..fb0ecd77b7ff5ac2f9b12f48e8aa521b79692281 100644 (file)
@@ -27,7 +27,6 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) error {
 //sysnb        Getegid() (egid int)
 //sysnb        Geteuid() (euid int)
 //sysnb        Getgid() (gid int)
-//sysnb        getrlimit(resource int, rlim *Rlimit) (err error)
 //sysnb        Getuid() (uid int)
 //sys  Listen(s int, n int) (err error)
 //sys  pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
@@ -37,7 +36,6 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) 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        setrlimit1(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)
 
@@ -140,34 +138,6 @@ func utimes(path string, tv *[2]Timeval) (err error) {
        return utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
 }
 
-// Getrlimit prefers the prlimit64 system call. See issue 38604.
-func Getrlimit(resource int, rlim *Rlimit) error {
-       err := prlimit(0, resource, nil, rlim)
-       if err != ENOSYS {
-               return err
-       }
-       return getrlimit(resource, rlim)
-}
-
-// 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 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 }
 
 func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
index 634cf30cf26902200df201d4ff0f05b0183f3570..360590d2d706cea0bcf82b64b82566d71ceedbff 100644 (file)
@@ -183,22 +183,6 @@ func utimes(path string, tv *[2]Timeval) (err error) {
        return utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
 }
 
-// Getrlimit prefers the prlimit64 system call.
-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 {
-       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 }
index 41106ed81ff1ed5a38e10b9e751883fc10e0af5d..51f5ead472ef4fa838dee12367c401123325d68a 100644 (file)
@@ -6,10 +6,6 @@
 
 package syscall
 
-import (
-       "unsafe"
-)
-
 const (
        _SYS_setgroups  = SYS_SETGROUPS
        _SYS_clone3     = 5435
@@ -25,7 +21,6 @@ const (
 //sysnb        Getegid() (egid int)
 //sysnb        Geteuid() (euid int)
 //sysnb        Getgid() (gid int)
-//sysnb        Getrlimit(resource int, rlim *Rlimit) (err error)
 //sysnb        Getuid() (uid int)
 //sysnb        InotifyInit() (fd int, err error)
 //sys  Lchown(path string, uid int, gid int) (err error)
@@ -38,7 +33,6 @@ const (
 //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) = 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)
@@ -94,12 +88,6 @@ 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}
 }
index 7d4f8f2264df70d5acf05c5d9b4d871eb54575f8..aa08792606b1029d77b5fb95836c540a2d4dd2a5 100644 (file)
@@ -117,96 +117,6 @@ func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int6
        return mmap2(addr, length, prot, flags, fd, page)
 }
 
-const rlimInf32 = ^uint32(0)
-const rlimInf64 = ^uint64(0)
-
-type rlimit32 struct {
-       Cur uint32
-       Max uint32
-}
-
-//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
-
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
-       err = prlimit(0, resource, nil, rlim)
-       if err != ENOSYS {
-               return err
-       }
-
-       rl := rlimit32{}
-       err = getrlimit(resource, &rl)
-       if err != nil {
-               return
-       }
-
-       if rl.Cur == rlimInf32 {
-               rlim.Cur = rlimInf64
-       } else {
-               rlim.Cur = uint64(rl.Cur)
-       }
-
-       if rl.Max == rlimInf32 {
-               rlim.Max = rlimInf64
-       } else {
-               rlim.Max = uint64(rl.Max)
-       }
-       return
-}
-
-//sysnb setrlimit1(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
-
-func setrlimit(resource int, rlim *Rlimit) (err error) {
-       err = prlimit(0, resource, rlim, nil)
-       if err != ENOSYS {
-               return err
-       }
-
-       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
-       }
-
-       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]) }
 
 func (r *PtraceRegs) SetPC(pc uint64) { r.Regs[64] = uint32(pc) }
index 13c184c44fec9818ec3a5ea803e7d07376383419..124240231e4a96fd7ec26aa83dc29fdb7a9742ed 100644 (file)
@@ -6,10 +6,6 @@
 
 package syscall
 
-import (
-       "unsafe"
-)
-
 const (
        _SYS_setgroups  = SYS_SETGROUPS
        _SYS_clone3     = 435
@@ -27,7 +23,6 @@ const (
 //sysnb        Getegid() (egid int)
 //sysnb        Geteuid() (euid int)
 //sysnb        Getgid() (gid int)
-//sysnb        Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT
 //sysnb        Getuid() (uid int)
 //sysnb        InotifyInit() (fd int, err error)
 //sys  Ioperm(from int, num int, on int) (err error)
@@ -44,7 +39,6 @@ const (
 //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) = 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)
@@ -73,12 +67,6 @@ const (
 //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}
 }
index 00872a74fba96d06e1b1b8e40a90d14cbde26fc5..c9159762d89c5ddebac192b690f5279c513d86a0 100644 (file)
@@ -27,7 +27,6 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) error {
 //sysnb        Getegid() (egid int)
 //sysnb        Geteuid() (euid int)
 //sysnb        Getgid() (gid int)
-//sysnb        Getrlimit(resource int, rlim *Rlimit) (err error)
 //sysnb        Getuid() (uid int)
 //sys  Listen(s int, n int) (err error)
 //sys  pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
@@ -37,7 +36,6 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) 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) = 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)
 
@@ -144,12 +142,6 @@ 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 }
index ea667ec1da541148b8c9157c806ca564a8daa24a..65c86140fc5a82c5bbb823364ac9167a5f330b8e 100644 (file)
@@ -23,7 +23,6 @@ const (
 //sysnb        Getegid() (egid int)
 //sysnb        Geteuid() (euid int)
 //sysnb        Getgid() (gid int)
-//sysnb        Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_GETRLIMIT
 //sysnb        Getuid() (uid int)
 //sysnb        InotifyInit() (fd int, err error)
 //sys  Lchown(path string, uid int, gid int) (err error)
@@ -37,7 +36,6 @@ const (
 //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) = 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)
@@ -244,12 +242,6 @@ 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 }
index 661cfe7bed6f8d9ea525f1d56d9c8126d56b2e5d..762fb0078b254a6fd2efc82e9d8fd14aa26a749b 100644 (file)
@@ -1395,26 +1395,6 @@ func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func getrlimit(resource int, rlim *rlimit32) (err error) {
-       _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-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)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func futimesat(dirfd int, path string, times *[2]Timeval) (err error) {
        var _p0 *byte
        _p0, err = BytePtrFromString(path)
index 9d05781893c2552ba61f49b3fe67681b6a6ba6cc..1249ff66809abeeacb8c2c7a0af5a9428a28fd87 100644 (file)
@@ -1160,16 +1160,6 @@ func Getgid() (gid int) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
-       _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Getuid() (uid int) {
        r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
        uid = int(r0)
@@ -1336,16 +1326,6 @@ 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) {
-       _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Shutdown(fd int, how int) (err error) {
        _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
        if e1 != 0 {
index 2929a3bda55ddbccfc933437077b20fc352b1d62..c359fe531eec6709336c3c24d5fcd665c2f353b1 100644 (file)
@@ -1595,23 +1595,3 @@ func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
        }
        return
 }
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func getrlimit(resource int, rlim *rlimit32) (err error) {
-       _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-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)
-       }
-       return
-}
index a1c91071f1253d68c046f62d8b1b4fb0dd42da49..6625cddb4bb245d312513c5f52c456710353ac59 100644 (file)
@@ -1182,16 +1182,6 @@ func Getgid() (gid int) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func getrlimit(resource int, rlim *Rlimit) (err error) {
-       _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Getuid() (uid int) {
        r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
        uid = int(r0)
@@ -1306,16 +1296,6 @@ func Setfsuid(uid int) (err error) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-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)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Shutdown(fd int, how int) (err error) {
        _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
        if e1 != 0 {
index 7e216b04ea6f1e8747d65cdc2e4a071a80b3e92e..0bd4a806f569c073cb520327160e7190c89683ee 100644 (file)
@@ -1670,23 +1670,3 @@ func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset
        }
        return
 }
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func getrlimit(resource int, rlim *rlimit32) (err error) {
-       _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-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)
-       }
-       return
-}
index 8c894b1088cb481a35f3f6d25a93acde5dfe1505..0352ea54202d1c78a90152d8700e6b4ec8689726 100644 (file)
@@ -1165,16 +1165,6 @@ func Getgid() (gid int) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
-       _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Getuid() (uid int) {
        r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
        uid = int(r0)
@@ -1325,16 +1315,6 @@ 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) {
-       _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Shutdown(fd int, how int) (err error) {
        _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
        if e1 != 0 {
index 812a6ba8e69af19e01fc4304ded88c32e6dc1c84..1338b8c1c351c48c0839206719ec88efda9fab6e 100644 (file)
@@ -1165,16 +1165,6 @@ func Getgid() (gid int) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
-       _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Getuid() (uid int) {
        r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
        uid = int(r0)
@@ -1325,16 +1315,6 @@ 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) {
-       _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Shutdown(fd int, how int) (err error) {
        _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
        if e1 != 0 {
index d32a8afa4f6a331c7af3493d99f5c6b408896d07..7f880e53d59343cf244648583cfb752ec634d975 100644 (file)
@@ -1670,23 +1670,3 @@ func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset
        }
        return
 }
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func getrlimit(resource int, rlim *rlimit32) (err error) {
-       _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-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)
-       }
-       return
-}
index c321267b9ba431279926c75634be36167a14133b..c4ca96f2f9860dcb5a150d2f16aa070b3c0c1bfe 100644 (file)
@@ -1192,16 +1192,6 @@ func Getgid() (gid int) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
-       _, _, e1 := RawSyscall(SYS_UGETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Getuid() (uid int) {
        r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
        uid = int(r0)
@@ -1398,16 +1388,6 @@ 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) {
-       _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Shutdown(fd int, how int) (err error) {
        _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
        if e1 != 0 {
index 40475d76bfe85b7ab89bd8a9aac50cc386eca4f4..a08471b4e0ea85a29e0b4e93bc1da3de86a756b2 100644 (file)
@@ -1192,16 +1192,6 @@ func Getgid() (gid int) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
-       _, _, e1 := RawSyscall(SYS_UGETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Getuid() (uid int) {
        r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
        uid = int(r0)
@@ -1398,16 +1388,6 @@ 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) {
-       _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Shutdown(fd int, how int) (err error) {
        _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
        if e1 != 0 {
index dc74acfc880d43d057a5e1827d046d3895b6bda2..4098b790042d5287dca7056a59db764cefa68cab 100644 (file)
@@ -1182,16 +1182,6 @@ func Getgid() (gid int) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
-       _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Getuid() (uid int) {
        r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
        uid = int(r0)
@@ -1306,16 +1296,6 @@ 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) {
-       _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Shutdown(fd int, how int) (err error) {
        _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
        if e1 != 0 {
index cc189d9ea7748e8556f64fa9c270d6d2cbb6fb3e..81979169ffce7b5e149cbafe1d2bc625516df8ce 100644 (file)
@@ -1192,16 +1192,6 @@ func Getgid() (gid int) {
 
 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
 
-func Getrlimit(resource int, rlim *Rlimit) (err error) {
-       _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Getuid() (uid int) {
        r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
        uid = int(r0)
@@ -1368,16 +1358,6 @@ 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) {
-       _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
-       if e1 != 0 {
-               err = errnoErr(e1)
-       }
-       return
-}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
 func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
        r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
        n = int64(r0)