From patchwork Sat Dec 28 18:00:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 305584 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1A9112C00B3 for ; Sun, 29 Dec 2013 05:01:09 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=l4cajcLn/fk9GFCBNVOJBOc80zdMirtwHzisZy9qEeL7EsmIXUdZa k4u1sZx9XiI+jYyZ03Kir0hTWhIoEUZ02LBYLKA07yrNdZgEi5s5VefFjd6c84NZ 1VT+rufcHj3+Glrz/kPf8pQMKXUnaEQmS5FLyzLVALGSkU2EzgArUY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=YIn9ZNLWUspw12RUT4+uilfSKN0=; b=VqSd8YFQOk+Ks04VMNGT pjBHpwsx3x6BVwPF8tcXVWSR7edIqH8/RAgay5vPs9y/rN/mOKyOdLPz0tsQTHDm 1uBtce5SZTMgnlEkfA8xCJQu733u7ken0fxBVBlUBTNmvmxUaoCIAnXlF0N3z9zA mY0fvo3C4Z17O+EFEvo5jX0= Received: (qmail 9258 invoked by alias); 28 Dec 2013 18:01:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 9242 invoked by uid 89); 28 Dec 2013 18:01:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS, T_TVD_MIME_NO_HEADERS autolearn=ham version=3.3.2 X-HELO: mail-pb0-f54.google.com Received: from mail-pb0-f54.google.com (HELO mail-pb0-f54.google.com) (209.85.160.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 28 Dec 2013 18:01:00 +0000 Received: by mail-pb0-f54.google.com with SMTP id un15so10247176pbc.13 for ; Sat, 28 Dec 2013 10:00:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version:content-type; bh=s2N2DysH+87zzo5M0qnEtPDSGsA8nXxgRByO7/ayvnA=; b=YpbtnHQxtq7YA3B+8ahKEL5DpD7Bd438f5LjIV9POeGhnk3SUZkzzkngv2a+YrF8Xr 4E0RJbGg8CdDcxEmvo20uiFIxAyxoNSENbWktwSHUYAls6KcKSK5c3qmRmv9ls5mdIgI D/2sIL88p6IZ6nGMfjES816WD2lO/8ei50FbSjEMezzy1h8gUI2tErSgwwpIr50ujp2K A0bE9uvvcok2BIKwWDrRT8wCbfazl0XkOrty6LVUU/ZKOIQf6Sn4+gpJxvyqCU7niON0 b+5iWzKOlCSqTAgSXHkjVbcXP2xll/B/WwVymYZ6R9Ji65pafYtzWJ47gS4EpQqOAVaf gpEw== X-Gm-Message-State: ALoCoQlv0sMmQQ6dj1eniNfH2Mg0b7ssRaylKjMgFoJFmkaQeY2kQhkrgXTYupwX4xCRNLhaodyXT12rMLGJI2VFr21unzl2PgjOuUM64HpKTHpbQrC+cj7BhCYLGQ1TzS0l7nhpzxYA6CROKA8YkQDerrhfpOpqnd1oSyn5+gzLKUTVxwACQCckjcnzqju97raRJjz2gHOKufAn2Qu/wXb7LjPHM2SRTg== X-Received: by 10.66.145.166 with SMTP id sv6mr59182627pab.31.1388253659007; Sat, 28 Dec 2013 10:00:59 -0800 (PST) Received: from iant-glaptop.roam.corp.google.com.google.com (adsl-71-133-8-30.dsl.pltn13.pacbell.net. [71.133.8.30]) by mx.google.com with ESMTPSA id dq3sm70384690pbc.35.2013.12.28.10.00.57 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 28 Dec 2013 10:00:58 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: libgo patch committed: Work around Solaris oddity Date: Sat, 28 Dec 2013 10:00:55 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes If one thread does a connect to localhost on a non-blocking socket such that the connect fails with EINPROGRESS, and then another thread accepts the connection and closes the accepted socket, and then the first thread does the connect again, that connect should succeed and return a socket whose other end is closed. For some reason, on Solaris, the second connect fails with an error of EINVAL, a possibility that is not documented on the connect man page. This case arises in some of the libgo testsuite. This patch works around the problem by testing for this possibility on Solaris. The same patch has been applied to the master Go repository. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu, which I admit proves little for a Solaris-specific patch. I also tested the specific patch on i386-pc-solaris2.11, where it fixes a testsuite failure. Committed to mainline and 4.8 branch. Ian diff -r 0d4f83bb938b src/pkg/net/fd_unix.go --- a/src/pkg/net/fd_unix.go Sat Dec 28 20:33:05 2013 +1100 +++ b/src/pkg/net/fd_unix.go Sat Dec 28 09:37:28 2013 -0800 @@ -80,6 +80,16 @@ if err == nil || err == syscall.EISCONN { break } + + // On Solaris we can see EINVAL if the socket has + // already been accepted and closed by the server. + // Treat this as a successful connection--writes to + // the socket will see EOF. For details and a test + // case in C see http://golang.org/issue/6828. + if runtime.GOOS == "solaris" && err == syscall.EINVAL { + break + } + if err != syscall.EINPROGRESS && err != syscall.EALREADY && err != syscall.EINTR { return err }