auto-redirect private library file opening to use private descriptors
DR provides isolation of file descriptors for files opened by DR and clients, which is important for transparency and proper execution of shells and other applications.
However, when writting clients that use libraries, in particular C++ clients, it is convenient to use things like fstreams to deal with files. Yet this results in descriptors in the application space. Additionally, when writing code shared between clients and standalone apps, it can be painful to support both regular file behavior and private file descriptors (e.g., see drcachesim's named_pipe implementation, which resorts to a separate set_fd() and separate usage code in the client).
Can we make these various file open routines auto-redirect to private fd's? (If so we should update named pipe usage: no set_fd() needed.)
One potential issue is that os_open_protected() ends up using heap and thus grabs locks. This should be ok as neither clients nor 3rd-party libs should hold higher-ranking locks.