OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ipc/ipc_channel_posix.h" | 5 #include "ipc/ipc_channel_posix.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 Close(); | 766 Close(); |
767 if (AcceptsConnections()) { | 767 if (AcceptsConnections()) { |
768 listener()->OnChannelListenError(); | 768 listener()->OnChannelListenError(); |
769 } else { | 769 } else { |
770 listener()->OnChannelError(); | 770 listener()->OnChannelError(); |
771 } | 771 } |
772 } | 772 } |
773 } | 773 } |
774 | 774 |
775 int ChannelPosix::GetHelloMessageProcId() const { | 775 int ChannelPosix::GetHelloMessageProcId() const { |
| 776 #if defined(OS_NACL_NONSFI) |
| 777 // In nacl_helper_nonsfi, getpid() invoked by GetCurrentProcId() is not |
| 778 // allowed and would cause a SIGSYS crash because of the seccomp sandbox. |
| 779 return -1; |
| 780 #else |
776 int pid = base::GetCurrentProcId(); | 781 int pid = base::GetCurrentProcId(); |
777 #if defined(OS_LINUX) | 782 #if defined(OS_LINUX) |
778 // Our process may be in a sandbox with a separate PID namespace. | 783 // Our process may be in a sandbox with a separate PID namespace. |
779 if (global_pid_) { | 784 if (global_pid_) { |
780 pid = global_pid_; | 785 pid = global_pid_; |
781 } | 786 } |
782 #endif | 787 #endif // defined(OS_LINUX) |
783 return pid; | 788 return pid; |
| 789 #endif // defined(OS_NACL_NONSFI) |
784 } | 790 } |
785 | 791 |
786 void ChannelPosix::QueueHelloMessage() { | 792 void ChannelPosix::QueueHelloMessage() { |
787 // Create the Hello message | 793 // Create the Hello message |
788 scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE, | 794 scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE, |
789 HELLO_MESSAGE_TYPE, | 795 HELLO_MESSAGE_TYPE, |
790 IPC::Message::PRIORITY_NORMAL)); | 796 IPC::Message::PRIORITY_NORMAL)); |
791 if (!msg->WriteInt(GetHelloMessageProcId())) { | 797 if (!msg->WriteInt(GetHelloMessageProcId())) { |
792 NOTREACHED() << "Unable to pickle hello message proc id"; | 798 NOTREACHED() << "Unable to pickle hello message proc id"; |
793 } | 799 } |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 } | 1135 } |
1130 | 1136 |
1131 #if defined(OS_LINUX) | 1137 #if defined(OS_LINUX) |
1132 // static | 1138 // static |
1133 void Channel::SetGlobalPid(int pid) { | 1139 void Channel::SetGlobalPid(int pid) { |
1134 ChannelPosix::SetGlobalPid(pid); | 1140 ChannelPosix::SetGlobalPid(pid); |
1135 } | 1141 } |
1136 #endif // OS_LINUX | 1142 #endif // OS_LINUX |
1137 | 1143 |
1138 } // namespace IPC | 1144 } // namespace IPC |
OLD | NEW |