mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
[orbis-kernel] Hack sys_fstat
This commit is contained in:
parent
f9e8cc60de
commit
e5aa5a96e8
1 changed files with 37 additions and 2 deletions
|
|
@ -27,8 +27,43 @@ orbis::SysResult orbis::sys_closefrom(Thread *thread, sint lowfd) {
|
||||||
return ErrorCode::NOSYS;
|
return ErrorCode::NOSYS;
|
||||||
}
|
}
|
||||||
orbis::SysResult orbis::sys_fstat(Thread *thread, sint fd, ptr<Stat> ub) {
|
orbis::SysResult orbis::sys_fstat(Thread *thread, sint fd, ptr<Stat> ub) {
|
||||||
ORBIS_LOG_TODO(__FUNCTION__, fd, ub);
|
ORBIS_LOG_WARNING(__FUNCTION__, fd, ub);
|
||||||
return ErrorCode::NOSYS;
|
thread->where();
|
||||||
|
if (fd == 0) {
|
||||||
|
return ErrorCode::PERM;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto result = sys_lseek(thread, fd, 0, SEEK_CUR);
|
||||||
|
auto oldpos = thread->retval[0];
|
||||||
|
if (result.isError()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = sys_lseek(thread, fd, 0, SEEK_END);
|
||||||
|
auto len = thread->retval[0];
|
||||||
|
if (result.isError()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = sys_read(thread, fd, ub, 1);
|
||||||
|
if (result.isError()) {
|
||||||
|
*ub = {};
|
||||||
|
ub->mode = 0777 | 0x4000;
|
||||||
|
} else {
|
||||||
|
*ub = {};
|
||||||
|
ub->size = len;
|
||||||
|
ub->blksize = 1;
|
||||||
|
ub->blocks = len;
|
||||||
|
ub->mode = 0777 | 0x8000;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = sys_lseek(thread, fd, oldpos, SEEK_SET);
|
||||||
|
if (result.isError()) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
thread->retval[0] = 0;
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
orbis::SysResult orbis::sys_nfstat(Thread *thread, sint fd,
|
orbis::SysResult orbis::sys_nfstat(Thread *thread, sint fd,
|
||||||
ptr<struct nstat> sb) {
|
ptr<struct nstat> sb) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue