1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

Kernel: Remove various other uses of ssize_t

This commit is contained in:
Gunnar Beutner 2021-06-16 16:44:15 +02:00 committed by Andreas Kling
parent ca3cae81eb
commit bc3076f894
33 changed files with 123 additions and 129 deletions

View file

@ -11,10 +11,10 @@ namespace Kernel {
extern String* g_hostname;
extern Lock* g_hostname_lock;
KResultOr<int> Process::sys$gethostname(Userspace<char*> buffer, ssize_t size)
KResultOr<int> Process::sys$gethostname(Userspace<char*> buffer, size_t size)
{
REQUIRE_PROMISE(stdio);
if (size < 0)
if (size > NumericLimits<ssize_t>::max())
return EINVAL;
Locker locker(*g_hostname_lock, Lock::Mode::Shared);
if ((size_t)size < (g_hostname->length() + 1))
@ -24,13 +24,11 @@ KResultOr<int> Process::sys$gethostname(Userspace<char*> buffer, ssize_t size)
return 0;
}
KResultOr<int> Process::sys$sethostname(Userspace<const char*> hostname, ssize_t length)
KResultOr<int> Process::sys$sethostname(Userspace<const char*> hostname, size_t length)
{
REQUIRE_NO_PROMISES;
if (!is_superuser())
return EPERM;
if (length < 0)
return EINVAL;
Locker locker(*g_hostname_lock, Lock::Mode::Exclusive);
if (length > 64)
return ENAMETOOLONG;