Changes

Jump to navigation Jump to search
m
cat files
Line 142: Line 142:  
</pre>
 
</pre>
    +
This is almost all. Only a few notes left.
    +
First, the above code is still buggy -- the file opener should make sure that everybody has their transport sockets ready. This requires some synchronization around <code>create_socket()</code> and <code>send_fd</code>.
 +
 +
Second, the "who will open a file" voting. We should make sure, that the synchronization mentioned above doesn't AB-BA deadlock, so when deciding which task to open a file we always chose the one with the smallest pid. And the file sending wave goes upwards the process tree :)
 +
 +
Third, the <code>open_a_file()</code> is not just [[How hard is it to open a file|this]]. Opened can be pipe, socket, signalfd, inotify and many other fancy stuff none of which uses the open-by-path engine.
 +
 +
And the last, but not least, files can depend on each other. E.g. an eventpoll file may have some other file descriptor monitored, and if we call the <code>open_a_file()</code> on eventpoll fd before we open the fd being monitored, we fail. This also affects the code that forms an array of <code>struct fd</code>-s
    
[[Category:Under the hood]]
 
[[Category:Under the hood]]
 +
[[Category:Files]]

Navigation menu