mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-15 02:40:38 +00:00
UserspaceEmulator: Implement set_process_name syscall
This commit is contained in:
parent
ec8e3edd05
commit
d5925f33aa
Notes:
sideshowbarker
2024-07-18 21:32:27 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/d5925f33aaa Pull-request: https://github.com/SerenityOS/serenity/pull/5719
2 changed files with 12 additions and 0 deletions
|
@ -125,6 +125,7 @@ private:
|
|||
int virt$mkdir(FlatPtr path, size_t path_length, mode_t mode);
|
||||
int virt$unlink(FlatPtr path, size_t path_length);
|
||||
int virt$get_process_name(FlatPtr buffer, int size);
|
||||
int virt$set_process_name(FlatPtr buffer, int size);
|
||||
int virt$set_mmap_name(FlatPtr);
|
||||
int virt$gettimeofday(FlatPtr);
|
||||
int virt$clock_gettime(int, FlatPtr);
|
||||
|
|
|
@ -168,6 +168,8 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
|
|||
return virt$getsockopt(arg1);
|
||||
case SC_get_process_name:
|
||||
return virt$get_process_name(arg1, arg2);
|
||||
case SC_set_process_name:
|
||||
return virt$set_process_name(arg1, arg2);
|
||||
case SC_dbgputstr:
|
||||
return virt$dbgputstr(arg1, arg2);
|
||||
case SC_dbgputch:
|
||||
|
@ -481,6 +483,15 @@ int Emulator::virt$get_process_name(FlatPtr buffer, int size)
|
|||
return rc;
|
||||
}
|
||||
|
||||
int Emulator::virt$set_process_name(FlatPtr user_buffer, int size)
|
||||
{
|
||||
if (size < 0)
|
||||
return -EINVAL;
|
||||
auto host_buffer = mmu().copy_buffer_from_vm(user_buffer, size);
|
||||
auto name = String::formatted("(UE) {}", StringView { host_buffer.data(), host_buffer.size() });
|
||||
return syscall(SC_set_process_name, name.characters(), name.length());
|
||||
}
|
||||
|
||||
int Emulator::virt$lseek(int fd, off_t offset, int whence)
|
||||
{
|
||||
return syscall(SC_lseek, fd, offset, whence);
|
||||
|
|
Loading…
Reference in a new issue