I believe the context of the whole file descriptor discussion involves threading and the bad performance of high file descriptors.
If your library wants to dup2 a high file descriptor, another library could be trying the same trick in another thread and screw up the whole thing if it happened at just the right point between your fstat and the dup.
The performance problems happen because of the way file descriptors are handled in-kernel.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds