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=-2.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 DCFD7C04AAF for ; Tue, 21 May 2019 13:25:49 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 60EA72173C for ; Tue, 21 May 2019 13:25:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=brauner.io header.i=@brauner.io header.b="BUu5zjdt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60EA72173C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=brauner.io Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 457c2z2VJXzDqLj for ; Tue, 21 May 2019 23:25:47 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=brauner.io (client-ip=2a00:1450:4864:20::444; helo=mail-wr1-x444.google.com; envelope-from=christian@brauner.io; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=brauner.io Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=brauner.io header.i=@brauner.io header.b="BUu5zjdt"; dkim-atps=neutral Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 457c0L4Kj1zDqJK for ; Tue, 21 May 2019 23:23:30 +1000 (AEST) Received: by mail-wr1-x444.google.com with SMTP id w8so18620463wrl.6 for ; Tue, 21 May 2019 06:23:30 -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=TE6+jwOnRU/6Vu44ZnnNOr/gSIjnr0NSvcGYkLiVh8ep0aQ62favTaz004zmp+myhR YiOfB53tU77/0hVeo9INvq6J85Xge3fxlv26kCIM4lEY7dtIHeVXBT3J8l+elhYuzm9R bb/FClP066Pw8nXp9NgAc21XRhpqiYPiXrQgED/8+eay8jWMQxLmocJHxQRW6Yh/Blet dsTwjsDDc1QRqpZpdjNE34ZhXz2NpTE9HbzOL/xwwPAM8g+/BwI9xEAHJFkBtSTzJTJg p29QAX0kgL8thSzMvjRT64V0TKRElIcJonSxEJOf0UfuFzz2o25Bnct7U+O0cH6x3N5b OJgg== X-Gm-Message-State: APjAAAUzJg8ml5FO4uFZeJkhTZfu5VafwEWPlH8lSmfOdRstT27CA5hY VnwGLspz6z/7WsKSu93iphTWCA== 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 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 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com, linux-kselftest@vger.kernel.org, sparclinux@vger.kernel.org, shuah@kernel.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, miklos@szeredi.hu, x86@kernel.org, torvalds@linux-foundation.org, linux-mips@vger.kernel.org, linux-xtensa@linux-xtensa.org, tkjos@android.com, arnd@arndb.de, jannh@google.com, linux-m68k@lists.linux-m68k.org, viro@zeniv.linux.org.uk, tglx@linutronix.de, ldv@altlinux.org, linux-arm-kernel@lists.infradead.org, linux-parisc@vger.kernel.org, linux-api@vger.kernel.org, oleg@redhat.com, linux-alpha@vger.kernel.org, linux-fsdevel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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