c/os: Setrlimit/Getrlimit
This commit is contained in:
@@ -85,6 +85,14 @@ func Kill(pid int, signum Signal) (err error) {
|
||||
return Errno(ret)
|
||||
}
|
||||
|
||||
func fork() (uintptr, Errno) {
|
||||
ret := os.Fork()
|
||||
if ret >= 0 {
|
||||
return uintptr(ret), Errno(0)
|
||||
}
|
||||
return 0, Errno(os.Errno)
|
||||
}
|
||||
|
||||
func wait4(pid int, wstatus *c.Int, options int, rusage *syscall.Rusage) (wpid int, err error) {
|
||||
ret := os.Wait4(os.PidT(pid), wstatus, c.Int(options), rusage)
|
||||
if ret >= 0 {
|
||||
@@ -164,3 +172,21 @@ func Pipe(p []int) (err error) {
|
||||
}
|
||||
return Errno(ret)
|
||||
}
|
||||
|
||||
type Rlimit syscall.Rlimit
|
||||
|
||||
func Getrlimit(which int, lim *Rlimit) (err error) {
|
||||
ret := os.Getrlimit(c.Int(which), (*syscall.Rlimit)(lim))
|
||||
if ret == 0 {
|
||||
return nil
|
||||
}
|
||||
return Errno(ret)
|
||||
}
|
||||
|
||||
func setrlimit(which int, lim *Rlimit) (err error) {
|
||||
ret := os.Setrlimit(c.Int(which), (*syscall.Rlimit)(lim))
|
||||
if ret == 0 {
|
||||
return nil
|
||||
}
|
||||
return Errno(ret)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user