{"id":816388,"url":"http://patchwork.ozlabs.org/api/patches/816388/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/CAOyqgcV0k=y2N2f-6Oc2nR24iqF1F09fDkWf3pSbw0qYozsKNA@mail.gmail.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<CAOyqgcV0k=y2N2f-6Oc2nR24iqF1F09fDkWf3pSbw0qYozsKNA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-20T17:40:29","name":"libgo patch committed: Work around AIX getsockname bug","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a438b09610b0cc20f38cbd78f65fae6e53e69e33","submitter":{"id":36501,"url":"http://patchwork.ozlabs.org/api/people/36501/?format=json","name":"Ian Lance Taylor","email":"iant@golang.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/CAOyqgcV0k=y2N2f-6Oc2nR24iqF1F09fDkWf3pSbw0qYozsKNA@mail.gmail.com/mbox/","series":[{"id":4187,"url":"http://patchwork.ozlabs.org/api/series/4187/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=4187","date":"2017-09-20T17:40:29","name":"libgo patch committed: Work around AIX getsockname bug","version":1,"mbox":"http://patchwork.ozlabs.org/series/4187/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816388/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816388/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-462628-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-462628-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"Pb/oT1CH\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xy6Tm49Qcz9s4q\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 03:40:43 +1000 (AEST)","(qmail 42208 invoked by alias); 20 Sep 2017 17:40:35 -0000","(qmail 42199 invoked by uid 89); 20 Sep 2017 17:40:34 -0000","from mail-io0-f171.google.com (HELO mail-io0-f171.google.com)\n\t(209.85.223.171) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 20 Sep 2017 17:40:32 +0000","by mail-io0-f171.google.com with SMTP id i197so5268523ioe.9 for\n\t<gcc-patches@gcc.gnu.org>; Wed, 20 Sep 2017 10:40:32 -0700 (PDT)","by 10.168.117.78 with HTTP; Wed, 20 Sep 2017 10:40:29 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:from:date:message-id:subject:to:content-type; q=\n\tdns; s=default; b=t6iLfM6OL8499WNtIemZsW6A4jX0jioDXFQxDywZ+YzmuT\n\tZpIuCHoKDAjGnNaDoXq+MO09j2UgZLGwCfFU7vuAhrPlmTvrxijPcXzxvwgqpJyS\n\t6B+Guh247eYGpRVnr7Q1hBqY9zGMLUx/w/6hhkuP7/Ucizjy6g4HQkE5QMpQ0=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:from:date:message-id:subject:to:content-type; s=\n\tdefault; bh=avQmNRRwog7HOTF18NXsWi38wBs=; b=Pb/oT1CH+GYA/Y6qn9GZ\n\tAFhOhTihWLPZ1el3WX3ikTBJ1H7ZZaKSohiWw3nJrmC3HAGCOERFw9qqkS1W3AYx\n\trhvULuYqh0VOunAN9uope37+TllTok7ou7iEGlHnZGXxKCX8gaYUEkk3gJp7lsjW\n\tr0UTYn2edqVYxwBkQfmTJTA=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-9.6 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=rights, reserved,\n\tfamily","X-HELO":"mail-io0-f171.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:from:date:message-id:subject:to;\n\tbh=pNm3dWUUJL2N+IP2cZwVlDCKHloezgybvmhIV8gZLwI=;\n\tb=B907koRZqLAheSxfXI81YQKkQ2lYJdhpF+/s6Sqj2cS2kYjLg2Ml6qMsTm3WZPy+VX\n\tW8z2ddYiyV3sFfQj9zSo4JPvHQO/KtVKDqieyrt+tdxuV+y78xvGUjTsCx/mGBsRL57z\n\tpW/qD8aZnkA4YMVPPtko5gUfnSGIXI2jSx25aHTh9mW2jvTrjlwhecDM7gboN54Ebznx\n\tXjvGfZZeQBlvo3olm2pcHdMpXb1qoc85mgYZpHM0+iVgUYoGSP6A3XjXSJldF4l6l2l1\n\tk7Xv8lfIUeLHyW2904LBDrZGOBD3H3k4f3UheYuhtrzVT3UGVZR9hnKhCOFF4SKLqOlo\n\tUDGA==","X-Gm-Message-State":"AHPjjUjxS9zjsrmo88RLNe56U85CTDBt/2wmG6Yq6E7a3eJ9X0+Wkdps\tG4wtkABjeZv15wJE8slLHLUYvFTBDQYLt+a+QDAOKjRj","X-Google-Smtp-Source":"AOwi7QCpUhLUZwL0atUe4AjTxnO8TU1J9rx2naquAckMRkTU3dCcnd433fSq4fZORD8V00nW+rOEPyvUGIA9f6IHVpA=","X-Received":"by 10.202.75.211 with SMTP id y202mr7153744oia.140.1505929230421;\n\tWed, 20 Sep 2017 10:40:30 -0700 (PDT)","MIME-Version":"1.0","From":"Ian Lance Taylor <iant@golang.org>","Date":"Wed, 20 Sep 2017 10:40:29 -0700","Message-ID":"<CAOyqgcV0k=y2N2f-6Oc2nR24iqF1F09fDkWf3pSbw0qYozsKNA@mail.gmail.com>","Subject":"libgo patch committed: Work around AIX getsockname bug","To":"gcc-patches <gcc-patches@gcc.gnu.org>,\n\t\"gofrontend-dev@googlegroups.com\" <gofrontend-dev@googlegroups.com>","Content-Type":"multipart/mixed; boundary=\"001a1134e188d64a9f0559a2784b\""},"content":"This patch from Tony Reix works around a bug in getsockname on AIX.\nBootstrapped on x86_64-pc-linux-gnu.  Committed to mainline.\n\nThis actually includes part of the previous patch, as I forgot to run `svn add`.\n\nIan","diff":"Index: gcc/go/gofrontend/MERGE\n===================================================================\n--- gcc/go/gofrontend/MERGE\t(revision 253016)\n+++ gcc/go/gofrontend/MERGE\t(working copy)\n@@ -1,4 +1,4 @@\n-90fe3da36d904b62d47c00ee40eef4fd2693a5da\n+84f827669dc76326ed99ebcc982c482aa148d8d8\n \n The first line of this file holds the git revision number of the last\n merge done from the gofrontend repository.\nIndex: libgo/go/syscall/socket_aix.go\n===================================================================\n--- libgo/go/syscall/socket_aix.go\t(revision 0)\n+++ libgo/go/syscall/socket_aix.go\t(working copy)\n@@ -0,0 +1,89 @@\n+// socket_aix.go -- Socket handling specific to AIX.\n+\n+// Copyright 2017 The Go Authors. All rights reserved.\n+// Use of this source code is governed by a BSD-style\n+// license that can be found in the LICENSE file.\n+\n+package syscall\n+\n+import \"unsafe\"\n+\n+const SizeofSockaddrInet4 = 16\n+const SizeofSockaddrInet6 = 28\n+const SizeofSockaddrUnix = 1025\n+\n+type RawSockaddrInet4 struct {\n+\tLen    uint8\n+\tFamily uint8\n+\tPort   uint16\n+\tAddr   [4]byte /* in_addr */\n+\tZero   [8]uint8\n+}\n+\n+func (sa *RawSockaddrInet4) setLen() Socklen_t {\n+\tsa.Len = SizeofSockaddrInet4\n+\treturn SizeofSockaddrInet4\n+}\n+\n+type RawSockaddrInet6 struct {\n+\tLen      uint8\n+\tFamily   uint8\n+\tPort     uint16\n+\tFlowinfo uint32\n+\tAddr     [16]byte /* in6_addr */\n+\tScope_id uint32\n+}\n+\n+func (sa *RawSockaddrInet6) setLen() Socklen_t {\n+\tsa.Len = SizeofSockaddrInet6\n+\treturn SizeofSockaddrInet6\n+}\n+\n+type RawSockaddrUnix struct {\n+\tLen    uint8\n+\tFamily uint8\n+\tPath   [1023]int8\n+}\n+\n+func (sa *RawSockaddrUnix) setLen(n int) {\n+\tsa.Len = uint8(3 + n) // 2 for Family, Len; 1 for NUL.\n+}\n+\n+func (sa *RawSockaddrUnix) getLen() (int, error) {\n+\t// Some versions of AIX have a bug in getsockname (see IV78655).\n+\t// We can't rely on sa.Len being set correctly.\n+\tn := SizeofSockaddrUnix - 3 // substract leading Family, Len, terminating NUL.\n+\tfor i := 0; i < n; i++ {\n+\t\tif sa.Path[i] == 0 {\n+\t\t\tn = i\n+\t\t\tbreak\n+\t\t}\n+\t}\n+\treturn n, nil\n+}\n+\n+func (sa *RawSockaddrUnix) adjustAbstract(sl Socklen_t) Socklen_t {\n+\treturn sl\n+}\n+\n+type RawSockaddr struct {\n+\tLen    uint8\n+\tFamily uint8\n+\tData   [14]int8\n+}\n+\n+// BindToDevice binds the socket associated with fd to device.\n+func BindToDevice(fd int, device string) (err error) {\n+\treturn ENOSYS\n+}\n+\n+func anyToSockaddrOS(rsa *RawSockaddrAny) (Sockaddr, error) {\n+\treturn nil, EAFNOSUPPORT\n+}\n+\n+func GetsockoptIPv6MTUInfo(fd, level, opt int) (*IPv6MTUInfo, error) {\n+\tvar value IPv6MTUInfo\n+\tvallen := Socklen_t(SizeofIPv6MTUInfo)\n+\terr := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)\n+\treturn &value, err\n+}\nIndex: libgo/go/syscall/socket_bsd.go\n===================================================================\n--- libgo/go/syscall/socket_bsd.go\t(revision 251948)\n+++ libgo/go/syscall/socket_bsd.go\t(working copy)\n@@ -4,7 +4,7 @@\n // Use of this source code is governed by a BSD-style\n // license that can be found in the LICENSE file.\n \n-// +build aix darwin dragonfly freebsd openbsd netbsd\n+// +build darwin dragonfly freebsd openbsd netbsd\n \n package syscall\n \nIndex: libgo/go/syscall/syscall_aix_ppc.go\n===================================================================\n--- libgo/go/syscall/syscall_aix_ppc.go\t(revision 0)\n+++ libgo/go/syscall/syscall_aix_ppc.go\t(working copy)\n@@ -0,0 +1,49 @@\n+// syscall_aix_ppc.go -- AIX 32-bit specific support\n+\n+// Copyright 2017 The Go Authors. All rights reserved.\n+// Use of this source code is governed by a BSD-style\n+// license that can be found in the LICENSE file.\n+\n+package syscall\n+\n+import \"unsafe\"\n+\n+// AIX does not define a specific structure but instead uses separate\n+// ptrace calls for the different registers.\n+type PtraceRegs struct {\n+\tGpr [32]uint32\n+\tIar uint32\n+\tMsr uint32\n+\tCr  uint32\n+\tLr  uint32\n+\tCtr uint32\n+\tXer uint32\n+}\n+\n+func (r *PtraceRegs) PC() uint64 { return uint64(r.Iar) }\n+\n+func (r *PtraceRegs) SetPC(pc uint64) { r.Iar = uint32(pc) }\n+\n+func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {\n+\tptrace(_PT_REGSET, pid, uintptr(unsafe.Pointer(&regsout.Gpr[0])), 0, 0)\n+\tregsout.Iar = uint32(ptrace(_PT_READ_GPR, pid, 128, 0, 0))\n+\tregsout.Msr = uint32(ptrace(_PT_READ_GPR, pid, 129, 0, 0))\n+\tregsout.Cr = uint32(ptrace(_PT_READ_GPR, pid, 130, 0, 0))\n+\tregsout.Lr = uint32(ptrace(_PT_READ_GPR, pid, 131, 0, 0))\n+\tregsout.Ctr = uint32(ptrace(_PT_READ_GPR, pid, 132, 0, 0))\n+\tregsout.Xer = uint32(ptrace(_PT_READ_GPR, pid, 133, 0, 0))\n+\treturn nil\n+}\n+\n+func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {\n+\tfor i := 0; i < len(regs.Gpr); i++ {\n+\t\tptrace(_PT_WRITE_GPR, pid, uintptr(i), int(regs.Gpr[i]), 0)\n+\t}\n+\tptrace(_PT_WRITE_GPR, pid, 128, int(regs.Iar), 0)\n+\tptrace(_PT_WRITE_GPR, pid, 129, int(regs.Msr), 0)\n+\tptrace(_PT_WRITE_GPR, pid, 130, int(regs.Cr), 0)\n+\tptrace(_PT_WRITE_GPR, pid, 131, int(regs.Lr), 0)\n+\tptrace(_PT_WRITE_GPR, pid, 132, int(regs.Ctr), 0)\n+\tptrace(_PT_WRITE_GPR, pid, 133, int(regs.Xer), 0)\n+\treturn nil\n+}\nIndex: libgo/go/syscall/syscall_aix_ppc64.go\n===================================================================\n--- libgo/go/syscall/syscall_aix_ppc64.go\t(revision 0)\n+++ libgo/go/syscall/syscall_aix_ppc64.go\t(working copy)\n@@ -0,0 +1,49 @@\n+// syscall_aix_ppc64.go -- AIX 64-bit specific support\n+\n+// Copyright 2017 The Go Authors. All rights reserved.\n+// Use of this source code is governed by a BSD-style\n+// license that can be found in the LICENSE file.\n+\n+package syscall\n+\n+import \"unsafe\"\n+\n+// AIX does not define a specific structure but instead uses separate\n+// ptrace calls for the different registers.\n+type PtraceRegs struct {\n+\tGpr [32]uint64\n+\tIar uint64\n+\tMsr uint64\n+\tCr  uint64\n+\tLr  uint64\n+\tCtr uint64\n+\tXer uint64\n+}\n+\n+func (r *PtraceRegs) PC() uint64 { return r.Iar }\n+\n+func (r *PtraceRegs) SetPC(pc uint64) { r.Iar = pc }\n+\n+func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {\n+\tptrace64(_PT_REGSET, int64(pid), int64(uintptr(unsafe.Pointer(&regsout.Gpr[0]))), 0, 0)\n+\tptrace64(_PT_READ_GPR, int64(pid), 128, 0, uintptr(unsafe.Pointer(&regsout.Iar)))\n+\tptrace64(_PT_READ_GPR, int64(pid), 129, 0, uintptr(unsafe.Pointer(&regsout.Msr)))\n+\tptrace64(_PT_READ_GPR, int64(pid), 130, 0, uintptr(unsafe.Pointer(&regsout.Cr)))\n+\tptrace64(_PT_READ_GPR, int64(pid), 131, 0, uintptr(unsafe.Pointer(&regsout.Lr)))\n+\tptrace64(_PT_READ_GPR, int64(pid), 132, 0, uintptr(unsafe.Pointer(&regsout.Ctr)))\n+\tptrace64(_PT_READ_GPR, int64(pid), 133, 0, uintptr(unsafe.Pointer(&regsout.Xer)))\n+\treturn nil\n+}\n+\n+func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {\n+\tfor i := 0; i < len(regs.Gpr); i++ {\n+\t\tptrace64(_PT_WRITE_GPR, int64(pid), int64(i), 0, uintptr(unsafe.Pointer(&regs.Gpr[i])))\n+\t}\n+\tptrace64(_PT_WRITE_GPR, int64(pid), 128, 0, uintptr(unsafe.Pointer(&regs.Iar)))\n+\tptrace64(_PT_WRITE_GPR, int64(pid), 129, 0, uintptr(unsafe.Pointer(&regs.Msr)))\n+\tptrace64(_PT_WRITE_GPR, int64(pid), 130, 0, uintptr(unsafe.Pointer(&regs.Cr)))\n+\tptrace64(_PT_WRITE_GPR, int64(pid), 131, 0, uintptr(unsafe.Pointer(&regs.Lr)))\n+\tptrace64(_PT_WRITE_GPR, int64(pid), 132, 0, uintptr(unsafe.Pointer(&regs.Ctr)))\n+\tptrace64(_PT_WRITE_GPR, int64(pid), 133, 0, uintptr(unsafe.Pointer(&regs.Xer)))\n+\treturn nil\n+}\n","prefixes":[]}