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

LibCore: Add Core::System wrapper for getsid()

This commit is contained in:
Peter Elliott 2022-09-05 22:12:58 -06:00 committed by Andreas Kling
parent 9c32b9ea3c
commit 71728f3ea6
2 changed files with 9 additions and 0 deletions

View file

@ -747,6 +747,14 @@ ErrorOr<pid_t> setsid()
return rc;
}
ErrorOr<pid_t> getsid(pid_t pid)
{
int rc = ::getsid(pid);
if (rc < 0)
return Error::from_syscall("getsid"sv, -errno);
return rc;
}
ErrorOr<void> drop_privileges()
{
auto gid_result = setgid(getgid());