file.c: raise NotImplementedError instread of Errno::ENOSYS
[Misc #15615] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
56557ec28a
commit
0bd50e95f9
12
file.c
12
file.c
@ -1198,12 +1198,22 @@ rb_statx(VALUE file, struct statx *stx, unsigned int mask)
|
|||||||
|
|
||||||
# define statx_has_birthtime(st) ((st)->stx_mask & STATX_BTIME)
|
# define statx_has_birthtime(st) ((st)->stx_mask & STATX_BTIME)
|
||||||
|
|
||||||
|
/* rb_notimplement() shows "function is unimplemented on this machine".
|
||||||
|
It is not applicable to statx which behavior depends on the filesystem. */
|
||||||
|
static void
|
||||||
|
statx_notimplement(const char *field_name)
|
||||||
|
{
|
||||||
|
rb_raise(rb_eNotImpError,
|
||||||
|
"%s is unimplemented on this filesystem",
|
||||||
|
field_name);
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
statx_birthtime(const struct statx *stx, VALUE fname)
|
statx_birthtime(const struct statx *stx, VALUE fname)
|
||||||
{
|
{
|
||||||
if (!statx_has_birthtime(stx)) {
|
if (!statx_has_birthtime(stx)) {
|
||||||
/* birthtime is not supported on the filesystem */
|
/* birthtime is not supported on the filesystem */
|
||||||
rb_syserr_fail_path(ENOSYS, fname);
|
statx_notimplement("birthtime");
|
||||||
}
|
}
|
||||||
return rb_time_nano_new(stx->stx_btime.tv_sec, stx->stx_btime.tv_nsec);
|
return rb_time_nano_new(stx->stx_btime.tv_sec, stx->stx_btime.tv_nsec);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user