1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +00:00

LibCore: Add syscall wrapper for clock_settime()

This commit is contained in:
Kenneth Myhra 2021-11-27 22:01:40 +01:00 committed by Brian Gianforcaro
parent 5c15b97ca4
commit 7b13f22f96
2 changed files with 14 additions and 0 deletions

View file

@ -360,4 +360,16 @@ ErrorOr<struct group> getgrnam(StringView name)
return Error::from_string_literal("getgrnam: Unknown username"sv);
}
ErrorOr<void> clock_settime(clockid_t clock_id, struct timespec* ts)
{
#ifdef __serenity__
int rc = syscall(SC_clock_settime, clock_id, ts);
HANDLE_SYSCALL_RETURN_VALUE("clocksettime"sv, rc, {});
#else
if (::clock_settime(clock_id, ts) < 0)
return Error::from_syscall("clocksettime"sv, -errno);
return {};
#endif
}
}