Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp949208ybm; Tue, 21 May 2019 06:25:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxI6CHNiUG0CHl3wfsa0sqlJD9qACMnah3s9fcgzp+YGX4rI+0u/i4aqk7+Lgg3yIbF+51r X-Received: by 2002:a62:4d03:: with SMTP id a3mr89021057pfb.2.1558445103663; Tue, 21 May 2019 06:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558445103; cv=none; d=google.com; s=arc-20160816; b=CXBxGBx1mkHyGppxKKaAiBrB58YgSudF1gA0o7LwXqfm1KUhRQcUvxI56UCabt69k2 KY5dNg3/N6h3b3LjGffo3FrX2beIy+eImk2fZWZuq/52rZn2NNJjjqUWIQv5n3F1Xjw8 DznZBDQy1OH7ZGrV8PTTXjsO16oqKQQdDc60kxgqjfa5/ae8yDZYQCs54V9Y8nM7kjva 5AU79EqqgOyVbYZvV8pzCJXdoKOvM3JdD8NFr5eG8I9m9r4l2vsJNeRxBkWnEmSEL8HQ YLtwOA1hhRMPxehUFBiRH2l1Bj3gymG34g4Q+v7OQ1vdz0CNwR1C/ZgyywNl63bRAYsE AGsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zPeZPlO76ltnQqvYGINFToUvBJmXqM645QmEt4Hw6Rc=; b=OMC4Bsy5VHoTTibUgjchmjjCH4SxoMbN/urB3iOEAfj310OOqu9hTgJKucEFR2cLyX 0KnEXNHcdKnb6Kj4zKpTfEtvLDGqAuH5TUfznlnebCZeHOotl/0DZy2R3nrBsqPf80Jg jGG7ae3jzzP/OCbph8SiNVgIE0DJxxC7fqib1WZ1Iffxn5FVRSIz828D8xInTZ12bIbe yfCHvSF7ToiFg/BeE6YMDvXFq2hqg4M3db+FBB2YyRDZr0IMbwKhYQQuHUYTWUh1Hr5I +qAlin441F/UVDU3pwGL+PyXdTDCmYXPD0l/H5rrpzkr9/XNB01nxPpGKbNVbhc12+nJ JVDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=BUu5zjdt; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q138si22082098pfq.149.2019.05.21.06.24.47; Tue, 21 May 2019 06:25:03 -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; dkim=pass header.i=@brauner.io header.s=google header.b=BUu5zjdt; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728142AbfEUNXa (ORCPT + 99 others); Tue, 21 May 2019 09:23:30 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39102 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728175AbfEUNX2 (ORCPT ); Tue, 21 May 2019 09:23:28 -0400 Received: by mail-wr1-f67.google.com with SMTP id w8so18620466wrl.6 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=jD26rNd36IaQfOvXn+T6MhUA3crEvzUQqBpIIgDXOIoOeBW3ZuCblsBN6+rTqGnPLz XS6xRHcuDtUCzX1mFtZxLQnRmReHyUmelAV06lnMd9q30pEtLkdzQ8qWa2/xvF/ni9OV 7b9ve5PykUB4uybXWLuoAqJzfSkmb1sYZOiVbscSucYV29s081MnQx3TNU0PqV+oflbx iWdHEx8UNMX44kOH+XyYZIhoCyO5G0K+JcWgB7izKqo3sVsA6lsV7/TjAo2cVh7d04wv oD46f/ISLyyAmy6waBHxSONmcsMb5u1mThV0J9iFJgJ9UHVk3z83U/5FQqGP8DYhf7mP W5dg== X-Gm-Message-State: APjAAAXpu3QdnTVzljem7gDF/yZaxAEMk6NKbjb+oEoL4ULeSQrlVvMv co2qfGFqKlSyJw96v94cv8X0Xw== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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