mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 17:45:09 +00:00
Kernel+LibC: Add get_process_name() syscall
It does exactly what it sounds like: int get_process_name(char* buffer, int buffer_size);
This commit is contained in:
parent
d64e698bf1
commit
6ad3efe067
6 changed files with 29 additions and 1 deletions
|
@ -2859,3 +2859,19 @@ int Process::sys$set_process_icon(int icon_id)
|
|||
m_icon_id = icon_id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$get_process_name(char* buffer, int buffer_size)
|
||||
{
|
||||
if (buffer_size <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (!validate_write(buffer, buffer_size))
|
||||
return -EFAULT;
|
||||
|
||||
if (m_name.length() >= buffer_size)
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
strncpy(buffer, m_name.characters(), buffer_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue