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).
> 
> 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_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to