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> |
11 #include <sys/stat.h> | 11 #include <sys/stat.h> |
12 #include <sys/types.h> | 12 #include <sys/types.h> |
13 #include <sys/un.h> | |
14 #include <unistd.h> | 13 #include <unistd.h> |
15 | 14 |
16 #if defined(OS_OPENBSD) | 15 #if defined(OS_OPENBSD) |
17 #include <sys/uio.h> | 16 #include <sys/uio.h> |
18 #endif | 17 #endif |
19 | 18 |
| 19 #if !defined(__native_client_nonsfi__) |
| 20 #include <sys/un.h> |
| 21 #endif |
| 22 |
20 #include <map> | 23 #include <map> |
21 #include <string> | 24 #include <string> |
22 | 25 |
23 #include "base/command_line.h" | 26 #include "base/command_line.h" |
24 #include "base/files/file_path.h" | 27 #include "base/files/file_path.h" |
25 #include "base/files/file_util.h" | 28 #include "base/files/file_util.h" |
26 #include "base/location.h" | 29 #include "base/location.h" |
27 #include "base/logging.h" | 30 #include "base/logging.h" |
28 #include "base/memory/scoped_ptr.h" | 31 #include "base/memory/scoped_ptr.h" |
29 #include "base/memory/singleton.h" | 32 #include "base/memory/singleton.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 #if defined(OS_ANDROID) | 169 #if defined(OS_ANDROID) |
167 // When we fork for simple tests on Android, we can't 'exec', so we need to | 170 // When we fork for simple tests on Android, we can't 'exec', so we need to |
168 // reset these entries manually to get the expected testing behavior. | 171 // reset these entries manually to get the expected testing behavior. |
169 void Channel::NotifyProcessForkedForTesting() { | 172 void Channel::NotifyProcessForkedForTesting() { |
170 PipeMap::GetInstance()->map_.clear(); | 173 PipeMap::GetInstance()->map_.clear(); |
171 } | 174 } |
172 #endif | 175 #endif |
173 | 176 |
174 //------------------------------------------------------------------------------ | 177 //------------------------------------------------------------------------------ |
175 | 178 |
176 #if defined(OS_LINUX) | 179 #if defined(OS_LINUX) || defined(__native_client_nonsfi__) |
177 int ChannelPosix::global_pid_ = 0; | 180 int ChannelPosix::global_pid_ = 0; |
178 #endif // OS_LINUX | 181 #endif |
179 | 182 |
180 ChannelPosix::ChannelPosix(const IPC::ChannelHandle& channel_handle, | 183 ChannelPosix::ChannelPosix(const IPC::ChannelHandle& channel_handle, |
181 Mode mode, Listener* listener) | 184 Mode mode, Listener* listener) |
182 : ChannelReader(listener), | 185 : ChannelReader(listener), |
183 mode_(mode), | 186 mode_(mode), |
184 peer_pid_(base::kNullProcessId), | 187 peer_pid_(base::kNullProcessId), |
185 is_blocked_on_write_(false), | 188 is_blocked_on_write_(false), |
186 waiting_connect_(true), | 189 waiting_connect_(true), |
187 message_send_bytes_written_(0), | 190 message_send_bytes_written_(0), |
188 pipe_name_(channel_handle.name), | 191 pipe_name_(channel_handle.name), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 if (value == -1) { | 251 if (value == -1) { |
249 PLOG(ERROR) << "fcntl(F_GETFL) " << pipe_name_; | 252 PLOG(ERROR) << "fcntl(F_GETFL) " << pipe_name_; |
250 return false; | 253 return false; |
251 } | 254 } |
252 if (!(value & O_NONBLOCK)) { | 255 if (!(value & O_NONBLOCK)) { |
253 LOG(ERROR) << "Socket " << pipe_name_ << " must be O_NONBLOCK"; | 256 LOG(ERROR) << "Socket " << pipe_name_ << " must be O_NONBLOCK"; |
254 return false; | 257 return false; |
255 } | 258 } |
256 #endif // IPC_USES_READWRITE | 259 #endif // IPC_USES_READWRITE |
257 } else if (mode_ & MODE_NAMED_FLAG) { | 260 } else if (mode_ & MODE_NAMED_FLAG) { |
| 261 #if defined(__native_client_nonsfi__) |
| 262 LOG(FATAL) |
| 263 << "IPC channels in nacl_helper_nonsfi should not be in NAMED mode."; |
| 264 #else |
258 // Case 2 from comment above. | 265 // Case 2 from comment above. |
259 int local_pipe_fd = -1; | 266 int local_pipe_fd = -1; |
260 | 267 |
261 if (mode_ & MODE_SERVER_FLAG) { | 268 if (mode_ & MODE_SERVER_FLAG) { |
262 if (!CreateServerUnixDomainSocket(base::FilePath(pipe_name_), | 269 if (!CreateServerUnixDomainSocket(base::FilePath(pipe_name_), |
263 &local_pipe_fd)) { | 270 &local_pipe_fd)) { |
264 return false; | 271 return false; |
265 } | 272 } |
266 | 273 |
267 must_unlink_ = true; | 274 must_unlink_ = true; |
268 } else if (mode_ & MODE_CLIENT_FLAG) { | 275 } else if (mode_ & MODE_CLIENT_FLAG) { |
269 if (!CreateClientUnixDomainSocket(base::FilePath(pipe_name_), | 276 if (!CreateClientUnixDomainSocket(base::FilePath(pipe_name_), |
270 &local_pipe_fd)) { | 277 &local_pipe_fd)) { |
271 return false; | 278 return false; |
272 } | 279 } |
273 } else { | 280 } else { |
274 LOG(ERROR) << "Bad mode: " << mode_; | 281 LOG(ERROR) << "Bad mode: " << mode_; |
275 return false; | 282 return false; |
276 } | 283 } |
277 | 284 |
278 local_pipe.reset(local_pipe_fd); | 285 local_pipe.reset(local_pipe_fd); |
| 286 #endif // !defined(__native_client_nonsfi__) |
279 } else { | 287 } else { |
280 local_pipe.reset(PipeMap::GetInstance()->Lookup(pipe_name_)); | 288 local_pipe.reset(PipeMap::GetInstance()->Lookup(pipe_name_)); |
281 if (mode_ & MODE_CLIENT_FLAG) { | 289 if (mode_ & MODE_CLIENT_FLAG) { |
282 if (local_pipe.is_valid()) { | 290 if (local_pipe.is_valid()) { |
283 // Case 3 from comment above. | 291 // Case 3 from comment above. |
284 // We only allow one connection. | 292 // We only allow one connection. |
285 local_pipe.reset(HANDLE_EINTR(dup(local_pipe.release()))); | 293 local_pipe.reset(HANDLE_EINTR(dup(local_pipe.release()))); |
286 PipeMap::GetInstance()->Remove(pipe_name_); | 294 PipeMap::GetInstance()->Remove(pipe_name_); |
287 } else { | 295 } else { |
288 // Case 4a from comment above. | 296 // Case 4a from comment above. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 int fd_pipe_fd = 1, remote_fd_pipe_fd = -1; | 337 int fd_pipe_fd = 1, remote_fd_pipe_fd = -1; |
330 if (!SocketPair(&fd_pipe_fd, &remote_fd_pipe_fd)) { | 338 if (!SocketPair(&fd_pipe_fd, &remote_fd_pipe_fd)) { |
331 return false; | 339 return false; |
332 } | 340 } |
333 | 341 |
334 fd_pipe_.reset(fd_pipe_fd); | 342 fd_pipe_.reset(fd_pipe_fd); |
335 remote_fd_pipe_.reset(remote_fd_pipe_fd); | 343 remote_fd_pipe_.reset(remote_fd_pipe_fd); |
336 } | 344 } |
337 #endif // IPC_USES_READWRITE | 345 #endif // IPC_USES_READWRITE |
338 | 346 |
339 if ((mode_ & MODE_SERVER_FLAG) && (mode_ & MODE_NAMED_FLAG)) | 347 if ((mode_ & MODE_SERVER_FLAG) && (mode_ & MODE_NAMED_FLAG)) { |
| 348 #if defined(__native_client_nonsfi__) |
| 349 LOG(FATAL) << "IPC channels in nacl_helper_nonsfi " |
| 350 << "should not be in NAMED or SERVER mode."; |
| 351 #else |
340 server_listen_pipe_.reset(local_pipe.release()); | 352 server_listen_pipe_.reset(local_pipe.release()); |
341 else | 353 #endif |
| 354 } else { |
342 pipe_.reset(local_pipe.release()); | 355 pipe_.reset(local_pipe.release()); |
| 356 } |
343 return true; | 357 return true; |
344 } | 358 } |
345 | 359 |
346 bool ChannelPosix::Connect() { | 360 bool ChannelPosix::Connect() { |
347 if (!server_listen_pipe_.is_valid() && !pipe_.is_valid()) { | 361 if (!server_listen_pipe_.is_valid() && !pipe_.is_valid()) { |
348 DLOG(WARNING) << "Channel creation failed: " << pipe_name_; | 362 DLOG(WARNING) << "Channel creation failed: " << pipe_name_; |
349 return false; | 363 return false; |
350 } | 364 } |
351 | 365 |
352 bool did_connect = true; | 366 bool did_connect = true; |
353 if (server_listen_pipe_.is_valid()) { | 367 if (server_listen_pipe_.is_valid()) { |
| 368 #if defined(__native_client_nonsfi__) |
| 369 LOG(FATAL) << "IPC channels in nacl_helper_nonsfi " |
| 370 << "should always be in client mode."; |
| 371 #else |
354 // Watch the pipe for connections, and turn any connections into | 372 // Watch the pipe for connections, and turn any connections into |
355 // active sockets. | 373 // active sockets. |
356 base::MessageLoopForIO::current()->WatchFileDescriptor( | 374 base::MessageLoopForIO::current()->WatchFileDescriptor( |
357 server_listen_pipe_.get(), | 375 server_listen_pipe_.get(), |
358 true, | 376 true, |
359 base::MessageLoopForIO::WATCH_READ, | 377 base::MessageLoopForIO::WATCH_READ, |
360 &server_listen_connection_watcher_, | 378 &server_listen_connection_watcher_, |
361 this); | 379 this); |
| 380 #endif |
362 } else { | 381 } else { |
363 did_connect = AcceptConnection(); | 382 did_connect = AcceptConnection(); |
364 } | 383 } |
365 return did_connect; | 384 return did_connect; |
366 } | 385 } |
367 | 386 |
368 void ChannelPosix::CloseFileDescriptors(Message* msg) { | 387 void ChannelPosix::CloseFileDescriptors(Message* msg) { |
369 #if defined(OS_MACOSX) | 388 #if defined(OS_MACOSX) |
370 // There is a bug on OSX which makes it dangerous to close | 389 // There is a bug on OSX which makes it dangerous to close |
371 // a file descriptor while it is in transit. So instead we | 390 // a file descriptor while it is in transit. So instead we |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 } | 593 } |
575 | 594 |
576 bool ChannelPosix::AcceptsConnections() const { | 595 bool ChannelPosix::AcceptsConnections() const { |
577 return server_listen_pipe_.is_valid(); | 596 return server_listen_pipe_.is_valid(); |
578 } | 597 } |
579 | 598 |
580 bool ChannelPosix::HasAcceptedConnection() const { | 599 bool ChannelPosix::HasAcceptedConnection() const { |
581 return AcceptsConnections() && pipe_.is_valid(); | 600 return AcceptsConnections() && pipe_.is_valid(); |
582 } | 601 } |
583 | 602 |
| 603 #if !defined(__native_client_nonsfi__) |
| 604 // GetPeerEuid is not supported in nacl_helper_nonsfi. |
584 bool ChannelPosix::GetPeerEuid(uid_t* peer_euid) const { | 605 bool ChannelPosix::GetPeerEuid(uid_t* peer_euid) const { |
585 DCHECK(!(mode_ & MODE_SERVER) || HasAcceptedConnection()); | 606 DCHECK(!(mode_ & MODE_SERVER) || HasAcceptedConnection()); |
586 return IPC::GetPeerEuid(pipe_.get(), peer_euid); | 607 return IPC::GetPeerEuid(pipe_.get(), peer_euid); |
587 } | 608 } |
| 609 #endif |
588 | 610 |
589 void ChannelPosix::ResetToAcceptingConnectionState() { | 611 void ChannelPosix::ResetToAcceptingConnectionState() { |
590 // Unregister libevent for the unix domain socket and close it. | 612 // Unregister libevent for the unix domain socket and close it. |
591 read_watcher_.StopWatchingFileDescriptor(); | 613 read_watcher_.StopWatchingFileDescriptor(); |
592 write_watcher_.StopWatchingFileDescriptor(); | 614 write_watcher_.StopWatchingFileDescriptor(); |
593 pipe_.reset(); | 615 pipe_.reset(); |
594 #if defined(IPC_USES_READWRITE) | 616 #if defined(IPC_USES_READWRITE) |
595 fd_pipe_.reset(); | 617 fd_pipe_.reset(); |
596 remote_fd_pipe_.reset(); | 618 remote_fd_pipe_.reset(); |
597 #endif // IPC_USES_READWRITE | 619 #endif // IPC_USES_READWRITE |
(...skipping 18 matching lines...) Expand all Loading... |
616 fds_to_close_.clear(); | 638 fds_to_close_.clear(); |
617 #endif | 639 #endif |
618 } | 640 } |
619 | 641 |
620 // static | 642 // static |
621 bool ChannelPosix::IsNamedServerInitialized( | 643 bool ChannelPosix::IsNamedServerInitialized( |
622 const std::string& channel_id) { | 644 const std::string& channel_id) { |
623 return base::PathExists(base::FilePath(channel_id)); | 645 return base::PathExists(base::FilePath(channel_id)); |
624 } | 646 } |
625 | 647 |
626 #if defined(OS_LINUX) | 648 #if defined(OS_LINUX) || defined(__native_client_nonsfi__) |
627 // static | 649 // static |
628 void ChannelPosix::SetGlobalPid(int pid) { | 650 void ChannelPosix::SetGlobalPid(int pid) { |
629 global_pid_ = pid; | 651 global_pid_ = pid; |
630 } | 652 } |
631 #endif // OS_LINUX | 653 #endif |
632 | 654 |
633 // Called by libevent when we can read from the pipe without blocking. | 655 // Called by libevent when we can read from the pipe without blocking. |
634 void ChannelPosix::OnFileCanReadWithoutBlocking(int fd) { | 656 void ChannelPosix::OnFileCanReadWithoutBlocking(int fd) { |
635 if (fd == server_listen_pipe_.get()) { | 657 if (fd == server_listen_pipe_.get()) { |
| 658 #if defined(__native_client_nonsfi__) |
| 659 LOG(FATAL) |
| 660 << "IPC channels in nacl_helper_nonsfi should not be SERVER mode."; |
| 661 #else |
636 int new_pipe = 0; | 662 int new_pipe = 0; |
637 if (!ServerAcceptConnection(server_listen_pipe_.get(), &new_pipe) || | 663 if (!ServerAcceptConnection(server_listen_pipe_.get(), &new_pipe) || |
638 new_pipe < 0) { | 664 new_pipe < 0) { |
639 Close(); | 665 Close(); |
640 listener()->OnChannelListenError(); | 666 listener()->OnChannelListenError(); |
641 } | 667 } |
642 | 668 |
643 if (pipe_.is_valid()) { | 669 if (pipe_.is_valid()) { |
644 // We already have a connection. We only handle one at a time. | 670 // We already have a connection. We only handle one at a time. |
645 // close our new descriptor. | 671 // close our new descriptor. |
(...skipping 18 matching lines...) Expand all Loading... |
664 DLOG(WARNING) << "Client euid is not authorised"; | 690 DLOG(WARNING) << "Client euid is not authorised"; |
665 ResetToAcceptingConnectionState(); | 691 ResetToAcceptingConnectionState(); |
666 return; | 692 return; |
667 } | 693 } |
668 } | 694 } |
669 | 695 |
670 if (!AcceptConnection()) { | 696 if (!AcceptConnection()) { |
671 NOTREACHED() << "AcceptConnection should not fail on server"; | 697 NOTREACHED() << "AcceptConnection should not fail on server"; |
672 } | 698 } |
673 waiting_connect_ = false; | 699 waiting_connect_ = false; |
| 700 #endif |
674 } else if (fd == pipe_) { | 701 } else if (fd == pipe_) { |
675 if (waiting_connect_ && (mode_ & MODE_SERVER_FLAG)) { | 702 if (waiting_connect_ && (mode_ & MODE_SERVER_FLAG)) { |
676 waiting_connect_ = false; | 703 waiting_connect_ = false; |
677 } | 704 } |
678 if (!ProcessIncomingMessages()) { | 705 if (!ProcessIncomingMessages()) { |
679 // ClosePipeOnError may delete this object, so we mustn't call | 706 // ClosePipeOnError may delete this object, so we mustn't call |
680 // ProcessOutgoingMessages. | 707 // ProcessOutgoingMessages. |
681 ClosePipeOnError(); | 708 ClosePipeOnError(); |
682 return; | 709 return; |
683 } | 710 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 Close(); | 764 Close(); |
738 if (AcceptsConnections()) { | 765 if (AcceptsConnections()) { |
739 listener()->OnChannelListenError(); | 766 listener()->OnChannelListenError(); |
740 } else { | 767 } else { |
741 listener()->OnChannelError(); | 768 listener()->OnChannelError(); |
742 } | 769 } |
743 } | 770 } |
744 } | 771 } |
745 | 772 |
746 int ChannelPosix::GetHelloMessageProcId() const { | 773 int ChannelPosix::GetHelloMessageProcId() const { |
747 int pid = base::GetCurrentProcId(); | 774 // Our process may be in a sandbox with a separate PID namespace. |
| 775 #if defined(__native_client_nonsfi__) |
| 776 // In nacl_helper_nonsfi, our process should be always in the sandbox, unless |
| 777 // --no-sandbox is set. In such a situation, calling GetCurrentProcId() |
| 778 // would hit the sandbox restriction. global_pid_ should be initialize at |
| 779 // the very beginning of the nacl_helper_nonsfi, regardless of the |
| 780 // --no-sandbox flag. |
| 781 CHECK(global_pid_); |
| 782 return global_pid_; |
| 783 #else |
748 #if defined(OS_LINUX) | 784 #if defined(OS_LINUX) |
749 // Our process may be in a sandbox with a separate PID namespace. | |
750 if (global_pid_) { | 785 if (global_pid_) { |
751 pid = global_pid_; | 786 return global_pid_; |
752 } | 787 } |
753 #endif | 788 // Fall through to below. |
754 return pid; | 789 #endif // defined(OS_LINUX) |
| 790 return base::GetCurrentProcId(); |
| 791 #endif // defined(__native_client_nonsfi__) |
755 } | 792 } |
756 | 793 |
757 void ChannelPosix::QueueHelloMessage() { | 794 void ChannelPosix::QueueHelloMessage() { |
758 // Create the Hello message | 795 // Create the Hello message |
759 scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE, | 796 scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE, |
760 HELLO_MESSAGE_TYPE, | 797 HELLO_MESSAGE_TYPE, |
761 IPC::Message::PRIORITY_NORMAL)); | 798 IPC::Message::PRIORITY_NORMAL)); |
762 if (!msg->WriteInt(GetHelloMessageProcId())) { | 799 if (!msg->WriteInt(GetHelloMessageProcId())) { |
763 NOTREACHED() << "Unable to pickle hello message proc id"; | 800 NOTREACHED() << "Unable to pickle hello message proc id"; |
764 } | 801 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 cmsg = CMSG_NXTHDR(msg, cmsg)) { | 953 cmsg = CMSG_NXTHDR(msg, cmsg)) { |
917 if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) { | 954 if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) { |
918 unsigned payload_len = cmsg->cmsg_len - CMSG_LEN(0); | 955 unsigned payload_len = cmsg->cmsg_len - CMSG_LEN(0); |
919 DCHECK_EQ(0U, payload_len % sizeof(int)); | 956 DCHECK_EQ(0U, payload_len % sizeof(int)); |
920 const int* file_descriptors = reinterpret_cast<int*>(CMSG_DATA(cmsg)); | 957 const int* file_descriptors = reinterpret_cast<int*>(CMSG_DATA(cmsg)); |
921 unsigned num_file_descriptors = payload_len / 4; | 958 unsigned num_file_descriptors = payload_len / 4; |
922 input_fds_.insert(input_fds_.end(), | 959 input_fds_.insert(input_fds_.end(), |
923 file_descriptors, | 960 file_descriptors, |
924 file_descriptors + num_file_descriptors); | 961 file_descriptors + num_file_descriptors); |
925 | 962 |
| 963 #if !defined(__native_client_nonsfi__) |
| 964 // The PNaCl toolchain for Non-SFI binary build does not support |
| 965 // MSG_CTRUNC. |
926 // Check this after adding the FDs so we don't leak them. | 966 // Check this after adding the FDs so we don't leak them. |
927 if (msg->msg_flags & MSG_CTRUNC) { | 967 if (msg->msg_flags & MSG_CTRUNC) { |
928 ClearInputFDs(); | 968 ClearInputFDs(); |
929 return false; | 969 return false; |
930 } | 970 } |
| 971 #endif |
931 | 972 |
932 return true; | 973 return true; |
933 } | 974 } |
934 } | 975 } |
935 | 976 |
936 // No file descriptors found, but that's OK. | 977 // No file descriptors found, but that's OK. |
937 return true; | 978 return true; |
938 } | 979 } |
939 | 980 |
940 void ChannelPosix::ClearInputFDs() { | 981 void ChannelPosix::ClearInputFDs() { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 // idempotent. | 1066 // idempotent. |
1026 | 1067 |
1027 ResetToAcceptingConnectionState(); | 1068 ResetToAcceptingConnectionState(); |
1028 | 1069 |
1029 if (must_unlink_) { | 1070 if (must_unlink_) { |
1030 unlink(pipe_name_.c_str()); | 1071 unlink(pipe_name_.c_str()); |
1031 must_unlink_ = false; | 1072 must_unlink_ = false; |
1032 } | 1073 } |
1033 | 1074 |
1034 if (server_listen_pipe_.is_valid()) { | 1075 if (server_listen_pipe_.is_valid()) { |
| 1076 #if defined(__native_client_nonsfi__) |
| 1077 LOG(FATAL) |
| 1078 << "IPC channels in nacl_helper_nonsfi should not be SERVER mode."; |
| 1079 #else |
1035 server_listen_pipe_.reset(); | 1080 server_listen_pipe_.reset(); |
1036 // Unregister libevent for the listening socket and close it. | 1081 // Unregister libevent for the listening socket and close it. |
1037 server_listen_connection_watcher_.StopWatchingFileDescriptor(); | 1082 server_listen_connection_watcher_.StopWatchingFileDescriptor(); |
| 1083 #endif |
1038 } | 1084 } |
1039 | 1085 |
1040 CloseClientFileDescriptor(); | 1086 CloseClientFileDescriptor(); |
1041 } | 1087 } |
1042 | 1088 |
1043 base::ProcessId ChannelPosix::GetPeerPID() const { | 1089 base::ProcessId ChannelPosix::GetPeerPID() const { |
1044 return peer_pid_; | 1090 return peer_pid_; |
1045 } | 1091 } |
1046 | 1092 |
1047 base::ProcessId ChannelPosix::GetSelfPID() const { | 1093 base::ProcessId ChannelPosix::GetSelfPID() const { |
(...skipping 20 matching lines...) Expand all Loading... |
1068 | 1114 |
1069 return id.append(GenerateUniqueRandomChannelID()); | 1115 return id.append(GenerateUniqueRandomChannelID()); |
1070 } | 1116 } |
1071 | 1117 |
1072 | 1118 |
1073 bool Channel::IsNamedServerInitialized( | 1119 bool Channel::IsNamedServerInitialized( |
1074 const std::string& channel_id) { | 1120 const std::string& channel_id) { |
1075 return ChannelPosix::IsNamedServerInitialized(channel_id); | 1121 return ChannelPosix::IsNamedServerInitialized(channel_id); |
1076 } | 1122 } |
1077 | 1123 |
1078 #if defined(OS_LINUX) | 1124 #if defined(OS_LINUX) || defined(__native_client_nonsfi__) |
1079 // static | 1125 // static |
1080 void Channel::SetGlobalPid(int pid) { | 1126 void Channel::SetGlobalPid(int pid) { |
1081 ChannelPosix::SetGlobalPid(pid); | 1127 ChannelPosix::SetGlobalPid(pid); |
1082 } | 1128 } |
1083 #endif // OS_LINUX | 1129 #endif |
1084 | 1130 |
1085 } // namespace IPC | 1131 } // namespace IPC |
OLD | NEW |