rpcsx/orbis-kernel/src/sys/sys_vfs_cache.cpp

24 lines
513 B
C++
Raw Normal View History

2023-07-03 13:10:16 +02:00
#include "sys/sysproto.hpp"
#include "thread/Thread.hpp"
#include "thread/Process.hpp"
#include <mutex>
#include <string>
2023-07-03 13:10:16 +02:00
2023-07-06 18:16:25 +02:00
orbis::SysResult orbis::sys___getcwd(Thread *thread, ptr<char> buf,
uint buflen) {
std::string cwd;
{
std::lock_guard lock(thread->tproc->mtx);
cwd = std::string(thread->tproc->cwd);
}
if (buflen < cwd.size() + 1) {
return ErrorCode::NOMEM;
}
ORBIS_RET_ON_ERROR(uwriteRaw(buf, cwd.data(), cwd.size() + 1));
return{};
2023-07-06 18:16:25 +02:00
}