mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
LibCore: Add an ErrorOr wrapper for uname
This commit is contained in:
parent
35cd7c9a91
commit
91f5fc796b
Notes:
sideshowbarker
2024-07-17 21:43:57 +09:00
Author: https://github.com/mjz19910
Commit: 91f5fc796b
Pull-request: https://github.com/SerenityOS/serenity/pull/11607
Reviewed-by: https://github.com/bgianfo
2 changed files with 15 additions and 0 deletions
|
@ -648,6 +648,19 @@ ErrorOr<void> utime(StringView path, Optional<struct utimbuf> maybe_buf)
|
|||
#endif
|
||||
}
|
||||
|
||||
ErrorOr<struct utsname> uname()
|
||||
{
|
||||
utsname uts;
|
||||
#ifdef __serenity__
|
||||
int rc = syscall(SC_uname, &uts);
|
||||
HANDLE_SYSCALL_RETURN_VALUE("uname"sv, rc, uts);
|
||||
#else
|
||||
if (::uname(&uts) < 0)
|
||||
return Error::from_syscall("uname"sv, -errno);
|
||||
#endif
|
||||
return uts;
|
||||
}
|
||||
|
||||
ErrorOr<int> socket(int domain, int type, int protocol)
|
||||
{
|
||||
auto fd = ::socket(domain, type, protocol);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue