summaryrefslogtreecommitdiff
path: root/include/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2025-05-09 22:16:34 +0900
committerNobuyoshi Nakada <[email protected]>2025-05-30 20:55:12 +0900
commit18a036a6133bd141dfc25cd48ced9a2b78826af6 (patch)
treefa83f582fd9791db77abf7232fa5b3b31e36bcfb /include/ruby
parenta333fb1eccf5218559c89bd51753e48a8a156ade (diff)
[Feature #21205] Define File::Stat#birthtime by statx
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13474
Diffstat (limited to 'include/ruby')
-rw-r--r--include/ruby/io.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/ruby/io.h b/include/ruby/io.h
index 11d5ce5bfe..ed0967abad 100644
--- a/include/ruby/io.h
+++ b/include/ruby/io.h
@@ -66,6 +66,21 @@ RBIMPL_SYMBOL_EXPORT_BEGIN()
struct stat;
struct timeval;
+#if defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC)
+# define RUBY_USE_STATX 0
+#elif defined(HAVE_STRUCT_STATX_STX_BTIME)
+# define RUBY_USE_STATX 1
+struct statx;
+#else
+# define RUBY_USE_STATX 0
+#endif
+
+#if RUBY_USE_STATX
+typedef struct statx rb_io_stat_data;
+#else
+typedef struct stat rb_io_stat_data;
+#endif
+
/**
* Indicates that a timeout has occurred while performing an IO operation.
*/
@@ -1098,6 +1113,18 @@ int rb_io_read_pending(rb_io_t *fptr);
*/
VALUE rb_stat_new(const struct stat *st);
+#if RUBY_USE_STATX
+/**
+ * Constructs an instance of ::rb_cStat from the passed information.
+ *
+ * @param[in] st A stat.
+ * @return Allocated new instance of ::rb_cStat.
+ */
+VALUE rb_statx_new(const rb_io_stat_data *st);
+#else
+# define rb_statx_new rb_stat_new
+#endif
+
/* gc.c */
RBIMPL_SYMBOL_EXPORT_END()