mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07:35 +00:00
LibCore: Add wrapper for posix_openpt(), grantpt() and unlockpt()
This commit is contained in:
parent
ddf9987c39
commit
5d29f64c99
2 changed files with 27 additions and 0 deletions
|
@ -1084,4 +1084,28 @@ ErrorOr<void> setenv(StringView name, StringView value, bool overwrite)
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<int> posix_openpt(int flags)
|
||||
{
|
||||
int const rc = ::posix_openpt(flags);
|
||||
if (rc < 0)
|
||||
return Error::from_syscall("posix_openpt", -errno);
|
||||
return rc;
|
||||
}
|
||||
|
||||
ErrorOr<void> grantpt(int fildes)
|
||||
{
|
||||
auto const rc = ::grantpt(fildes);
|
||||
if (rc < 0)
|
||||
return Error::from_syscall("grantpt", -errno);
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> unlockpt(int fildes)
|
||||
{
|
||||
auto const rc = ::unlockpt(fildes);
|
||||
if (rc < 0)
|
||||
return Error::from_syscall("unlockpt", -errno);
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue