Patchwork [gccgo] Don't use BindToDevice on RTEMS

login
register
mail settings
Submitter Ian Taylor
Date July 2, 2010, 4:54 p.m.
Message ID <mcr1vbllt91.fsf@google.com>
Download mbox | patch
Permalink /patch/57683/
State New
Headers show

Comments

Ian Taylor - July 2, 2010, 4:54 p.m.
RTEMS does not support SO_BINDTODEVICE.  This patch from Vinu
Rajashekhar avoids it on RTEMS.  Committed to gccgo branch.

Ian

Patch

diff -r 27379025cbbd libgo/syscalls/socket.go
--- a/libgo/syscalls/socket.go	Fri Jul 02 09:39:30 2010 -0700
+++ b/libgo/syscalls/socket.go	Fri Jul 02 09:47:21 2010 -0700
@@ -149,11 +149,6 @@ 
 	return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), Socklen_t(len(s)))
 }
 
-// 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)
-}
-
 func Getsockname(fd int) (sa Sockaddr, errno int) {
 	var rsa RawSockaddrAny;
 	var len Socklen_t = SizeofSockaddrAny;
diff -r 27379025cbbd libgo/syscalls/socket_bsd.go
--- a/libgo/syscalls/socket_bsd.go	Fri Jul 02 09:39:30 2010 -0700
+++ b/libgo/syscalls/socket_bsd.go	Fri Jul 02 09:47:21 2010 -0700
@@ -132,3 +132,8 @@ 
 	}
 	return nil, EAFNOSUPPORT;
 }
+
+// BindToDevice binds the socket associated with fd to device.
+func BindToDevice(fd int, device string) (errno int) {
+	return ENOSYS
+}
diff -r 27379025cbbd libgo/syscalls/socket_linux.go
--- a/libgo/syscalls/socket_linux.go	Fri Jul 02 09:39:30 2010 -0700
+++ b/libgo/syscalls/socket_linux.go	Fri Jul 02 09:47:21 2010 -0700
@@ -133,3 +133,8 @@ 
 	}
 	return nil, EAFNOSUPPORT;
 }
+
+// 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)
+}