github.com/chwjbn/xclash@v0.2.0/listener/redir/tcp_linux_386.go (about)

     1  package redir
     2  
     3  import (
     4  	"syscall"
     5  	"unsafe"
     6  )
     7  
     8  const GETSOCKOPT = 15 // https://golang.org/src/syscall/syscall_linux_386.go#L183
     9  
    10  func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) error {
    11  	var a [6]uintptr
    12  	a[0], a[1], a[2], a[3], a[4], a[5] = a0, a1, a2, a3, a4, a5
    13  	if _, _, errno := syscall.Syscall6(syscall.SYS_SOCKETCALL, call, uintptr(unsafe.Pointer(&a)), 0, 0, 0, 0); errno != 0 {
    14  		return errno
    15  	}
    16  	return nil
    17  }