338 bytes added
, 09:32, 5 August 2014
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?