From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2128.outbound.protection.outlook.com [40.107.100.128]) by sourceware.org (Postfix) with ESMTPS id 982993857C78 for ; Tue, 3 Nov 2020 15:43:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 982993857C78 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lqTOcMCY9V+PZ3nXTVvgPeSHDqB+hnz8NqjnnyCVkrPSywXr2OkLpw0PnCQzbEkk3+uqVCwMXV8t+WihLxtwyTgZqZMclHrGlRyUccaBR/E+hCruhnlVGy8X0ZG06Ypz4LoKlVJmhwcxg2ti8aH/GeJ64KCgiifT/Y4Hml3QFHexjEcFrOMMDjrVcgBPjqKtVVscOlV3YjGIH1vSod8IIxWgnRQxwXL89Vios1xV1IcKCdl9mD01tJbgb5/kb16Oq/Xoc9GfVg26+up/SrUWiQZag4lhT8xpQRUyn/GI43RddTdMYgRZDoSyy0HLr50Eyt38Ay6eVGnkSr3eFAzwxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LELmYGdGJfKI9s76TbM7aJkPb1N+xzHy0p/v3LTxlJs=; b=JH3Vt8p/eHvLTDKEmlZUitUNV8oz7Ts4dJ201fbF3GyO4OKBol9/+NxeYyNQmfBf2gz2THGZDX2V8bzAYjONn6NwUI69GG17s+zOj62AGXe02Tfr+vkwvPBen87cLfNCDopUapW++EIDP/1qiYgTKvlNLvCx4iSTmcMKTZp4GXvy4+G1KuClWEcSimcc1st4AHV73KD/e7ItGxFTvVO56JtcO/DCDYIQX7MfOc4ezUbKSh8gTgykXjimhLsn/+TCZgiOPThQ31FzFGiOYNguPL2d7myHFmtQ5yoURd0Gwajg63m2gOkV7/jBBvMHIi5KmpL+FhGZOwGHfkGRX2f8pg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none Received: from MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) by MN2PR04MB6110.namprd04.prod.outlook.com (2603:10b6:208:e5::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Tue, 3 Nov 2020 15:43:31 +0000 Received: from MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::113e:c874:1207:eca8]) by MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::113e:c874:1207:eca8%6]) with mapi id 15.20.3499.030; Tue, 3 Nov 2020 15:43:31 +0000 Subject: Re: AF_UNIX status report To: cygwin-developers@cygwin.com References: <1d0ea5dc-7e9b-d8fe-5f6e-da7a799a3b13@cornell.edu> <20201027094340.GJ5492@calimero.vinschen.de> <0f945b4c-aa30-e08e-9f86-d4b41279ba10@pismotec.com> <20201030092019.GW5492@calimero.vinschen.de> From: Ken Brown Message-ID: <38e33f7a-e87d-fea8-ac9e-826f94c189d4@cornell.edu> Date: Tue, 3 Nov 2020 10:43:29 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 In-Reply-To: <20201030092019.GW5492@calimero.vinschen.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [68.175.129.7] X-ClientProxiedBy: CH2PR07CA0025.namprd07.prod.outlook.com (2603:10b6:610:20::38) To MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.0.17] (68.175.129.7) by CH2PR07CA0025.namprd07.prod.outlook.com (2603:10b6:610:20::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Tue, 3 Nov 2020 15:43:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a0553a0f-cfca-459e-4e9d-08d8800f376f X-MS-TrafficTypeDiagnostic: MN2PR04MB6110: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kf3LHYo6wBG9ZCOBaHMQw3yyMnOPJQ+ri+39zWeY+y6hrqPahiZ8ddiba2ZYvrkYH2VK+l4+FmxTjpCZOGytGt2G6ww0NiLm+QfLtvPjjY80ML85NLSc0JI/Po93uXLTZyhiMMQv6wctf8AcxKaVryk/cXHsPQNrkBo8Xp8DEhXwUXwLt9j0VAPkNZNnDBN5up4iRKG1T+RXayhWXn3QOzD/DRWDU7j0nBgOUDIbv2Sti3wF/Lf4xOhO97OGa55BXw1wLZ1HCWRvmW6VIKeH+VmGG5LzdhZsBzKCyr6VInmZt8KEqDKQO6qfDUV4Wb9FoyTjlv6rmId3ch0TOZbdEaKP3PlZ/1TO8NNulGe3QhWlOd246/TFRyJsvkl5391qGDcTUnNPOJCBZLVwsguF2iQuukiLyS6ZJTcfwfwa1RLwDj8aubn9+3wCOcKZdyLxheX1U58MlXQX1MPS29rVcg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR04MB6176.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(39860400002)(376002)(396003)(366004)(136003)(36756003)(83380400001)(66574015)(31686004)(75432002)(2616005)(86362001)(16526019)(31696002)(26005)(956004)(8936002)(53546011)(8676002)(7116003)(186003)(966005)(16576012)(316002)(4001150100001)(5660300002)(2906002)(6486002)(6916009)(786003)(478600001)(66946007)(66556008)(66476007)(52116002)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 4hgFlFqMXPWKWxB37NE6CHkHrJ1VGe/PZ0Ahz6d6gmzEy2TASsAEKVgQynTGyOI1KoC/20padFfKGCPh+XlJtjBmofQylQM+twv3ajD/iYkHfB3Tc/eJjzGLRc/l2R7Q6Z2IMLBbuAmKemOMh8IUU1vtrvaLwGWHDEhl5AVZNtk1wUtUMPk54wSPb6HG7fB1dB6WWMH9hHWGuVe4YetNJ3ybGv97aG2LNqRPbPaN2nsjC781F0CTAXYHELMQ/4sI44eQLvvxSBh30NAKsjgz8PAjdXDzrtDqKLejfiunJHmYGGGBrklxiB9iysoG3enIpdgf0jnOfIOFkKrXr5RT3rtf9PsUaBqm2+lulznzjSK4SZALdUGzJeQT8+5lq3vr/iud4vj0iPPCoOTLeaNyDq6FY4GWvgkLvheIoOswOh4TnFtNKv8nQbuXF+QHVfOBLpTMvX6c+MirWwZSd247wuQ7qpEcmcYo7EYGQD2aiNRB7Ivhfv0o0GQkmdU+ogxbrG4nXhbOG6rPm6++MDOrKt1ybw1oMZP/zJdWjPLYMNRe8dTU19C++UNmnKJ6KyBKt/4nrrdJClXNLTWlkItpiSj1MUIZWJWJflQEWG3h6vLWUpz4Sm0wLrbMgH69Nd9mxztgaPivM7iAoTM7XWGAwg== X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: a0553a0f-cfca-459e-4e9d-08d8800f376f X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB6176.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2020 15:43:31.7480 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HNP6HN9zALFtul0k6nRcjgJ88ITX0SeGW1mTpRP4uNOuzVyjBrrtPbwiIohzFDf7IOCpPbRZ2DGMEi9wOyX+dQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB6110 X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 15:43:34 -0000 On 10/30/2020 5:20 AM, Corinna Vinschen wrote: > On Oct 29 14:53, Joe Lowe wrote: >> On 2020-10-29 13:19, Ken Brown via Cygwin-developers wrote: >>> On 10/27/2020 5:43 AM, Corinna Vinschen wrote: >>>> On Oct 26 18:04, Ken Brown via Cygwin-developers wrote: >>>>> I've made at least rudimentary implementations of all the >>>>> fhandler_socket_unix functions (including those in select.cc) for which >>>>> there were previously only placeholders. >>>>> >>>>> I've pushed everything to topic/af_unix, including a merge with >>>>> master as of >>>>> a couple days ago. >>>>> >>>>> I've cobbled together a few test programs and put them in >>>>> winsup/cygwin/socket_tests on the topic/af_unix branch.  I >>>>> haven't taken the >>>>> time to automate the tests, so they all have to be run >>>>> interactively.  There >>>>> is a Makefile to build the test programs and a README.txt that >>>>> shows how to >>>>> run them. >>>>> >>>>> One thing I haven't yet done is to think about (or systematically test) >>>>> datagram sockets.  I'm sure there's quite a bit of code that >>>>> won't work for >>>>> them. >>>>> >>>>> Aside from datagram sockets, there are still a few things that >>>>> I'm working >>>>> on, but I'm close to the point where I could use some input: >>>>> >>>>> 1. I've littered the code in fhandler_socket_unix.cc and select.cc with >>>>> FIXME comments on which I'd like advice. >>>> >>>> I'll look into it. >>>> >>>>> 2. I haven't given any thought at all as to how to implement SCM_RIGHTS >>>>> ancillary data.  I could definitely use suggestions on that >>>>> before I start >>>>> thrashing around. >>>> >>>> I have only vague ideas at that point.  Assuming we can replace the >>>> socket implemantation with the pipe implementation, what we have is a >>>> pipe which can impersonate the peer at least from the server side, and >>>> it knows the client process.  This in turn can be used to duplicate >>>> handles.  So what we could do is to define fhandler methods which create >>>> a matching serialization  and deserialization of the fhandler data, plus >>>> duplicating the handles for the other process, sent over the pipe as >>>> admin package.  This must work in either direction, regardless if the >>>> server or the client sends the SCM_RIGHTS block. >>> >>> This sounds reasonable. >>> >>> I have no experience with serialization.  Do you happen to know of a >>> good example that I could look at? > > Unfortunately not. Probably we can just send the entire fhandler and > the recipient fiddles the content in a per-class way, kind of like > fhandler::dup. I'm working on implementing this, and I've bumped into an elementary C++ question. In order to send the fhandler in an admin packet, I need to determine its size dynamically, given an (fhandler_base *) pointer to it. AFAICS, this requires something like the following. In the definition of class fhandler_base, put a virtual function virtual size_t size () const { return sizeof *this; } and then repeat this essentially verbatim in every derived class: size_t size () const { return sizeof *this; } Does this seem right? I did an internet search and didn't find anything substantially different, although there were several suggestions to use templates in various ways. I'm not convinced that using templates would actually improve the code, but I can do it if you think it's better. See, for example, https://stackoverflow.com/questions/7642614/find-size-of-derived-class-object-using-base-class-pointer Ken