mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
Kernel+LibC+LibCore+UE: Implement fchmodat(2)
This function is an extended version of `chmod(2)` that lets one control whether to dereference symlinks, and specify a file descriptor to a directory that will be used as the base for relative paths.
This commit is contained in:
parent
5f71925aa4
commit
182016d7c0
10 changed files with 64 additions and 14 deletions
|
@ -52,7 +52,7 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
|
|||
case SC_chdir:
|
||||
return virt$chdir(arg1, arg2);
|
||||
case SC_chmod:
|
||||
return virt$chmod(arg1, arg2, arg3);
|
||||
return virt$chmod(arg1);
|
||||
case SC_chown:
|
||||
return virt$chown(arg1);
|
||||
case SC_clock_gettime:
|
||||
|
@ -418,10 +418,15 @@ int Emulator::virt$dbgputstr(FlatPtr characters, int length)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Emulator::virt$chmod(FlatPtr path_addr, size_t path_length, mode_t mode)
|
||||
int Emulator::virt$chmod(FlatPtr params_addr)
|
||||
{
|
||||
auto path = mmu().copy_buffer_from_vm(path_addr, path_length);
|
||||
return syscall(SC_chmod, path.data(), path.size(), mode);
|
||||
Syscall::SC_chmod_params params;
|
||||
mmu().copy_from_vm(¶ms, params_addr, sizeof(params));
|
||||
|
||||
auto path = mmu().copy_buffer_from_vm((FlatPtr)params.path.characters, params.path.length);
|
||||
params.path.characters = (char const*)path.data();
|
||||
params.path.length = path.size();
|
||||
return syscall(SC_chmod, ¶ms);
|
||||
}
|
||||
|
||||
int Emulator::virt$chown(FlatPtr params_addr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue