mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
ircd::fs: Return zero rather than propagating exception from write_life getter.
This commit is contained in:
parent
53071b2029
commit
e670afbac8
2 changed files with 13 additions and 1 deletions
|
@ -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 &);
|
||||
}
|
||||
|
||||
|
|
12
ircd/fs.cc
12
ircd/fs.cc
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue