@@ -1873,7 +1873,6 @@ func Getpgrp() (pid int) {
18731873//sys OpenTree(dfd int, fileName string, flags uint) (r int, err error)
18741874//sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)
18751875//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
1876- //sysnb Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
18771876//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
18781877//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6
18791878//sys read(fd int, p []byte) (n int, err error)
@@ -1887,6 +1886,15 @@ func Getpgrp() (pid int) {
18871886//sysnb Settimeofday(tv *Timeval) (err error)
18881887//sys Setns(fd int, nstype int) (err error)
18891888
1889+ //go:linkname syscall_prlimit syscall.prlimit
1890+ func syscall_prlimit (pid , resource int , newlimit , old * syscall.Rlimit ) error
1891+
1892+ func Prlimit (pid , resource int , newlimit , old * Rlimit ) error {
1893+ // Just call the syscall version, because as of Go 1.21
1894+ // it will affect starting a new process.
1895+ return syscall_prlimit (pid , resource , (* syscall .Rlimit )(newlimit ), (* syscall .Rlimit )(old ))
1896+ }
1897+
18901898// PrctlRetInt performs a prctl operation specified by option and further
18911899// optional arguments arg2 through arg5 depending on option. It returns a
18921900// non-negative integer that is returned by the prctl syscall.
0 commit comments