RE: Could anyone please explain this to me?
This might work. I will try an easier version first though. Simply
forking twice (thanks again, Peter).
We'll see how it works.
Michael
--
Dr. Michael Meskes, Project-Manager | topsystem Systemhaus GmbH
meskes@topsystem.de | Europark A2, Adenauerstr. 20
meskes@debian.org | 52146 Wuerselen
Go SF49ers! Go Rhein Fire! | Tel: (+49) 2405/4670-44
Use Debian GNU/Linux! | Fax: (+49) 2405/4670-10
>-----Original Message-----
>From: joost@rulcmc.leidenuniv.nl [SMTP:joost@rulcmc.leidenuniv.nl]
>Sent: Sunday, June 29, 1997 4:24 PM
>To: meskes@topsystem.de
>Cc: debian-devel@lists.debian.org
>Subject: Re: Could anyone please explain this to me?
>
>> I have a binary /foo that essantially does this:
>>
>> cd /
>> fork;
>> if father exit;
>> setsid;
>> kill all processes not in own session
>> umount /home
>>
>> This works fine, when I simply log in and start /foo as root. However,
>> when I first cd /home after logging in and then start /foo it cannot
>> unmount /home. As you might expect by now, I have to partitions: / and
>> /home. That means I cannot umount /home if I started the binary with cwd
>> on this partition although the child process doesn't even know about the
>> original cwd. And my login shell ahs already been killed.
>>
>> What can I do to avoid this? For my example it's not that big an issue,
>> but imagine /usr being mounted...
>
>Sue me for being clueless, but:
> could it be that when you start the programm, you have the
> current director "open" in some way (like processes can have files open).
> then, the fork-ed child inherets all open fd's from the parent, and thus
> also has /home open.
>
>Maybe (again, just guessing) something like this would help?
> if (current dir != "/"){
> cd /
> execv(myownimage)
> }
> kill all processes not in own session
> unmount /home
>
>(I'm hoping execv doesn't inherit open filediscriptors. The man page
>doesn't mention anything about this, the execve manpage sais that
>execve does inherit stuff).
>
>> Thanks in advance
>Well, actuall I don't think this all works, but hey, it could, cound't it?
>
>--
>joost witteveen, joostje@debian.org
>#!/usr/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
>$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
>lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
>#what's this? see http://www.dcs.ex.ac.uk/~aba/rsa/
--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org .
Trouble? e-mail to templin@bucknell.edu .
Reply to: