Make dupfd() locking more clear.
Walter Harms pointed out the locking was rather obtuse in dupfd. This patch makes it much clearer. Present code acquires a lock in dupfd() callee locate_fd(), and releases it in allocate_fd() OR dupfd() itself. This changes cleans this up to acquire and release the lock entirely within dupfd(), which moves locking completely out of locate_fd() and allows the manual inlining of allocate_fd() into its only caller, dupfd(). This change is functionally equivalent to the current code [well, dupfd might run a cycle or two faster if the compiler optimizes well...]
Showing
Please register or sign in to comment