diff --git a/include/ircd/fs/fd.h b/include/ircd/fs/fd.h index 07d33bfa0..b5ca78a4c 100644 --- a/include/ircd/fs/fd.h +++ b/include/ircd/fs/fd.h @@ -34,6 +34,8 @@ struct ircd::fs::fd operator bool() const; bool operator!() const; + int release() noexcept; + explicit fd(const int &); fd(const string_view &path, const opts &); fd(const string_view &path); diff --git a/ircd/fs.cc b/ircd/fs.cc index 1ae0a6a36..331e41b24 100644 --- a/ircd/fs.cc +++ b/ircd/fs.cc @@ -1621,6 +1621,15 @@ noexcept(false) syscall(::close, fdno); } +int +ircd::fs::fd::release() +noexcept +{ + const int fdno(this->fdno); + this->fdno = -1; + return fdno; +} + /////////////////////////////////////////////////////////////////////////////// // // fs/device.h