diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 32884186d9..b89e34c48b 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -747,6 +747,14 @@ ErrorOr setsid() return rc; } +ErrorOr getsid(pid_t pid) +{ + int rc = ::getsid(pid); + if (rc < 0) + return Error::from_syscall("getsid"sv, -errno); + return rc; +} + ErrorOr drop_privileges() { auto gid_result = setgid(getgid()); diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index aa578ac62b..fd9a4d7603 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -141,6 +141,7 @@ ErrorOr setgid(gid_t); ErrorOr setegid(gid_t); ErrorOr setpgid(pid_t pid, pid_t pgid); ErrorOr setsid(); +ErrorOr getsid(pid_t pid = 0); ErrorOr drop_privileges(); ErrorOr isatty(int fd); ErrorOr link(StringView old_path, StringView new_path);