<table><tr><td style="">fvogt requested changes to this revision.<br />fvogt added a comment.<br />This revision now requires changes to proceed.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D7423">View Revision</a></tr></table><br /><div><div><p>On neon it won't work as the kernel everything is built against (so the minimum API/ABI) is too old. You'll either have to hack around that by messing with include paths or use something more recent.</p>

<p>statx does not have a glibc wrapper, which means there is no <tt style="background: #ebebeb; font-size: 13px;">statx(...)</tt> function. So HAVE_STATX is rightfully false.</p>

<p>What Qt does is different: If <tt style="background: #ebebeb; font-size: 13px;">SYS_statx</tt> is defined, it determines during runtime whether the kernel supports it. <tt style="background: #ebebeb; font-size: 13px;">QT_STATBUF</tt> is in any case a <tt style="background: #ebebeb; font-size: 13px;">struct stat</tt>/<tt style="background: #ebebeb; font-size: 13px;">stat64</tt>, so if your code calls statx, it'll corrupt memory.<br />
The only reason your code even compiled is that stx_btime is not a macro, so that code wasn't compiled in.</p>

<p>There is a bigger design issue with this approach even: There are either "stx_" members or "st_" members available. So every access to "buff" needs to be guarded by both an #if HAVE_STATX and an if(statx_available).</p>

<p>You also need to note that the kernel syscall interface is different from glibc wrappers/posix functions: There is no errno, the error is directly in the return value.<br />
So <tt style="background: #ebebeb; font-size: 13px;">stat(...) == -1</tt> is not equal to <tt style="background: #ebebeb; font-size: 13px;">syscall(SYS_statx, ...) == -1</tt>. The latter is equivalent to <tt style="background: #ebebeb; font-size: 13px;">stat(...) == -1 && errno == EPERM</tt> (EPERM is 1).</p>

<p>I suggest rewriting this to make use of a wrapper function instead of macros, like Qt does. You can find that in <tt style="background: #ebebeb; font-size: 13px;">src/corelib/io/qfilesystemengine_unix.cpp</tt>.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D7423">https://phabricator.kde.org/D7423</a></div></div><br /><div><strong>To: </strong>ngraham, dfaure, broulik, elvisangelaccio, Frameworks, Dolphin, fvogt<br /><strong>Cc: </strong>fvogt, kde-frameworks-devel, bruns, meven, ltoscano, Frameworks, michaelh, ngraham<br /></div>