mirror of https://github.com/red-prig/fpPS4.git
sceKernelChmod
This commit is contained in:
parent
7882b646ea
commit
361dbd2f58
|
@ -73,6 +73,9 @@ function ps4_sceKernelRmdir(path:PChar):Integer; SysV_ABI_CDecl;
|
|||
function ps4_rename(from,pto:PChar):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sceKernelRename(from,pto:PChar):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_chmod(path:PChar;mode:Integer):Integer; SysV_ABI_CDecl;
|
||||
function ps4_sceKernelChmod(path:PChar;mode:Integer):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_sceKernelCheckReachability(path:PChar):Integer; SysV_ABI_CDecl;
|
||||
|
||||
function ps4_access(path:PChar;mode:Integer):Integer; SysV_ABI_CDecl;
|
||||
|
@ -991,6 +994,58 @@ begin
|
|||
Result:=px2sce(Result);
|
||||
end;
|
||||
|
||||
function _sys_chmod(path:PChar;mode:Integer):Integer;
|
||||
var
|
||||
fn:RawByteString;
|
||||
begin
|
||||
Result:=0;
|
||||
|
||||
if (path=nil) then Exit(EINVAL);
|
||||
|
||||
if (path[0]=#0) then
|
||||
begin
|
||||
Exit(ENOENT);
|
||||
end;
|
||||
|
||||
Writeln(SysLogPrefix,'chmod:',path,' (',OctStr(mode,3),')');
|
||||
|
||||
fn:='';
|
||||
Result:=parse_filename(path,fn);
|
||||
|
||||
Case Result of
|
||||
PT_ROOT:Exit(EACCES); //TODO
|
||||
PT_FILE:;
|
||||
PT_DEV :Exit(EACCES);
|
||||
else
|
||||
Exit(EACCES);
|
||||
end;
|
||||
|
||||
if FileExists(fn) or DirectoryExists(fn) then
|
||||
begin
|
||||
Result:=0;
|
||||
end else
|
||||
begin
|
||||
Result:=ENOENT;
|
||||
end;
|
||||
end;
|
||||
|
||||
function ps4_chmod(path:PChar;mode:Integer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
_sig_lock;
|
||||
Result:=_set_errno(_sys_chmod(path,mode));
|
||||
_sig_unlock;
|
||||
end;
|
||||
|
||||
function ps4_sceKernelChmod(path:PChar;mode:Integer):Integer; SysV_ABI_CDecl;
|
||||
begin
|
||||
_sig_lock;
|
||||
Result:=_sys_chmod(path,mode);
|
||||
_sig_unlock;
|
||||
|
||||
_set_errno(Result);
|
||||
Result:=px2sce(Result);
|
||||
end;
|
||||
|
||||
function ps4_sceKernelCheckReachability(path:PChar):Integer; SysV_ABI_CDecl;
|
||||
var
|
||||
fn:RawByteString;
|
||||
|
|
|
@ -1536,6 +1536,9 @@ begin
|
|||
lib^.set_proc($34DD35A8B4618AA5,@ps4_rename);
|
||||
lib^.set_proc($E7635C614F7E944A,@ps4_sceKernelRename);
|
||||
|
||||
lib^.set_proc($CF476D9CFC5882D8,@ps4_chmod);
|
||||
lib^.set_proc($7E022C435D316150,@ps4_sceKernelChmod);
|
||||
|
||||
lib^.set_proc($B96C96DEFF7CB14E,@ps4_sceKernelCheckReachability);
|
||||
|
||||
lib^.set_proc($F2F13A67A5446329,@ps4_access);
|
||||
|
|
Loading…
Reference in New Issue