Changeset View
Changeset View
Standalone View
Standalone View
files/patch-base_posix_unix__domain__socket__linux.cc
--- base/posix/unix_domain_socket_linux.cc.orig 2016-03-25 13:04:44 UTC | --- base/posix/unix_domain_socket_linux.cc.orig 2016-08-03 22:02:10.000000000 +0300 | ||||
+++ base/posix/unix_domain_socket_linux.cc | +++ base/posix/unix_domain_socket_linux.cc 2016-09-06 23:39:53.563078000 +0300 | ||||
@@ -23,6 +23,15 @@ | @@ -23,6 +23,15 @@ | ||||
namespace base { | namespace base { | ||||
+#if defined(__FreeBSD__) | +#if defined(OS_BSD) | ||||
+// Port over Linux ucred structure | +// Port over Linux ucred structure | ||||
+struct ucred { | +struct ucred { | ||||
+ pid_t pid; // process ID of the sending process | + pid_t pid; // process ID of the sending process | ||||
+ uid_t uid; // user ID of the sending process | + uid_t uid; // user ID of the sending process | ||||
+ gid_t gid; // group ID of the sending process | + gid_t gid; // group ID of the sending process | ||||
+}; | +}; | ||||
+#endif | +#endif | ||||
+ | + | ||||
const size_t UnixDomainSocket::kMaxFileDescriptors = 16; | const size_t UnixDomainSocket::kMaxFileDescriptors = 16; | ||||
#if !defined(OS_NACL_NONSFI) | #if !defined(OS_NACL_NONSFI) | ||||
@@ -41,7 +50,13 @@ static bool CreateSocketPair(ScopedFD* o | @@ -40,8 +49,14 @@ | ||||
// static | // static | ||||
bool UnixDomainSocket::EnableReceiveProcessId(int fd) { | bool UnixDomainSocket::EnableReceiveProcessId(int fd) { | ||||
const int enable = 1; | +#if defined(OS_BSD) | ||||
+#if defined(__FreeBSD__) | |||||
+ // XXX(rene) do this? : | + // XXX(rene) do this? : | ||||
+ // taken from dbus, Academic Free License 2.1 / GPL 2+ | + // taken from dbus, Academic Free License 2.1 / GPL 2+ | ||||
+ return 0; // fake OK | + return 0; // fake OK | ||||
+#else | +#else | ||||
const int enable = 1; | |||||
return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0; | return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0; | ||||
+#endif | +#endif | ||||
} | } | ||||
#endif // !defined(OS_NACL_NONSFI) | #endif // !defined(OS_NACL_NONSFI) | ||||
@@ -147,7 +162,11 @@ ssize_t UnixDomainSocket::RecvMsgWithFla | @@ -147,7 +162,11 @@ | ||||
// The PNaCl toolchain for Non-SFI binary build does not support | // The PNaCl toolchain for Non-SFI binary build does not support | ||||
// SCM_CREDENTIALS. | // SCM_CREDENTIALS. | ||||
if (cmsg->cmsg_level == SOL_SOCKET && | if (cmsg->cmsg_level == SOL_SOCKET && | ||||
+#if defined(__FreeBSD__) | +#if defined(OS_BSD) | ||||
+ 1) { // XXX(rene) carpet getting full ... | + 1) { // XXX(rene) carpet getting full ... | ||||
+#else | +#else | ||||
cmsg->cmsg_type == SCM_CREDENTIALS) { | cmsg->cmsg_type == SCM_CREDENTIALS) { | ||||
+#endif | +#endif | ||||
DCHECK_EQ(payload_len, sizeof(struct ucred)); | DCHECK_EQ(payload_len, sizeof(struct ucred)); | ||||
DCHECK_EQ(pid, -1); | DCHECK_EQ(pid, -1); | ||||
pid = reinterpret_cast<struct ucred*>(CMSG_DATA(cmsg))->pid; | pid = reinterpret_cast<struct ucred*>(CMSG_DATA(cmsg))->pid; |