Niall Douglas wrote:
On 04/06/2021 13:04, Andrey Semashev via Boost wrote:
I could add a runtime check, but I definitely don't want that check to happen on every call. This means the result must be stored globally in a thread-safe manner.
At work we've got llfio::stat_t::fill() being called in some places millions of times per second.
It is implemented by attempting statx first, and if it is not supported, then stat or other syscalls to emulate the same.
You cannot cache statx support/non-support because only some filing systems support statx, and others do not. So depending on the path used, it may work, but at other times, not.
Right now at work we're on kernels which don't support statx, so we are always getting back ENOSYS and then falling back to emulation. We have not found any performance issues.
A kernel call is infinitely more expensive than checking a number against ENOSYS. It's absolutely impossible for the test to ever be a performance issue.