openbsd-ports/www/chromium/patches/patch-ipc_ipc_channel_posix_cc
espie 5cb978edde cut the "monster patches" into small pieces. pval can fix it to his liking
if he comes back.
In the mean time, fix build of chromium by adding the required
-I/usr/local/includes to gyp glue where needed.
2010-12-13 09:51:45 +00:00

93 lines
3.5 KiB
Plaintext

$OpenBSD: patch-ipc_ipc_channel_posix_cc,v 1.1 2010/12/13 09:51:46 espie Exp $
--- ipc/ipc_channel_posix.cc.orig Tue Mar 30 07:28:46 2010
+++ ipc/ipc_channel_posix.cc Sun Nov 28 00:11:30 2010
@@ -11,6 +11,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
+#include <sys/uio.h>
#include <string>
#include <map>
@@ -273,7 +274,7 @@ Channel::ChannelImpl::ChannelImpl(const std::string& c
server_listen_pipe_(-1),
pipe_(-1),
client_pipe_(-1),
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
fd_pipe_(-1),
remote_fd_pipe_(-1),
#endif
@@ -384,7 +385,7 @@ bool Channel::ChannelImpl::CreatePipe(const std::strin
scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE,
HELLO_MESSAGE_TYPE,
IPC::Message::PRIORITY_NORMAL));
- #if defined(OS_LINUX)
+ #if defined(OS_NIX)
if (!uses_fifo_) {
// On Linux, the seccomp sandbox makes it very expensive to call
// recvmsg() and sendmsg(). Often, we are perfectly OK with resorting to
@@ -460,7 +461,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
// Read from pipe.
// recvmsg() returns 0 if the connection has closed or EAGAIN if no data
// is waiting on the pipe.
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
if (fd_pipe_ >= 0) {
bytes_read = HANDLE_EINTR(read(pipe_, input_buf_,
Channel::kReadBufferSize));
@@ -592,7 +593,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
if (m.header()->num_fds > num_fds - fds_i) {
// the message has been completely received, but we didn't get
// enough file descriptors.
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
if (!uses_fifo_) {
char dummy;
struct iovec fd_pipe_iov = { &dummy, 1 };
@@ -677,7 +678,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
if (!m.ReadInt(&iter, &pid)) {
NOTREACHED();
}
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
if (mode_ == MODE_SERVER && !uses_fifo_) {
// On Linux, the Hello message from the client to the server
// also contains the fd_pipe_, which will be used for all
@@ -740,7 +741,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
while (!output_queue_.empty()) {
Message* msg = output_queue_.front();
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
scoped_ptr<Message> hello;
if (remote_fd_pipe_ != -1 &&
msg->routing_id() == MSG_ROUTING_NONE &&
@@ -801,7 +802,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
// num_fds < MAX_DESCRIPTORS_PER_MESSAGE so no danger of overflow.
msg->header()->num_fds = static_cast<uint16>(num_fds);
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
if (!uses_fifo_ &&
(msg->routing_id() != MSG_ROUTING_NONE ||
msg->type() != HELLO_MESSAGE_TYPE)) {
@@ -823,7 +824,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
if (bytes_written == 1) {
fd_written = pipe_;
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
if (mode_ != MODE_SERVER && !uses_fifo_ &&
msg->routing_id() == MSG_ROUTING_NONE &&
msg->type() == HELLO_MESSAGE_TYPE) {
@@ -994,7 +995,7 @@ void Channel::ChannelImpl::Close() {
Singleton<PipeMap>()->RemoveAndClose(pipe_name_);
client_pipe_ = -1;
}
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
if (fd_pipe_ != -1) {
HANDLE_EINTR(close(fd_pipe_));
fd_pipe_ = -1;