mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
LibCore: Implement socket credentials for Solaris
This commit is contained in:
parent
9139515aed
commit
cdd1c8d0d9
2 changed files with 7 additions and 0 deletions
|
@ -370,6 +370,9 @@ ErrorOr<pid_t> LocalSocket::peer_pid() const
|
|||
#elif defined(AK_OS_NETBSD)
|
||||
struct sockcred creds = {};
|
||||
socklen_t creds_size = sizeof(creds);
|
||||
#elif defined(AK_OS_SOLARIS)
|
||||
ucred_t* creds = NULL;
|
||||
socklen_t creds_size = sizeof(creds);
|
||||
#else
|
||||
struct ucred creds = {};
|
||||
socklen_t creds_size = sizeof(creds);
|
||||
|
@ -384,6 +387,9 @@ ErrorOr<pid_t> LocalSocket::peer_pid() const
|
|||
#elif defined(AK_OS_NETBSD)
|
||||
TRY(System::getsockopt(m_helper.fd(), SOL_SOCKET, SCM_CREDS, &creds, &creds_size));
|
||||
return creds.sc_pid;
|
||||
#elif defined(AK_OS_SOLARIS)
|
||||
TRY(System::getsockopt(m_helper.fd(), SOL_SOCKET, SO_RECVUCRED, &creds, &creds_size));
|
||||
return ucred_getpid(creds);
|
||||
#else
|
||||
TRY(System::getsockopt(m_helper.fd(), SOL_SOCKET, SO_PEERCRED, &creds, &creds_size));
|
||||
return creds.pid;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#ifdef AK_OS_SOLARIS
|
||||
# include <sys/filio.h>
|
||||
# include <ucred.h>
|
||||
#endif
|
||||
|
||||
namespace Core::System {
|
||||
|
|
Loading…
Add table
Reference in a new issue