From fd95566fda0b45e92e20562321221bd2c486c089 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 19 Apr 2023 15:05:54 -0700 Subject: [PATCH] syscall: add prlimit As of https://go.dev/cl/476695 golang.org/x/sys/unix can call syscall.prlimit, so we need such a function in libgo. For golang/go#46279 Fixes golang/go#59712 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/486576 --- gcc/go/gofrontend/MERGE | 2 +- libgo/go/syscall/libcall_linux.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index e133650ad915..702257009d28 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -0411a2733fd468e69f1998edd91e8fe3ba40ff9e +737de90a63002d4872b19772a7116404ee5815b4 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go index 19ae4393cf13..03ca7261b59b 100644 --- a/libgo/go/syscall/libcall_linux.go +++ b/libgo/go/syscall/libcall_linux.go @@ -189,6 +189,14 @@ func Gettid() (tid int) { //sys PivotRoot(newroot string, putold string) (err error) //pivot_root(newroot *byte, putold *byte) _C_int +// Used by golang.org/x/sys/unix. +//sys prlimit(pid int, resource int, newlimit *Rlimit, oldlimit *Rlimit) (err error) +//prlimit(pid Pid_t, resource _C_int, newlimit *Rlimit, oldlimit *Rlimit) _C_int + +func Prlimit(pid int, resource int, newlimit *Rlimit, oldlimit *Rlimit) error { + return prlimit(pid, resource, newlimit, oldlimit) +} + //sys Removexattr(path string, attr string) (err error) //removexattr(path *byte, name *byte) _C_int -- 2.47.2