Patchwork libgo patch committed: Remove unnecessary EINTR tests

login
register
mail settings
Submitter Ian Taylor
Date March 31, 2011, 10:19 p.m.
Message ID <mcripuzoru9.fsf@google.com>
Download mbox | patch
Permalink /patch/89143/
State New
Headers show

Comments

Ian Taylor - March 31, 2011, 10:19 p.m.
This libgo patch removes some unnecessary EINTR tests I added a couple
of months ago.  The libgo library always uses SA_RESTART when setting up
a signal handler, so EINTR should never happen for functions like read
and write.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

Patch

diff -r a76876ca23b2 libgo/go/net/fd.go
--- a/libgo/go/net/fd.go	Thu Mar 31 13:36:27 2011 -0700
+++ b/libgo/go/net/fd.go	Thu Mar 31 15:16:23 2011 -0700
@@ -376,7 +376,7 @@ 
 	for {
 		var errno int
 		n, errno = syscall.Read(fd.sysfile.Fd(), p)
-		if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.rdeadline >= 0 {
+		if errno == syscall.EAGAIN && fd.rdeadline >= 0 {
 			pollserver.WaitRead(fd)
 			continue
 		}
@@ -411,7 +411,7 @@ 
 	for {
 		var errno int
 		n, sa, errno = syscall.Recvfrom(fd.sysfd, p, 0)
-		if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.rdeadline >= 0 {
+		if errno == syscall.EAGAIN && fd.rdeadline >= 0 {
 			pollserver.WaitRead(fd)
 			continue
 		}
@@ -444,7 +444,7 @@ 
 	for {
 		var errno int
 		n, oobn, flags, sa, errno = syscall.Recvmsg(fd.sysfd, p, oob, 0)
-		if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.rdeadline >= 0 {
+		if errno == syscall.EAGAIN && fd.rdeadline >= 0 {
 			pollserver.WaitRead(fd)
 			continue
 		}
@@ -490,7 +490,7 @@ 
 		if nn == len(p) {
 			break
 		}
-		if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.wdeadline >= 0 {
+		if errno == syscall.EAGAIN && fd.wdeadline >= 0 {
 			pollserver.WaitWrite(fd)
 			continue
 		}
@@ -526,7 +526,7 @@ 
 	var oserr os.Error
 	for {
 		errno := syscall.Sendto(fd.sysfd, p, 0, sa)
-		if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.wdeadline >= 0 {
+		if errno == syscall.EAGAIN && fd.wdeadline >= 0 {
 			pollserver.WaitWrite(fd)
 			continue
 		}
@@ -560,7 +560,7 @@ 
 	for {
 		var errno int
 		errno = syscall.Sendmsg(fd.sysfd, p, oob, sa, 0)
-		if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.wdeadline >= 0 {
+		if errno == syscall.EAGAIN && fd.wdeadline >= 0 {
 			pollserver.WaitWrite(fd)
 			continue
 		}
@@ -598,7 +598,7 @@ 
 			return nil, os.EINVAL
 		}
 		s, sa, e = syscall.Accept(fd.sysfd)
-		if e != syscall.EAGAIN && e != syscall.EINTR {
+		if e != syscall.EAGAIN {
 			break
 		}
 		syscall.ForkLock.RUnlock()