I have code, written in C++, that needs to daemonize itself. As per usual, it iterates over all open file descriptors, closing them all. There a few exceptions, one of which is the file descriptor used for debug logging.
I am currently in the process of transitioning the code into the Boost::log infrastructure, when I came upon a problem. I have no way to know what the file descriptor for the stream is.
I've already accepted that I cannot straight out get the file descriptor out of the stream. I have some really ugly workarounds, and I can always re-implement the output stream, but these all seem so much work for very little gain.
Are these really my options? Is there something I might be missing?
Thanks, Shachar