mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 14:01:25 +12:00
Implement fs::unshare (linux)
This commit is contained in:
parent
3628a8593f
commit
6a5ce475b8
1 changed files with 8 additions and 0 deletions
|
@ -108,6 +108,7 @@ static fs::error to_error(DWORD e)
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
|
#include <sys/file.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
|
@ -939,6 +940,13 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (test(mode & fs::unshare) && ::flock(fd, LOCK_EX | LOCK_NB) != 0)
|
||||||
|
{
|
||||||
|
g_tls_error = errno == EWOULDBLOCK ? fs::error::acces : to_error(errno);
|
||||||
|
::close(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
class unix_file final : public file_base, public get_native_handle
|
class unix_file final : public file_base, public get_native_handle
|
||||||
{
|
{
|
||||||
const int m_fd;
|
const int m_fd;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue