From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, NICE_REPLY_A autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 30629 invoked from network); 29 Mar 2023 17:53:30 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 29 Mar 2023 17:53:30 -0000 Received: from mail.posixcafe.org ([45.76.19.58]) by 9front; Wed Mar 29 13:52:13 -0400 2023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posixcafe.org; s=20200506; t=1680112677; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SQ8Lk9SZV+XufVEhh5F5dPBcRPWGf7L3+SUYeMHEz54=; b=HnFb41QVpaFB8yLT4XGAH06ODU9fRfQhAIZdzhkY7z+sdq5H6kWRCEmsSMcAFe5CFl8n5F 87u+lgZOe9XggPoW2xZNkAsKsohLb4Lotk9pXm/XC/ZrXdvEM5zubBnKAGJpSWpAh+fNjS 1DNOXjObsY+Yl/y4WYIB/ZAmEX7PzQM= Received: from [192.168.168.200] (161-097-205-025.v4.mynextlight.net [161.97.205.25]) by mail.posixcafe.org (OpenSMTPD) with ESMTPSA id 46afed40 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <9front@9front.org>; Wed, 29 Mar 2023 12:57:56 -0500 (CDT) Message-ID: <4d634a56-b533-6fd4-7010-142099f2464e@posixcafe.org> Date: Wed, 29 Mar 2023 11:51:28 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Content-Language: en-US To: 9front@9front.org References: <33F010865FC9B2A02D0352D79A362A33@smtp.pobox.com> From: Jacob Moody In-Reply-To: <33F010865FC9B2A02D0352D79A362A33@smtp.pobox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: structured compliant WEB2.0 over WEB2.0 component-scale self-signing-scale controller Subject: Re: [9front] srv(3) clone and srvid Reply-To: 9front@9front.org Precedence: bulk On 3/29/23 11:45, unobe@cpan.org wrote: > I'm trying to run ndb/dns in a separate namespace so that I can use it > to forward requests (in the namespace) to another DNS server. > Recently, ndb/dns was updated to use /srv instead of '#s', which is > necessary to keep it separate from the primary devsrv. srv(3) states > I can clone /srv and access that in two ways, via /srv/id or directly > using srvspec: > > bind -c #s$srvspec /srv > > /srv/clone > /srv/id/... > /srv/service1 > /srv/service2 > > The functionality is explained near the end of the man page: > Opening the clone file allocates a new service directory. > Reading clone returns the id of the new directory. This new > service directory can then be accessed at /srv/id. Directo- > ries are recursive; each new service directory contains its > own clone file and sub-directories. Directories can be > walked from the root such as #s/id1/id2/id3 which makes them > globally addressable. As a convention, /lib/namespace > accepts the path to the service directory from the environ- > ment variable $srvspec, making it possible to start a new > namespace using a specific service directory as a starting > point. > > If I do: > cpu% cat /srv/clone > 15cpu% > > I get a new id. I expected to be able to go to the clone using > /srv/15, but that is not available: > cpu% lc /srv/15 > ls: /srv/15: '/srv/15' file does not exist > > I can, however, specify the srvspec to (supposedly) bind to a new > service directtory: > cpu% srvspec=`{cat /srv/clone} bind -c '#s'^$srvspec /srv > cpu% > > Yet I would have expected this cloned service directory to be > disassociated from its parents so that manipulating it would not > affect the parent. Right now, that is not the case. If I rm > /srv/dns', after cloning the service directory, it is reflected across > all namespaces. Is this a feature that hasn't been implemented? Am I > misunderstanding how it's meant to work? > Yes, clone works like how it does in /net, the board is only open for as long as you have the fd open. So you cat'd it which opened it, read the new id, then closed it deallocating the child srv. You need to keep the fd open for the length of time you use the child srv, Or if you wish to 'pin' the child srv you can stash the clone fd itself as a file in the child srv. This will keep the child srv around until you remove the pinned clone fd.