<?xml version="1.0" encoding="windows-1252"?>
<node id="249318" title="Re: (Perl6) Groking Continuations (_!)" created="2003-04-09 13:36:45" updated="2005-08-07 06:34:17">
<type id="11">
note</type>
<author id="3737">
Dominus</author>
<data>
<field name="doctext">
Says [tye]:
&lt;blockquote&gt;&lt;em&gt;
Too bad Unix didn't provide an &lt;b&gt;efficient&lt;/b&gt;
 way to save/restore chdir context (based on i-node instead of on a path string). 
&lt;/em&gt;&lt;/blockquote&gt;&lt;p&gt;

Many unixes now provide an &lt;tt&gt;fchdir&lt;/tt&gt; call which does what you want; 
instead of a pathname, it accepts an open file descriptor and then
sets the cwd to the directory pointed to by the descriptor.  To save
the old cwd, you simply open the current directory.  After you've
done &lt;tt&gt;chdir&lt;/tt&gt;, you can &lt;tt&gt;fchdir&lt;/tt&gt; to the descriptor
returned by the &lt;tt&gt;open&lt;/tt&gt; when you want to go back.
&lt;p&gt;

You can't have a system call that simply accepts an i-number,
because such a call would bypass the filesystem's permission controls.&lt;p&gt;


&lt;p&gt;
--&lt;br&gt;&lt;font size="-2"&gt;
&lt;a href="mailto:mjd-www-perlmonks+@plover.com"&gt;Mark Dominus&lt;/a&gt;&lt;br&gt;
&lt;a href="http://perl.plover.com"&gt;Perl Paraphernalia&lt;/a&gt;&lt;br&gt;&lt;/font&gt;</field>
<field name="root_node">
248935</field>
<field name="parent_node">
249087</field>
</data>
</node>
