From fc90c4ec5da9e60c18785b3b4c393b5294009c1e Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 22 Feb 2019 06:01:08 +0000 Subject: Support File#birthtime on Linux git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- file.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index ca61836784..e24cf68fc6 100644 --- a/file.c +++ b/file.c @@ -1208,6 +1208,8 @@ statx_birthtime(const struct statx *stx, VALUE fname) } typedef struct statx statx_data; +# define HAVE_STAT_BIRTHTIME + #elif defined(HAVE_STAT_BIRTHTIME) # define statx_without_gvl(path, st, mask) stat_without_gvl(path, st) # define fstatx_without_gvl(fd, st, mask) fstat_without_gvl(fd, st) @@ -2434,13 +2436,13 @@ static VALUE rb_file_birthtime(VALUE obj) { rb_io_t *fptr; - struct stat st; + statx_data st; GetOpenFile(obj, fptr); - if (fstat(fptr->fd, &st) == -1) { + if (fstatx_without_gvl(fptr->fd, &st, STATX_BTIME) == -1) { rb_sys_fail_path(fptr->pathv); } - return stat_birthtime(&st); + return statx_birthtime(&st, fptr->pathv); } #else # define rb_file_birthtime rb_f_notimplement -- cgit v1.2.3