[njs] FS: added support of OpenBSD for fs.stat() and friends.

Dmitry Volyntsev xeioex at nginx.com
Sat May 20 04:31:02 UTC 2023


details:   https://hg.nginx.org/njs/rev/7cd80c77433b
branches:  
changeset: 2125:7cd80c77433b
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri May 19 20:22:15 2023 -0700
description:
FS: added support of OpenBSD for fs.stat() and friends.

diffstat:

 auto/stat                |  18 ++++++++++++++++++
 external/njs_fs_module.c |   5 +++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diffs (50 lines):

diff -r 3ec3e7d2ce5f -r 7cd80c77433b auto/stat
--- a/auto/stat	Fri May 19 20:22:14 2023 -0700
+++ b/auto/stat	Fri May 19 20:22:15 2023 -0700
@@ -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=
diff -r 3ec3e7d2ce5f -r 7cd80c77433b external/njs_fs_module.c
--- a/external/njs_fs_module.c	Fri May 19 20:22:14 2023 -0700
+++ b/external/njs_fs_module.c	Fri May 19 20:22:15 2023 -0700
@@ -3399,8 +3399,6 @@ njs_fs_to_stat(njs_stat_t *dst, struct s
     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 s
 #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;


More information about the nginx-devel mailing list