diff options
author | nipos <ni.pos@yandex.com> | 2023-02-20 15:33:46 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-02-20 18:42:29 +0100 |
commit | d710da108ca71db7209db6318be04c25132cf32d (patch) | |
tree | 6f789def4ab43542b9fc802c069d2b0ae4bdbbdb | |
parent | e54a03d49744c3ef9c2fce3df2f4cae047e960fb (diff) | |
download | serenity-d710da108ca71db7209db6318be04c25132cf32d.zip |
LibCore: Implement socket credentials for NetBSD
-rw-r--r-- | Userland/Libraries/LibCore/Socket.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCore/Socket.cpp b/Userland/Libraries/LibCore/Socket.cpp index 4e3808c191..d32577f9ee 100644 --- a/Userland/Libraries/LibCore/Socket.cpp +++ b/Userland/Libraries/LibCore/Socket.cpp @@ -367,6 +367,9 @@ ErrorOr<pid_t> LocalSocket::peer_pid() const #elif defined(AK_OS_OPENBSD) struct sockpeercred creds = {}; socklen_t creds_size = sizeof(creds); +#elif defined(AK_OS_NETBSD) + struct sockcred creds = {}; + socklen_t creds_size = sizeof(creds); #else struct ucred creds = {}; socklen_t creds_size = sizeof(creds); @@ -378,6 +381,9 @@ ErrorOr<pid_t> LocalSocket::peer_pid() const #elif defined(AK_OS_FREEBSD) TRY(System::getsockopt(m_helper.fd(), SOL_LOCAL, LOCAL_PEERCRED, &creds, &creds_size)); return creds.cr_pid; +#elif defined(AK_OS_NETBSD) + TRY(System::getsockopt(m_helper.fd(), SOL_SOCKET, SCM_CREDS, &creds, &creds_size)); + return creds.sc_pid; #else TRY(System::getsockopt(m_helper.fd(), SOL_SOCKET, SO_PEERCRED, &creds, &creds_size)); return creds.pid; |