As a learning exercise, I'm calling ftw using .NET Core interop from C#.
It works fine insofar as I receive appropriate filenames in my callback. However, I haven't defined struct stat
correctly. There's a POSIX definition of that type, but it isn't sufficient because a particular implementation (e.g. my Ubuntu 18.04) is free to reorder the fields and add new ones.
I did the following search:
find /usr -name stat.h -print
It returns quite a few results, and each of those files has multiple preprocessor directives.
/usr/include/linux/stat.h
defines statx
. I tried it, but nonsensical values were populated in places like size. It's the wrong one.
There's a definition in /usr/include/x86_64-linux-gnu/bits/stat.h
that contains preprocessor directives.
Is there a way, given a particular Ubuntu installation, to definitively determine where struct stat
is defined and what preprocessor directives were defined? If so, how?