...

Source file src/github.com/opencontainers/runc/libcontainer/system/syscall_linux_64.go

Documentation: github.com/opencontainers/runc/libcontainer/system

     1  //go:build linux && (arm64 || amd64 || mips || mipsle || mips64 || mips64le || ppc || ppc64 || ppc64le || riscv64 || s390x)
     2  // +build linux
     3  // +build arm64 amd64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv64 s390x
     4  
     5  package system
     6  
     7  import (
     8  	"golang.org/x/sys/unix"
     9  )
    10  
    11  // Setuid sets the uid of the calling thread to the specified uid.
    12  func Setuid(uid int) (err error) {
    13  	_, _, e1 := unix.RawSyscall(unix.SYS_SETUID, uintptr(uid), 0, 0)
    14  	if e1 != 0 {
    15  		err = e1
    16  	}
    17  	return
    18  }
    19  
    20  // Setgid sets the gid of the calling thread to the specified gid.
    21  func Setgid(gid int) (err error) {
    22  	_, _, e1 := unix.RawSyscall(unix.SYS_SETGID, uintptr(gid), 0, 0)
    23  	if e1 != 0 {
    24  		err = e1
    25  	}
    26  	return
    27  }
    28  

View as plain text