From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id A7FD9385843A for ; Mon, 27 Sep 2021 16:41:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A7FD9385843A Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-64-xFLhTbfrM9uhxHW4lQCS6Q-1; Mon, 27 Sep 2021 12:41:05 -0400 X-MC-Unique: xFLhTbfrM9uhxHW4lQCS6Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2CE0810151E0; Mon, 27 Sep 2021 16:41:04 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.176]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 538AC60C4A; Mon, 27 Sep 2021 16:41:03 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Linux: Simplify __opensock and fix race condition [BZ #28353] References: <875yumghzs.fsf@oldenburg.str.redhat.com> <48158338-3d06-72aa-5e1b-0cb34e7325cc@linaro.org> <87wnn2f18n.fsf@oldenburg.str.redhat.com> Date: Mon, 27 Sep 2021 18:41:01 +0200 In-Reply-To: (Adhemerval Zanella's message of "Mon, 27 Sep 2021 13:33:39 -0300") Message-ID: <87ee9aeztu.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Sep 2021 16:41:09 -0000 * Adhemerval Zanella: > On 27/09/2021 13:10, Florian Weimer wrote: >> * Adhemerval Zanella: >> >>> Wouldn't be better to move it as the generic implementation (and also cleanup >>> it by removing unsualy families like IPX, AX25, and APPLETALK)? >> >> I don't know what Hurd needs, sorry. > > The difference with your proposal seems to be that AF_INET is used > as default instead of AF_NETLINK and AF_UNIX is not used. Also > Hurd does not define AF_IPX, AF_AX25, nor AF_APPLETALK so we can > safely remove them. > > What about: > > int > __opensock (void) > { > int type = SOCK_DGRAM | SOCK_CLOEXEC; > int fd; > > #ifdef AF_NETLINK > /* SOCK_DGRAM is supported by all address families. (Netlink does > not support SOCK_STREAM.) */ > > fd = __socket (AF_NETLINK, type, 0); > if (fd >= 0) > return fd; > #endif > > fd = __socket (AF_UNIX, type, 0); > if (fd >= 0) > return fd; > fd = __socket (AF_INET, type, 0); > if (fd >= 0) > return fd; > fd = __socket (AF_INET6, type, 0); > if (fd >= 0) > return fd; > > __set_errno (ENOENT); > return fd; > } > > I assume moving from AF_INET to AF_UNIX should be safe for Hurd [1]. Okay, I will prepare a patch along those lines. Thanks, Florian