mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +00: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)
|
#elif defined(AK_OS_NETBSD)
|
||||||
struct sockcred creds = {};
|
struct sockcred creds = {};
|
||||||
socklen_t creds_size = sizeof(creds);
|
socklen_t creds_size = sizeof(creds);
|
||||||
|
#elif defined(AK_OS_SOLARIS)
|
||||||
|
ucred_t* creds = NULL;
|
||||||
|
socklen_t creds_size = sizeof(creds);
|
||||||
#else
|
#else
|
||||||
struct ucred creds = {};
|
struct ucred creds = {};
|
||||||
socklen_t creds_size = sizeof(creds);
|
socklen_t creds_size = sizeof(creds);
|
||||||
|
@ -384,6 +387,9 @@ ErrorOr<pid_t> LocalSocket::peer_pid() const
|
||||||
#elif defined(AK_OS_NETBSD)
|
#elif defined(AK_OS_NETBSD)
|
||||||
TRY(System::getsockopt(m_helper.fd(), SOL_SOCKET, SCM_CREDS, &creds, &creds_size));
|
TRY(System::getsockopt(m_helper.fd(), SOL_SOCKET, SCM_CREDS, &creds, &creds_size));
|
||||||
return creds.sc_pid;
|
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
|
#else
|
||||||
TRY(System::getsockopt(m_helper.fd(), SOL_SOCKET, SO_PEERCRED, &creds, &creds_size));
|
TRY(System::getsockopt(m_helper.fd(), SOL_SOCKET, SO_PEERCRED, &creds, &creds_size));
|
||||||
return creds.pid;
|
return creds.pid;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#ifdef AK_OS_SOLARIS
|
#ifdef AK_OS_SOLARIS
|
||||||
# include <sys/filio.h>
|
# include <sys/filio.h>
|
||||||
|
# include <ucred.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Core::System {
|
namespace Core::System {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue