0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-02 10:08:56 +02:00

ircd::fs: Return zero rather than propagating exception from write_life getter.

This commit is contained in:
Jason Volk 2019-05-08 19:08:28 -07:00
parent 53071b2029
commit e670afbac8
2 changed files with 13 additions and 1 deletions

View file

@ -19,7 +19,7 @@ namespace ircd::fs
size_t block_size(const fd &);
ulong fstype(const fd &);
ulong device(const fd &);
uint64_t write_life(const fd &);
uint64_t write_life(const fd &) noexcept;
void write_life(const fd &, const uint64_t &);
}

View file

@ -1551,11 +1551,23 @@ ircd::fs::write_life(const fd &fd,
#if defined(HAVE_FCNTL_H) && defined(F_GET_FILE_RW_HINT)
uint64_t
ircd::fs::write_life(const fd &fd)
noexcept try
{
uint64_t ret;
syscall(::fcntl, int(fd), F_GET_FILE_RW_HINT, &ret);
return ret;
}
catch(const std::system_error &e)
{
log::derror
{
log, "fcntl(F_GET_FILE_RW_HINT) fd:%d :%s",
int(fd),
e.what()
};
return 0;
}
#else
#warning "F_GET_FILE_RW_HINT not supported on platform."
uint64_t