From fef9fbf3efeac874046cf58441ee39e1c1834fa5 Mon Sep 17 00:00:00 2001 From: Rupert Carmichael <5050061-carmiker@users.noreply.gitlab.com> Date: Sat, 31 Jul 2021 21:41:35 -0400 Subject: [PATCH] nall: File timestamp fix for OpenBSD and DragonFly BSD, add DragonFly BSD to PLATFORM_BSD definition --- nall/inode.hpp | 6 ++++++ nall/intrinsics.hpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nall/inode.hpp b/nall/inode.hpp index 89bebb24..0f740ae6 100755 --- a/nall/inode.hpp +++ b/nall/inode.hpp @@ -82,6 +82,12 @@ struct inode { #if defined(PLATFORM_WINDOWS) //on Windows, the last status change time (ctime) holds the file creation time instead case time::create: return data.st_ctime; + #elif defined(__OpenBSD__) + // OpenBSD is a special case that must be handled separately from other BSDs + case time::create: return min((uint)data.__st_birthtime, (uint)data.st_mtime); + #elif defined (__DragonFly__) + // DragonFly BSD does not support file creation time, use modified time instead + case time::create: return data.st_mtime; #elif defined(PLATFORM_BSD) || defined(PLATFORM_MACOS) //st_birthtime may return -1 or st_atime if it is not supported by the file system //the best that can be done in this case is to return st_mtime if it's older diff --git a/nall/intrinsics.hpp b/nall/intrinsics.hpp index 5a71704f..e7332e49 100755 --- a/nall/intrinsics.hpp +++ b/nall/intrinsics.hpp @@ -98,7 +98,7 @@ namespace nall { constexpr auto platform() -> Platform { return Platform::Linux; } constexpr auto api() -> API { return API::Posix; } constexpr auto display() -> DisplayServer { return DisplayServer::Xorg; } -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined (__DragonFly__) #define PLATFORM_BSD #define API_POSIX #define DISPLAY_XORG