From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, MAILING_LIST_MULTI,MIME_HTML_ONLY,MIME_HTML_ONLY_MULTI,MPART_ALT_DIFF, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: from tb-ob0.topicbox.com (tb-ob0.topicbox.com [64.147.108.117]) by inbox.vuxu.org (Postfix) with ESMTP id 40D4D211F0 for ; Sat, 6 Apr 2024 21:23:45 +0200 (CEST) Received: from tb-mx1.topicbox.com (tb-mx1.nyi.icgroup.com [10.90.30.61]) by tb-ob0.topicbox.com (Postfix) with ESMTP id AE10E26343 for ; Sat, 6 Apr 2024 15:23:44 -0400 (EDT) (envelope-from bounce.mM488a06c465454656c43cdfdc.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx1.topicbox.com (Postfix, from userid 1132) id A44AE126C473; Sat, 6 Apr 2024 15:23:44 -0400 (EDT) ARC-Authentication-Results: i=2; topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=icloud.com header.i=@icloud.com header.b=1YAOIm8g header.a=rsa-sha256 header.s=1a1hai x-bits=2048; dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=icloud.com; spf=pass smtp.mailfrom=leimy2k@icloud.com smtp.helo=qs51p00im-qukt01072701.me.com; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=content-type:content-transfer-encoding :mime-version:subject:date:message-id:references:in-reply-to:to :list-help:list-id:list-post:list-subscribe:reply-to:from :list-unsubscribe; s=sysmsg-1; t=1712431424; bh=gRAY+dkP0Tzp5S4L 0KcB2LqnOWeYMWMSWajjOWdw/E0=; b=slB6uHmkqtPYXbLHz614+pEUZ1BGS/Vn wfedqEjhWGqXTOMMcS/ME3tk0QaRTsgYE2sMXII2NeUegX+Eb6INGbw9OfNDGr1n H3+SzsQ9/8DfndCn+Q+q3AntARzxkaBNBAdNRulRUP7HGDs/3oYiqbVYOPfKDL4L ZQ30MRzxfhI= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1712431424; b=sSR7Zxk+kCJaQJeoCSe+dU5SmNDg02LlrRwBfAT8y6qSmFvvu3 Z9cKTuo2Fugih7a6Tn0BvMJ6SZToRm6WaGf9crnC7b0BU7tQYpjyiAWyPHCyabBk 3486JqNMMgTxNDooEROrCx4xCoK5K/oa1MGoQ9uDK6AUoJWxtHmEG23Uw= Authentication-Results: topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=icloud.com header.i=@icloud.com header.b=1YAOIm8g header.a=rsa-sha256 header.s=1a1hai x-bits=2048; dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=icloud.com; spf=pass smtp.mailfrom=leimy2k@icloud.com smtp.helo=qs51p00im-qukt01072701.me.com; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) X-Received-Authentication-Results: tb-mx1.topicbox.com; arc=none (no signatures found); bimi=declined (Domain declined to participate); dkim=pass (2048-bit rsa key sha256) header.d=icloud.com header.i=@icloud.com header.b=1YAOIm8g header.a=rsa-sha256 header.s=1a1hai x-bits=2048; dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=icloud.com; iprev=pass smtp.remote-ip=17.57.155.16 (qs51p00im-qukt01072701.me.com); spf=pass smtp.mailfrom=leimy2k@icloud.com smtp.helo=qs51p00im-qukt01072701.me.com; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=qs51p00im-qukt01072701.me.com policy.ptr=qs51p00im-qukt01072701.me.com; x-return-mx=pass header.domain=icloud.com policy.is_org=yes (MX Records found: mx02.mail.icloud.com,mx01.mail.icloud.com); x-return-mx=pass smtp.domain=icloud.com policy.is_org=yes (MX Records found: mx02.mail.icloud.com,mx01.mail.icloud.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=51 state=0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=9fans.net; h= content-type:content-transfer-encoding:mime-version:subject:date :message-id:references:in-reply-to:to:list-help:list-id :list-post:list-subscribe:reply-to:from:list-unsubscribe; s= dkim-1; t=1712431424; x=1712517824; bh=30vcAJBxmX6CVDwONi2dexVnr E8IxSUyZW/qD0CC9tM=; b=NYEq3ajyv9uUtcJxFfdMD6Iefw4ei66tHS3fASgDZ gE0bLL2VgzUUboA4M3BYpdm7nHPLqCzc7b5l7T7gcMAywoCNABO3ZPMD6sK2YCgt VR7g3PKVZShwqEOqoHJVaLF0YZFrVY4Ps7WRYw4FDiTDgcdqbSisxq1jkkUkvCis lc= Received: from tb-mx1.topicbox.com (localhost.local [127.0.0.1]) by tb-mx1.topicbox.com (Postfix) with ESMTP id 9D9BB126C02F for <9fans@9fans.net>; Sat, 6 Apr 2024 15:23:33 -0400 (EDT) (envelope-from leimy2k@icloud.com) Received: from tb-mx1.topicbox.com (localhost [127.0.0.1]) by tb-mx1.topicbox.com (Authentication Milter) with ESMTP id 7622B906857; Sat, 6 Apr 2024 15:23:33 -0400 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1712431413; b=XUYTEwbH6r/O6JwQMs36RGiLIaYes7oesYzZntg7UB6anIjc+i uQ0sYZs1Ib+Ci8uduUDsTpBy79Unsgwm9HkjfW33GPVCuINPEcGicemDPocIdWk1 onGetHSPfpLT7vwHwoKbJkYxf7PVmgJMmZJXHga171780uK+14Jp/2d6VfiHreYn Tbp2S0GbVKI+95qwF0gpFimihhzn/B0rF/sF7PYA0wto7IoMhS7ypKpmVoN2eDKk IGOrUxrkBIN9xBMISXQYTBs6v1fhQt261oYKfw7B4A218pvVI1XhZGrb/u1Ibq3w BLdje/opDTfprRmDCGmT/5KhFmNLc7PwKmQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=content-type:content-transfer-encoding:from :mime-version:subject:date:message-id:references:in-reply-to:to; s=arcseal; t=1712431413; bh=e0DCsgrddYvV5mbW+9vg7R20grkCA154X4R Ac/eh5hU=; b=mx7h6uBbp8bFZkS0DO1eH+hpFVthtkS0Fg7hkLHCvr7xBsO7bUD 6FO10AcEb+tP+97J5FM6f7X2Ae2mpmFA9LmpnTWvIiKxxX91U1UZAS9Dlf1gdHiU ath8jFDyL0oKKA/zhAxWGqIJjRM8J3ftcSa+b6KLzmdOZ0Tgp0ZVs5i7KRV3MVqU R3yBk4T7DHXXoWsHNLiV6GPzY+utla2v7VnA1um0lOZSel4Py7GoX1wz/zwHstgN Yh/kb5KkzL4uCOMQ+AEKHUhA4/KMXHymk97IebXNvhol0rodeU4M1P+E4xu8/Wwm qvb7oK1S9ETfGaQTwOQkZ2S/RSRbWy0zFFg== ARC-Authentication-Results: i=1; tb-mx1.topicbox.com; arc=none (no signatures found); bimi=declined (Domain declined to participate); dkim=pass (2048-bit rsa key sha256) header.d=icloud.com header.i=@icloud.com header.b=1YAOIm8g header.a=rsa-sha256 header.s=1a1hai x-bits=2048; dmarc=pass policy.published-domain-policy=quarantine policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=quarantine,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=icloud.com; iprev=pass smtp.remote-ip=17.57.155.16 (qs51p00im-qukt01072701.me.com); spf=pass smtp.mailfrom=leimy2k@icloud.com smtp.helo=qs51p00im-qukt01072701.me.com; x-aligned-from=pass (Address match); x-me-sender=none; x-ptr=pass smtp.helo=qs51p00im-qukt01072701.me.com policy.ptr=qs51p00im-qukt01072701.me.com; x-return-mx=pass header.domain=icloud.com policy.is_org=yes (MX Records found: mx02.mail.icloud.com,mx01.mail.icloud.com); x-return-mx=pass smtp.domain=icloud.com policy.is_org=yes (MX Records found: mx02.mail.icloud.com,mx01.mail.icloud.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=51 state=0 X-ME-VSCause: gggruggvucftvghtrhhoucdtuddrgedvledrudegvddgudefjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecuqfhnlhihuchonhgvuc hprghrthculdehuddmnecujfgurheptgfghfggufffkfhfjgfvofesrgejmherhhdtjeen ucfhrhhomhepffgrvhhiugcunfgvihhmsggrtghhuceolhgvihhmhidvkhesihgtlhhouh gurdgtohhmqeenucggtffrrghtthgvrhhnpeefieehkeegueeiffdvffeijeegffeijefg vdffveevieeggffhvdeftedugfffieenucffohhmrghinhepthhophhitggsohigrdgtoh hmnecukfhppedujedrheejrdduheehrdduiedpudejrdehjedrudehhedrvdeknecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudejrdehjedrudehhedrud eipdhhvghlohepqhhsheduphdttdhimhdqqhhukhhttddutdejvdejtddurdhmvgdrtgho mhdpmhgrihhlfhhrohhmpeeolhgvihhmhidvkhesihgtlhhouhgurdgtohhmqedpnhgspg hrtghpthhtohepuddprhgtphhtthhopeeolehfrghnsheslehfrghnshdrnhgvtheq X-ME-VSScore: 51 X-ME-VSCategory: clean Received-SPF: pass (icloud.com: 17.57.155.16 is authorized to use 'leimy2k@icloud.com' in 'mfrom' identity (mechanism 'ip4:17.57.155.0/24' matched)) receiver=tb-mx1.topicbox.com; identity=mailfrom; envelope-from="leimy2k@icloud.com"; helo=qs51p00im-qukt01072701.me.com; client-ip=17.57.155.16 Received: from qs51p00im-qukt01072701.me.com (qs51p00im-qukt01072701.me.com [17.57.155.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tb-mx1.topicbox.com (Postfix) with ESMTPS for <9fans@9fans.net>; Sat, 6 Apr 2024 15:23:33 -0400 (EDT) (envelope-from leimy2k@icloud.com) Received: from smtpclient.apple (qs51p00im-dlb-asmtp-mailmevip.me.com [17.57.155.28]) by qs51p00im-qukt01072701.me.com (Postfix) with ESMTPSA id 3A78F15C02A2 for <9fans@9fans.net>; Sat, 6 Apr 2024 19:23:32 +0000 (UTC) Content-Type: multipart/alternative; boundary=Apple-Mail-B2A64500-1842-46DE-9811-C4EDE0880C23 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (1.0) Subject: Re: [9fans] openat() Date: Sat, 6 Apr 2024 15:23:20 -0400 Message-Id: <6902D93B-2D04-40AD-A558-CF52D5602F73@icloud.com> References: In-Reply-To: To: 9fans <9fans@9fans.net> X-Mailer: iPhone Mail (21D61) X-Proofpoint-GUID: FyePT8ZTQKj0otkvUNaWhjw65c5dllZq X-Proofpoint-ORIG-GUID: FyePT8ZTQKj0otkvUNaWhjw65c5dllZq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-06_16,2024-04-05_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 clxscore=1011 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2404060155 Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: 2b303fe4-f44b-11ee-8287-d82257337056 Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UNjc1ZTczN2U3NzZlNWE5Yy1NNDg4YTA2YzQ2NTQ1NDY1NmM0M2Nk?= =?UTF-8?B?ZmRjPg==?= List-Help: List-Id: "9fans" <9fans.9fans.net> List-Post: List-Software: Topicbox v0 List-Subscribe: Precedence: list Reply-To: 9fans <9fans@9fans.net> From: "David Leimbach via 9fans" <9fans@9fans.net> List-Unsubscribe: , Topicbox-Delivery-ID: 2:9fans:437d30aa-c441-11e9-8a57-d036212d11b0:522be890-2105-11eb-b15e-8d699134e1fa:M488a06c465454656c43cdfdc:1:o1nizwSVGSio4AgVsXqcctD9okYQtIgLmbzB-ja7pCk --Apple-Mail-B2A64500-1842-46DE-9811-C4EDE0880C23 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Depending on the implemen= tation of the file system, openat vs open can be more efficient if there&rs= quo;s a lot of metadata locking for file creation.
Sent from my iPhone

On Apr 6, 2024, at 1:36 PM, ron = minnich <rminnich@gmail.com> wrote:


openat giv= es you the effect of 'cd path; open file' without having to cd. I d= on't see a lot of benefit to it unless you're opening a lot of file= s at that path. 

My first reaction, assuming you = have a lot of files in that directory, was something like
bind /d= ir /n/x and then just open /n/x/file... for a lot of files. 

This would work for any system call that takes a path.

The question I had was, can I get the benefit of *= at without doing what linux is doing, namely, for all system calls with a p= ath, make an '...at' version.
I am guessing so, though&nb= sp;I'm not sure it's as efficient.


On Fri, = Apr 5, 2024 at 8:19 PM <mo= ody@posixcafe.org> wrote:
My two cents on this:

What you _would_ want for this would be the ability to walk from the existi=
ng fd, however the limits of 9p walk make this a bit impossible to implemen=
t in a great way in my opinion. From walk(5):

The fid must represent a directory unless zero path name elements(for just =
cloning the fid) are specified. The fid must be valid in the current sessio=
n and must not have been opened for I/O by an open or create message.

Since not every fid is eligible for being walked from, in order to implemen=
t opanat() in any way that would be better than just batching the fd2path a=
nd open would be to keep a "last directory" associated, like what=
 we do with the string used to open it. Also worth mentioning that fd2path =
is not without its own problems, it's possible that the namespace has c=
hanged since the file has been opened so the same path may not work the sec=
ond time. So tagging the last directory Chan would be "more correct&qu=
ot;, but I am not sure how useful this is.

Answering some other comments made:
As I understand it from the rationale section on the linux man page, the call exists to avoid a race condition between=20 checking that a directory exists and doing something to a path=20 containing it. An additional motivator is providing the effect of=20 additional current working directories notably for Linux threads (which=20 presumably don't have their own. I think 'threads'  (proce= sses that=20 share memory) on Plan 9 do???).

Each process has it's own current working directory: % pwd /home/moody % @{cd /} % pwd % /home/moody
T=
his is all based on the assumption that holding a file/directory open keeps=
 it alive and in existence... which on Plan 9, I think it doesn't, does=
 it? As I understand it, remove can remove a file or directory that is open=
, which is not like UNIX/Linux...


Depends on the file server i= mplementation, I find that for more synthetic files they are indeed kept al= ive as long there is someone with a reference to the fid. This is identifiable if all the cleanup happens on clunks(destroyfid in lib= 9p), which only happen when a fid's refcount hits zero. For non-synthetic or more "disk" file servers the behavior can di= ffer. Cwfs does not keep the data around, readers that attempt to read a de= leted file, even if they already have a reference open to it will result in= a phase error. However 9front's ramfs keeps the data around.

My test for this was as follows:
win1% echo = 9;something' >/tmp/test
win2% </tmp/test { sleep 10; ca= t }
win1% rm /tmp/test # observe the error(if any) on win2

So you= really can't assume either case.


Thanks,
moody

P.S.
I apologize for the = formatting, it seems my emails are not making it to the list when I attempt= to send them from my mail server so I had to copy this response in to the = web form.  I would like to figure out why if possible.
= --Apple-Mail-B2A64500-1842-46DE-9811-C4EDE0880C23--