From nobody Sun Dec 05 17:53:23 2021 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CD53E18B2C0F for ; Sun, 5 Dec 2021 17:53:32 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell1.rawbw.com (shell1.rawbw.com [198.144.192.42]) by mx1.freebsd.org (Postfix) with ESMTP id 4J6Z175j0kz4Zq3 for ; Sun, 5 Dec 2021 17:53:31 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from [192.168.5.3] (c-73-189-35-76.hsd1.ca.comcast.net [73.189.35.76]) (authenticated bits=0) by shell1.rawbw.com (8.15.1/8.15.1) with ESMTPSA id 1B5HrO8v010887 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sun, 5 Dec 2021 09:53:25 -0800 (PST) (envelope-from yuri@rawbw.com) X-Authentication-Warning: shell1.rawbw.com: Host c-73-189-35-76.hsd1.ca.comcast.net [73.189.35.76] claimed to be [192.168.5.3] Message-ID: <656bf089-bcc9-748a-6db2-52f3707e863c@rawbw.com> Date: Sun, 5 Dec 2021 09:53:23 -0800 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: Is it possible to determine the open file path based on the file descriptor? Content-Language: en-US To: Konstantin Belousov , Mateusz Guzik Cc: Freebsd hackers list References: <21b0280d-c290-f27f-98a9-0c2242380718@rawbw.com> <5a00f93e-21a1-47ab-6e8e-15d24840c525@rawbw.com> <20200708175300.GA2866@kib.kiev.ua> From: Yuri In-Reply-To: <20200708175300.GA2866@kib.kiev.ua> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4J6Z175j0kz4Zq3 X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=rawbw.com; spf=pass (mx1.freebsd.org: domain of yuri@rawbw.com designates 198.144.192.42 as permitted sender) smtp.mailfrom=yuri@rawbw.com X-Spamd-Result: default: False [1.95 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEFALL_USER(0.00)[yuri]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:198.144.192.0/24]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; ARC_NA(0.00)[]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.34)[-0.343]; DMARC_POLICY_ALLOW(-0.50)[rawbw.com,none]; NEURAL_SPAM_LONG(0.99)[0.991]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:7961, ipnet:198.144.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[73.189.35.76:received] X-ThisMailContainsUnwantedMimeParts: N On 7/8/20 10:53, Konstantin Belousov wrote: > I think an immediately useful addition would be a sysctl or fcntl that > return struct kinfo_file for single file descriptor. There is another project that resolves file descriptors to file names: https://github.com/PixarAnimationStudios/USD/blob/release/pxr/base/arch/fileSystem.cpp#L470 Maybe it makes sense to provide a sysctl or fcntl that would return a list of paths for a given file descriptor? I opened the PR for this: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260241 Yuri