Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Enumerating pathname space entries: (5 Items)
   
Enumerating pathname space entries  
Hi,

I am attempting to spawn a process from one node to another.  The process being spawned is successfully calling 
resmgr_attach(), but I can't find the name it registered in the pathname space of that node!

If the spawned process figures out which node it is running on and chroots to /net/thatnode.domain.com then if I ls /net
/thatnode.domain.com it shows up.  But if I ls on the node itself, it isn't there.

When the process starts I've tried chroot()ing the "/", but that doesn't work either. 

I figure if I could enumerate what has been registered with proc in terms of pathname space entries, I might be able to 
figure out what is going on.  Is there a way to enumerate the pathname space? 

Or, maybe there is a concept that I'm missing here....

Thanks
Kevin
Re: Enumerating pathname space entries  
I don't need to enumerate the pathname space, I need to read the documentation of spawn.

The new process is inheriting the root directory and curernt working directory of the parent.

So

If the parent's node is named 'parent' and the name of the node on which the new process is spawned is named 'child' 
then:

current working directory of parent is: /home/bob

root dir of the new child process is:  /net/parent/
current working directory of the child is: /net/parent/home/bob

So...when calling resmgr_attach(), and you specify /subdir/name, in reality it is doing the following:

/net/parent/subdir/name

But.../subdir/name doesn't show up if you do an 'ls' on parent.  But if you do an ls on the child as in: ls /net/parent/
 .... then you will see it.

I understand the logic, but I really really want my remote spawn'd process to be able to register at the root of the 
pathname space of the node on which it was spawned.

I see the 'on' utility (if using the -f argument) chroot's to the destination node's root directory before calling 
spawn(), which makes sense.  Unless there is a way to chroot back, this isn't terribly useful to us.


So the question is, how do I get resmgr_attach() to go to the root of the local node, so that if I do a 'ls' on a 
console running on the local node, I will see /subdir?

Me thinks that it would be a way around chroot() and probably won't be allowed?

Thanks
Kevin
Re: Enumerating pathname space entries  
Okay, so I was in the middle of trying to set the root directory of the child process to /net/child/, but ran into 
another delima.

I need to query for the name of the node of the child, so I did the following:

char path[PATH_MAX+1];
netmgr_ndtostr( ND2S_DIR_SHOW |
					ND2S_DOMAIN_HIDE |
					ND2S_NAME_SHOW,
					ND_LOCAL_NODE,
					path,
					sizeof(path)-1);

The result being:

/net/parent

So netmgr_ndtostr must be using the pathname space to open() io-net.  This means a child process can't use io-net to 
find the name of the node it is running on?

Am I missing something?

Thanks
Kevin

Re: Enumerating pathname space entries  
Ugg...

I just tired having the child process chroot to the child node via /net/child

chroot( "/net/child" );

and then trying to do everything from that location.

No go...it still thinks it needs to be communicating with the io-net on the parent node..  Now I can't find where 
resmgr_attach() is putting my name....

I have myself tied in a knot here, any help is appreciated.

Thanks
Kevin
Re: Enumerating pathname space entries  
Ok

I have this figured out.

I tried chroot() the parent before spawning the child.  It worked for the child, but the parent then had a new chroot() 
it couldn't get rid of...kind of like what happens when you get a stepmother, if you don't like her, you can't get rid 
of her...

I tired chooting the parent through the child node back to the parent node, but apparently chroot() is too smart for 
that as well.

Then came the problem of the current working directory.  it would build a path that was a mile long and it wasn't even 
correct!  If I was spawning from node1 to node2, and had node3 running on the network, I'd end up with a current working
 directory along the lines of:

/net/node1.domain.com/net/node3.domain.com/net/node3.domain.com/net/node3.domain.com.

Node2 wasn't even mentioned, even though that's where the process ended  up.

We need to sit down and have a talk about this chroot and cwd business :)

So, as I mentioned, I fixed the problem.  I hope this isn't too much of a no-no, and I know someone is going to kick me 
for it, but I created my own spawn function that allows you to specify what the root directory will be for the process 
you are spawning.

There are cases where it needs to be a directory of the destination node w/o having to cripple the process that spawns 
it.

If anyone knows of a better way, I'm all ears...

Thanks
Kevin