Changes

Initial
Let's imagine we have [[How hard is it to open a file|opened a file]] and want it to have some exact descriptor number, not the one kernel gave to us.

The information we have is
<pre>
struct fd {
struct file *file;
int tgt_fd;
} *fd;
</pre>

and we've just done the
<pre>
int fd;

fd = open_a_file(fd->file);
</pre>

what's next?