system/FileDescriptor: add openat() wrapper
This commit is contained in:
parent
9151b84c25
commit
d036e20826
@ -76,6 +76,18 @@ FileDescriptor::IsSocket() const noexcept
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __linux
|
||||
|
||||
bool
|
||||
FileDescriptor::Open(FileDescriptor dir, const char *pathname,
|
||||
int flags, mode_t mode) noexcept
|
||||
{
|
||||
fd = ::openat(dir.Get(), pathname, flags | O_NOCTTY | O_CLOEXEC, mode);
|
||||
return IsDefined();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool
|
||||
FileDescriptor::Open(const char *pathname, int flags, mode_t mode) noexcept
|
||||
{
|
||||
|
@ -116,6 +116,11 @@ public:
|
||||
return FileDescriptor(-1);
|
||||
}
|
||||
|
||||
#ifdef __linux
|
||||
bool Open(FileDescriptor dir, const char *pathname,
|
||||
int flags, mode_t mode=0666) noexcept;
|
||||
#endif
|
||||
|
||||
bool Open(const char *pathname, int flags, mode_t mode=0666) noexcept;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
Loading…
Reference in New Issue
Block a user