mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +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
Notes:
sideshowbarker
2024-07-19 07:17:18 +09:00
Author: https://github.com/lukepayne 🔰
Commit: f191b84b50
Pull-request: https://github.com/SerenityOS/serenity/pull/1963
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/bugaevc
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