Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.h.meson
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#mesondefine HAVE_GETTEXT
#mesondefine HAVE_SIGWAIT
#mesondefine HAVE_STATX

#mesondefine INSTALL_BINDIR
#mesondefine INSTALL_DATADIR
Expand Down
10 changes: 10 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ if cxx.has_function('sigwait')
endif


if cxx.compiles('''
#include <sys/stat.h>
int main() {
struct statx stx;
return statx(0, "", 0, STATX_MTIME | STATX_BTIME, &stx);
}''', name: 'statx sample')
conf.set10('HAVE_STATX', true)
endif


if meson.version().version_compare('>= 0.59')
intl_dep = dependency('intl', required: false)
intl_found = intl_dep.found()
Expand Down
8 changes: 3 additions & 5 deletions src/libaudcore/vfs_local.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,6 @@ bool LocalTransport::get_file_timestamps(const char * filename, int64_t * mtime,
#include <sys/stat.h>
#include <sys/types.h>

#include <sys/syscall.h>
#include <unistd.h>

bool LocalTransport::get_file_timestamps(const char * filename, int64_t * mtime,
int64_t * birthtime)
{
Expand All @@ -462,10 +459,10 @@ bool LocalTransport::get_file_timestamps(const char * filename, int64_t * mtime,
if (birthtime)
*birthtime = -1;

#ifdef HAVE_STATX
// Use statx on Linux to get creation time
struct statx stx;
if (syscall(SYS_statx, AT_FDCWD, (const char *)path, 0,
STATX_MTIME | STATX_BTIME, &stx) == 0)
if (statx(AT_FDCWD, path, 0, STATX_MTIME | STATX_BTIME, &stx) == 0)
{
if (mtime)
*mtime = stx.stx_mtime.tv_sec;
Expand All @@ -474,6 +471,7 @@ bool LocalTransport::get_file_timestamps(const char * filename, int64_t * mtime,

return true;
}
#endif

// Fallback to regular stat
struct stat st;
Expand Down
Loading