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);
|
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
|
#ifndef _WIN32
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -27,8 +27,7 @@
|
|||||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FILE_DESCRIPTOR_HXX
|
#pragma once
|
||||||
#define FILE_DESCRIPTOR_HXX
|
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@ -135,6 +134,11 @@ public:
|
|||||||
|
|
||||||
bool OpenReadOnly(const char *pathname) noexcept;
|
bool OpenReadOnly(const char *pathname) noexcept;
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
bool OpenReadOnly(FileDescriptor dir,
|
||||||
|
const char *pathname) noexcept;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
bool OpenNonBlocking(const char *pathname) noexcept;
|
bool OpenNonBlocking(const char *pathname) noexcept;
|
||||||
#endif
|
#endif
|
||||||
@ -271,5 +275,3 @@ public:
|
|||||||
bool IsReadyForWriting() const noexcept;
|
bool IsReadyForWriting() const noexcept;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user