From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_NEOMUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD13EC04AAF for ; Tue, 21 May 2019 13:23:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B2CE32173C for ; Tue, 21 May 2019 13:23:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=brauner.io header.i=@brauner.io header.b="BUu5zjdt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728292AbfEUNXf (ORCPT ); Tue, 21 May 2019 09:23:35 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33386 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728198AbfEUNX1 (ORCPT ); Tue, 21 May 2019 09:23:27 -0400 Received: by mail-wr1-f66.google.com with SMTP id d9so5646998wrx.0 for ; Tue, 21 May 2019 06:23:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zPeZPlO76ltnQqvYGINFToUvBJmXqM645QmEt4Hw6Rc=; b=BUu5zjdtN4tz3uDq/7UpOx4K4hUQVJBWS+eEuFLdpi6Rmwdp0HavCUwLV8syhoRhBs uutuEJthT54zEPxESFMYXggKMqpF+e9kjCS2KXB6a8V8DjwFSU/ukGJ+bjlCRLwN7Itn NioFIdnrRyEyEXF9J8PaDiZ1BKte4njCTV4UqMcQIxHCp36wZKBXLuGaTuzR077IIyGB sh/VNZyNC9dytmpNSG0A/cuTGl76M/BtkEN2Bj2PP9spj3uzju6GRwQbZsYefL3l1zFQ DUpnJfPzQ1HZROA8RvSmOKB1jZ+QySIxvLrPIvBwJ5t1t+aSsSSgiGJe52BZXhX2b2t5 /pjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zPeZPlO76ltnQqvYGINFToUvBJmXqM645QmEt4Hw6Rc=; b=DrBvJpZLu0/myvYiKhjStCSUTIgtT6zEgsb8rOEZdhOaVSO8MF4uz6xUDUwun5Lc4U 1qQdAfz0k+TOd3+pXzARd5M8Plt4g16sQDHqnuHpp2qyfGtUmLWGEfy2fZMkedh/uL2a 0UQ3Mecz8FFC36pex6bTTMLp7yXFQCcnbZsXsASslC4EZZOBctSwDqE/apWov4yhp+Rv 8KA+c8rYOF1sicVzcbu2K/exq7QgltU3GdDWesfCiZ2rYAno0HG43wARtjBS8JpwGz52 ezoP3LFyLfhS9K3BsI6bwXowICHj/MxDPNz/iofvm5Jf286IFZDBHBGM5Dk0fJtT3Fd7 lP8Q== X-Gm-Message-State: APjAAAXthlrFf5XTEvngqeJqM7eGYcxpjCipZ1sjszXK2Jt4mGeWNCoq JtK4im6G3AafNAeLq33tMljErA== X-Google-Smtp-Source: APXvYqx9Vd+T8JFd9e9hzlyFLebVljF2D14aArNe6wO+D4nzJaWpMCXvLevCthzGrMSyj5JSdNW7NA== X-Received: by 2002:adf:e344:: with SMTP id n4mr26865746wrj.192.1558445005993; Tue, 21 May 2019 06:23:25 -0700 (PDT) Received: from brauner.io (p548C9938.dip0.t-ipconnect.de. [84.140.153.56]) by smtp.gmail.com with ESMTPSA id a15sm5483898wrw.49.2019.05.21.06.23.23 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 21 May 2019 06:23:24 -0700 (PDT) Date: Tue, 21 May 2019 15:23:23 +0200 From: Christian Brauner To: Florian Weimer 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() Message-ID: <20190521132252.y5wt7d7o4bdjns4e@brauner.io> References: <20190521113448.20654-1-christian@brauner.io> <87tvdoau12.fsf@oldenburg2.str.redhat.com> <20190521130438.q3u4wvve7p6md6cm@brauner.io> <87h89o9cng.fsf@oldenburg2.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87h89o9cng.fsf@oldenburg2.str.redhat.com> User-Agent: NeoMutt/20180716 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Tue, May 21, 2019 at 03:10:11PM +0200, Florian Weimer wrote: > * 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. Sure. I was thinking about other usecases. For example, sometimes in userspace you want to do the following: save_fd = dup(fd, > > 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