]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: linux, implement BindToDevice
authorChristopher Wedgwood <cw@f00f.org>
Thu, 20 May 2010 16:43:13 +0000 (09:43 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 20 May 2010 16:43:13 +0000 (09:43 -0700)
R=rsc
CC=adg, golang-dev, r
https://golang.org/cl/1253043

src/pkg/syscall/syscall_linux.go

index 39ab10309d6bf35e1dc2fe550449d4c19b18bfff..c0f580c7bcb4ebdc266123577d9991e7768d0e5a 100644 (file)
@@ -403,6 +403,11 @@ func Sendto(fd int, p []byte, flags int, to Sockaddr) (errno int) {
        return sendto(fd, p, flags, ptr, n)
 }
 
+// BindToDevice binds the socket associated with fd to device.
+func BindToDevice(fd int, device string) (errno int) {
+       return SetsockoptString(fd, SOL_SOCKET, SO_BINDTODEVICE, device)
+}
+
 //sys  ptrace(request int, pid int, addr uintptr, data uintptr) (errno int)
 
 func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, errno int) {