Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp934824ybm; Tue, 21 May 2019 06:12:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0aVMMXy+Jt//U4a7sWufcRCVd2/6FPkqR9faO22jwtc2BAXCzzP1CFeNxQZL1ue/w7iDz X-Received: by 2002:a63:2706:: with SMTP id n6mr15267343pgn.238.1558444341341; Tue, 21 May 2019 06:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558444341; cv=none; d=google.com; s=arc-20160816; b=IJzE065CgQ5PQk8+PfW01LbrzDnKq4DxQZ0/Cg8AivxYNdZJyi+xJmvhx6LxVZg9gf DBD/wF/QY684MHhhIjRny16wWQeU6hlb2ecyGtvxVf+rzQvlwlub8PuvEmupnM6p2YaF tFujfYZgKa1/HRmRNyYpFSE257T1c9dIpZdMfr2BDOGe64gL/2q3dQHBXU4QgkjuIcPr sA9AUSgG/xF74K6HjXtXBtk9zF1EJyEQVsbveU+/DZ8fE1SYSs0zSy5hpIL8MULIbyfR e0LZ0ZP0DQYTE/y/y26I8QhnLtdg6ymTWaw8hAgt2y9XDHMjFk1+gxI9XN4/q9h8Tzoj Bm5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=SL41Ux6HqsB+B1h2L1G7VyCYcJSVy/fjfAiMQKcwtFk=; b=gTpOVkUE7ZkuFyJyqbfvKY8Blv62nnrNkBNyBoWXRGTI9zOXu1NvjVQL/n9rGWz1up bTQtXsf2tmUqscoeXkW/C7J2lp6DPVN6pfptw8eLdKeAlwcbmvH5/c+EXwz5uKZCOOEg eUSNKrNR4YirGNNsy1xC67ZDpzJEbWuoEcuTKzz4u9WnDCp9WSldA/DbzLyUL/GSpDEt aCUuXbBuf/WTL8r987RhTwacrhcjfvFeDIauuIT7EmqkaHsbjem6tVrqoHPj1xV/BlSx 3qJYnem1kQ4j4TnpfGlJYDSGbXLPD7rIcs3uB0zL4vCWWlOAOsuzjO3RZRJ1bc4VvQtE 1Gsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si556567pln.72.2019.05.21.06.12.05; Tue, 21 May 2019 06:12:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728217AbfEUNKs (ORCPT + 99 others); Tue, 21 May 2019 09:10:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36728 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726900AbfEUNKs (ORCPT ); Tue, 21 May 2019 09:10:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A31313086231; Tue, 21 May 2019 13:10:24 +0000 (UTC) Received: from oldenburg2.str.redhat.com (dhcp-192-219.str.redhat.com [10.33.192.219]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 52692665F4; Tue, 21 May 2019 13:10:13 +0000 (UTC) From: Florian Weimer To: Christian Brauner Cc: viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, jannh@google.com, oleg@redhat.com, tglx@linutronix.de, torvalds@linux-foundation.org, arnd@arndb.de, shuah@kernel.org, dhowells@redhat.com, tkjos@android.com, ldv@altlinux.org, miklos@szeredi.hu, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 1/2] open: add close_range() References: <20190521113448.20654-1-christian@brauner.io> <87tvdoau12.fsf@oldenburg2.str.redhat.com> <20190521130438.q3u4wvve7p6md6cm@brauner.io> Date: Tue, 21 May 2019 15:10:11 +0200 In-Reply-To: <20190521130438.q3u4wvve7p6md6cm@brauner.io> (Christian Brauner's message of "Tue, 21 May 2019 15:04:39 +0200") Message-ID: <87h89o9cng.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 21 May 2019 13:10:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Christian Brauner: >> Solaris has an fdwalk function: >> >> >> >> So a different way to implement this would expose a nextfd system call > > Meh. If nextfd() then I would like it to be able to: > - get the nextfd(fd) >= fd > - get highest open fd e.g. nextfd(-1) The highest open descriptor isn't istering for fdwalk because nextfd would just fail. > But then I wonder if nextfd() needs to be a syscall and isn't just > either: > fcntl(fd, F_GET_NEXT)? > or > prctl(PR_GET_NEXT)? I think the fcntl route is a bit iffy because you might need it to get the *first* valid descriptor. >> to userspace, so that we can use that to implement both fdwalk and >> closefrom. But maybe fdwalk is just too obscure, given the existence of >> /proc. > > Yeah we probably don't need fdwalk. Agreed. Just wanted to bring it up for completeness. I certainly don't want to derail the implementation of close_range. Thanks, Florian