xref: /aosp_15_r20/external/libcap/psx/psx.go (revision 2810ac1b38eead2603277920c78344c84ddf3aff)
1*2810ac1bSKiyoung Kim// +build linux,!cgo
2*2810ac1bSKiyoung Kim// +build go1.16
3*2810ac1bSKiyoung Kim
4*2810ac1bSKiyoung Kimpackage psx // import "kernel.org/pub/linux/libs/security/libcap/psx"
5*2810ac1bSKiyoung Kim
6*2810ac1bSKiyoung Kimimport "syscall"
7*2810ac1bSKiyoung Kim
8*2810ac1bSKiyoung Kim// Documentation for these functions are provided in the psx_cgo.go
9*2810ac1bSKiyoung Kim// file.
10*2810ac1bSKiyoung Kim
11*2810ac1bSKiyoung Kim//go:uintptrescapes
12*2810ac1bSKiyoung Kim
13*2810ac1bSKiyoung Kim// Syscall3 performs a 3 argument syscall.  Syscall3 differs from
14*2810ac1bSKiyoung Kim// syscall.[Raw]Syscall() insofar as it is simultaneously executed on
15*2810ac1bSKiyoung Kim// every thread of the combined Go and CGo runtimes. It works
16*2810ac1bSKiyoung Kim// differently depending on whether CGO_ENABLED is 1 or 0 at compile
17*2810ac1bSKiyoung Kim// time.
18*2810ac1bSKiyoung Kim//
19*2810ac1bSKiyoung Kim// If CGO_ENABLED=1 it uses the libpsx function C.psx_syscall3().
20*2810ac1bSKiyoung Kim//
21*2810ac1bSKiyoung Kim// If CGO_ENABLED=0 it redirects to the go1.16+
22*2810ac1bSKiyoung Kim// syscall.AllThreadsSyscall() function.
23*2810ac1bSKiyoung Kimfunc Syscall3(syscallnr, arg1, arg2, arg3 uintptr) (uintptr, uintptr, syscall.Errno) {
24*2810ac1bSKiyoung Kim	return syscall.AllThreadsSyscall(syscallnr, arg1, arg2, arg3)
25*2810ac1bSKiyoung Kim}
26*2810ac1bSKiyoung Kim
27*2810ac1bSKiyoung Kim//go:uintptrescapes
28*2810ac1bSKiyoung Kim
29*2810ac1bSKiyoung Kim// Syscall6 performs a 6 argument syscall on every thread of the
30*2810ac1bSKiyoung Kim// combined Go and CGo runtimes. Other than the number of syscall
31*2810ac1bSKiyoung Kim// arguments, its behavior is identical to that of Syscall3() - see
32*2810ac1bSKiyoung Kim// above for the full documentation.
33*2810ac1bSKiyoung Kimfunc Syscall6(syscallnr, arg1, arg2, arg3, arg4, arg5, arg6 uintptr) (uintptr, uintptr, syscall.Errno) {
34*2810ac1bSKiyoung Kim	return syscall.AllThreadsSyscall6(syscallnr, arg1, arg2, arg3, arg4, arg5, arg6)
35*2810ac1bSKiyoung Kim}
36