From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 15 18:05:33 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5926E106567D for ; Tue, 15 Jun 2010 18:05:33 +0000 (UTC) (envelope-from b.yordanov@exsisto.com) Received: from exaxrb1.exsisto.com (exaxrb1.exsisto.com [81.29.192.98]) by mx1.freebsd.org (Postfix) with ESMTP id B6EC68FC25 for ; Tue, 15 Jun 2010 18:05:32 +0000 (UTC) Received: (qmail 5226 invoked by uid 507); 15 Jun 2010 20:05:28 +0200 Received: by simscan 1.4.0 ppid: 5223, pid: 5224, t: 0.1160s scanners: clamav: 0.96.1/m:52/d:7874 Received: from unknown (HELO ?192.168.0.103?) (b.yordanov@exsisto.com@77.70.122.245) by exaxrb1.exsisto.com with AES128-SHA encrypted SMTP; 15 Jun 2010 20:05:28 +0200 Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii From: Boyko Yordanov In-Reply-To: <4C17AF4A.3090600@elischer.org> Date: Tue, 15 Jun 2010 21:05:24 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <4C17AF4A.3090600@elischer.org> To: Julian Elischer X-Mailer: Apple Mail (2.1078) Cc: freebsd-hackers@freebsd.org Subject: Re: CLONE_NEWNS or similar in freebsd? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2010 18:05:33 -0000 On Jun 15, 2010, at 7:50 PM, Julian Elischer wrote: > Since we are not Linux guru's, can you define EXACTLY what that does = and exactly what subset of that YOU need. (and why). >=20 > we may be able to achieve the same final effect in a different way. Hi Julian! Yes, of course, I apologize for not exposing any details = about the expected results at first place. Here is the case: In a typical Linux environment my application is spawning children with = the clone() syscall. clone(), with the CLONE_NEWNS flag, allows the = child to gain its own private mount namespace. This means that when a = child mounts a directory (with mount() or nmount() in freebsd) and then = it "dies", the directories that it mounted do not persist in the = "fathers" process environment. Dirs are mounted only from the child = perspective and other processes do not see these mounts nor can they = interact with the mounted dirs. For what I'm aware, with Linux this can = be achieved with either clone() or unshare(), but for what I read none = of these exists in freebsd. rfork() for example spawns a child that does not have this private = namespace, and thus when the child mounts a directory and then it dies, = the directories that it had mounted remain mounted on the system = (visible for all other processes). So if I run the program on freebsd = I'll end up having thousands of mounted directories (a couple per child) = in a while. What I am trying to achieve is either the children having their private = mount namespaces (so that they do not leave their directories behind = mounted) or eventually unmounting the dirs when the mounts are no longer = needed.. seems a solution too, although a child is executing execve() = after the dirs are mounted, so I am not sure how to unmount the dirs = when the executed process exits. Hope this makes it more clear, I really appreciate any help on this. Boyko=