mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 05:25:09 +00:00
Kernel: Added the ability to set the hostname via new syscall
Userland/hostname: Now takes parameter to set the hostname LibC/unistd: Added sethostname function
This commit is contained in:
parent
03f68a51af
commit
f191b84b50
7 changed files with 40 additions and 9 deletions
|
@ -712,6 +712,18 @@ int Process::sys$gethostname(char* buffer, ssize_t size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Process::sys$sethostname(const char* hostname, ssize_t length)
|
||||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
if (length < 0)
|
||||
return -EINVAL;
|
||||
LOCKER(*s_hostname_lock, Lock::Mode::Shared);
|
||||
if (length > 64)
|
||||
return -ENAMETOOLONG;
|
||||
*s_hostname = validate_and_copy_string_from_user(hostname, length);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pid_t Process::sys$fork(RegisterState& regs)
|
||||
{
|
||||
REQUIRE_PROMISE(proc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue