]> git.kaiwu.me - njs.git/commitdiff
FS: added support of OpenBSD for fs.stat() and friends.
authorDmitry Volyntsev <xeioex@nginx.com>
Sat, 20 May 2023 03:22:15 +0000 (20:22 -0700)
committerDmitry Volyntsev <xeioex@nginx.com>
Sat, 20 May 2023 03:22:15 +0000 (20:22 -0700)
auto/stat
external/njs_fs_module.c

index 12b209a8901aa96a24f7eb80de83ed96d409f3d3..57816be0123ed9653b1209dbcc856438b2468b39 100644 (file)
--- a/auto/stat
+++ b/auto/stat
@@ -40,6 +40,24 @@ njs_feature_test="#include <sys/stat.h>
 . auto/feature
 
 
+njs_feature="stat.__st_birthtim"
+njs_feature_name=NJS_HAVE__STAT_BIRTHTIM
+njs_feature_incs=
+njs_feature_libs=
+njs_feature_test="#include <sys/stat.h>
+
+                  int main(void) {
+                      struct stat st;
+
+                      if (fstat(0, &st) != 0) {
+                         return 1;
+                      }
+
+                      return (int) st.__st_birthtim.tv_sec;
+                  }"
+. auto/feature
+
+
 njs_feature="stat.st_atim"
 njs_feature_name=NJS_HAVE_STAT_ATIM
 njs_feature_incs=
index 9ae1b7c7bbee242020e22a7b16daf806ea8f1155..64c135045b6888a91f7a254dba3a083d3e0692fa 100644 (file)
@@ -3399,8 +3399,6 @@ njs_fs_to_stat(njs_stat_t *dst, struct stat *st)
     dst->st_mtim.tv_nsec = st->st_mtimespec.tv_nsec;
     dst->st_ctim.tv_sec = st->st_ctimespec.tv_sec;
     dst->st_ctim.tv_nsec = st->st_ctimespec.tv_nsec;
-    dst->st_birthtim.tv_sec = st->st_birthtimespec.tv_sec;
-    dst->st_birthtim.tv_nsec = st->st_birthtimespec.tv_nsec;
 
 #elif (NJS_HAVE_STAT_ATIM)
 
@@ -3414,6 +3412,9 @@ njs_fs_to_stat(njs_stat_t *dst, struct stat *st)
 #if (NJS_HAVE_STAT_BIRTHTIM)
     dst->st_birthtim.tv_sec = st->st_birthtim.tv_sec;
     dst->st_birthtim.tv_nsec = st->st_birthtim.tv_nsec;
+#elif (NJS_HAVE__STAT_BIRTHTIM)
+    dst->st_birthtim.tv_sec = st->__st_birthtim.tv_sec;
+    dst->st_birthtim.tv_nsec = st->__st_birthtim.tv_nsec;
 #else
     dst->st_birthtim.tv_sec = st->st_ctim.tv_sec;
     dst->st_birthtim.tv_nsec = st->st_ctim.tv_nsec;