io/FileDescriptor: add OpenReadOnly() overload with directory fd
This commit is contained in:
parent
bc3415ce8b
commit
60a3aae35f
@ -122,6 +122,16 @@ FileDescriptor::OpenReadOnly(const char *pathname) noexcept
|
||||
return Open(pathname, O_RDONLY);
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
bool
|
||||
FileDescriptor::OpenReadOnly(FileDescriptor dir, const char *pathname) noexcept
|
||||
{
|
||||
return Open(dir, pathname, O_RDONLY);
|
||||
}
|
||||
|
||||
#endif // __linux__
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
bool
|
||||
|
@ -27,8 +27,7 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FILE_DESCRIPTOR_HXX
|
||||
#define FILE_DESCRIPTOR_HXX
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
@ -135,6 +134,11 @@ public:
|
||||
|
||||
bool OpenReadOnly(const char *pathname) noexcept;
|
||||
|
||||
#ifdef __linux__
|
||||
bool OpenReadOnly(FileDescriptor dir,
|
||||
const char *pathname) noexcept;
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
bool OpenNonBlocking(const char *pathname) noexcept;
|
||||
#endif
|
||||
@ -271,5 +275,3 @@ public:
|
||||
bool IsReadyForWriting() const noexcept;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user