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.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_NEOMUTT autolearn=ham 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 86AD9C04AAF for ; Tue, 21 May 2019 13:18:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 5CC2D20856 for ; Tue, 21 May 2019 13:18:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="C5BWz6rx"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=brauner.io header.i=@brauner.io header.b="Qzja+tqW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5CC2D20856 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=brauner.io Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JS6ObEkYGd7LnATVBLhGk4+Ry+6gmqqQW79ASzODlHU=; b=C5BWz6rxhrEuu5 unbtozfohf5leMrxIZNuhk/M1WGJm1pEUdNMS/RGyj+QpyWTbajOXTH+IMsf70eZFEzjwsXcUGgqw CATB6PjQmR6sYGa8nf3nxg7meEUZwK0wjJ01CzS1hTWrLR2uhyQmD4GkRaNmTUtVhV5onH6R6vg4K 8DDMcjxLSuVgvYT1RkmeXhwJVm3GujPDHrtH4EEAcKiG7XPSiYiigWu5Pq5zBTXSjX6NvZqRAz5cE LIe5/HouOI0RsEPkLqhVv0zUkpeMidTz5mf12d9X9IKa9KSHbBLyQNQxC63Zui9aaIGQAE40hv2Py 1P1A9NoKEbbF/N/ta7Pw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hT4fS-0002Hw-50; Tue, 21 May 2019 13:18:58 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hT4fP-0002Ha-U9 for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2019 13:18:57 +0000 Received: by mail-wm1-x342.google.com with SMTP id y3so2972601wmm.2 for ; Tue, 21 May 2019 06:18:55 -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=m/t4nh9Qn5eHvWriEo2lAzUTm+cejgZEB4hMcOrCq4Y=; b=Qzja+tqWdJKwhlDJv7ZeHS1krNqDAM++eYcwAp+RKkbv8p1KDPWxxZhzOpavU0EOHV kYWbjNPEjkxc3aEKZdrk9785qJNa6FxJtfkDGm1FLt3j0bk9/8YvawePnukWGCyjpFii 0DMW2p0x+5xPdVsJRuiSOe+/dtlaOGa52u2fWdq9QaNK4Tve8leR5ZqhEKAiqjWW0X06 oTZk1e1uxbJPDBZIKsNtQKeWDeRpwtxnoV5XKv/I6zW+K9rGYAZZ7B8YjZBRwD4kYhWa WgDiIxwS5iY9PCvzQxN+w34XvRhk0st2I0ChEGvAZh7Cr4yOtxIXjdk5keUvD29dcq/r WLUA== 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=m/t4nh9Qn5eHvWriEo2lAzUTm+cejgZEB4hMcOrCq4Y=; b=WANPo3cu2VRw9Fh35zyk0t7vmMoLRg5oWSJkTP3GXkP4lc+J6N0Dn2a1YK/6IQAeM+ Ozq3YD1byJkM8qyG4kAgQUVGI4R0Su8Ms6+tJ5L423TJ/tmsrin8MmCESnnv5pxguKHC Ef3OlEUgHEu6hM+TQp9MFAyO5R4MNj/C9TVKjA6ctNX8UhGynYKAu8ijnH9JyYQMMQFI msPszIWUEVWHqWchIAIn5pCaG1Gv+cuGr+A3mY3jmMxt5VOVAsVnNNI8KhrcyKhIxuQt 7FNzkT2prWyfqGbp3uIQaab/zjvSFCWGnuOV5F37w0nFUE1KmFGLjGqTiXTcItfDul/K GjSQ== X-Gm-Message-State: APjAAAWHIeMBgo4q7VtqFICSLZZRdn3QrllpyG9+hI5IdoqeJN27u/1S f6yC/PhSRLeUAKW34x04gP9few== X-Google-Smtp-Source: APXvYqyfKPZSJeUKKvR/WsITTIjBfoMQuzQ5Xtre6YfbYN0C4pHfHkECFwZ8Y50hJAsIDs/Jg3fbyg== X-Received: by 2002:a1c:9c8c:: with SMTP id f134mr3258598wme.95.1558444734225; Tue, 21 May 2019 06:18:54 -0700 (PDT) Received: from brauner.io (p548C9938.dip0.t-ipconnect.de. [84.140.153.56]) by smtp.gmail.com with ESMTPSA id n4sm2071899wmk.24.2019.05.21.06.18.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 21 May 2019 06:18:53 -0700 (PDT) Date: Tue, 21 May 2019 15:18:50 +0200 From: Christian Brauner To: Florian Weimer Subject: Re: [PATCH 1/2] open: add close_range() Message-ID: <20190521131849.2mguu5sszhbxhvgu@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-Disposition: inline In-Reply-To: <87h89o9cng.fsf@oldenburg2.str.redhat.com> User-Agent: NeoMutt/20180716 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190521_061855_976586_0DE490CA X-CRM114-Status: GOOD ( 15.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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. > > > 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. Oh, how would that be difficult? Maybe I'm missing context. Couldn't you just do fcntl(0, F_GET_NEXT) > > >> 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. No, that's perfectly fine. I mean, you clearly need this and are one of the major stakeholders. For example, Rust (probably also Python) will call down into libc and not use the syscall directly. They kinda do this with getfdtable rn already. So what you say makes sense for libc has some relevance for the other tools as well. Christian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel