github.com/dylandreimerink/gobpfld@v0.6.1-0.20220205171531-e79c330ad608/internal/syscall/bind.go (about) 1 package syscall 2 3 import ( 4 "unsafe" 5 6 "golang.org/x/sys/unix" 7 ) 8 9 type Socklen uint32 10 11 // Bind is a public version of the unix.bind without additional wrappers which allows us to use any 12 // value type we want. But does require the usage of unsafe. 13 func Bind(s int, addr unsafe.Pointer, addrlen Socklen) (err error) { 14 _, _, e1 := unix.Syscall(unix.SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) 15 if e1 != 0 { 16 err = &Error{ 17 Errno: e1, 18 } 19 } 20 return 21 }