mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
LibCore: Implement socket credentials for NetBSD
This commit is contained in:
parent
e54a03d497
commit
d710da108c
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue