| OLD | NEW | 
|---|
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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/types.h> | 10 #include <sys/types.h> | 
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 193 } | 193 } | 
| 194 | 194 | 
| 195 // Accept a connection on a fifo. | 195 // Accept a connection on a fifo. | 
| 196 bool ServerAcceptFifoConnection(int server_listen_fd, int* server_socket) { | 196 bool ServerAcceptFifoConnection(int server_listen_fd, int* server_socket) { | 
| 197   DCHECK(server_socket); | 197   DCHECK(server_socket); | 
| 198 | 198 | 
| 199   int accept_fd = HANDLE_EINTR(accept(server_listen_fd, NULL, 0)); | 199   int accept_fd = HANDLE_EINTR(accept(server_listen_fd, NULL, 0)); | 
| 200   if (accept_fd < 0) | 200   if (accept_fd < 0) | 
| 201     return false; | 201     return false; | 
| 202   if (fcntl(accept_fd, F_SETFL, O_NONBLOCK) == -1) { | 202   if (fcntl(accept_fd, F_SETFL, O_NONBLOCK) == -1) { | 
| 203     if (HANDLE_EINTR(close(accept_fd)) < 0) | 203     HANDLE_EINTR(close(accept_fd)); | 
| 204       PLOG(ERROR) << "close"; |  | 
| 205     return false; | 204     return false; | 
| 206   } | 205   } | 
| 207 | 206 | 
| 208   *server_socket = accept_fd; | 207   *server_socket = accept_fd; | 
| 209   return true; | 208   return true; | 
| 210 } | 209 } | 
| 211 | 210 | 
| 212 bool ClientConnectToFifo(const std::string &pipe_name, int* client_socket) { | 211 bool ClientConnectToFifo(const std::string &pipe_name, int* client_socket) { | 
| 213   DCHECK(client_socket); | 212   DCHECK(client_socket); | 
| 214   DCHECK_LT(pipe_name.length(), kMaxPipeNameLength); | 213   DCHECK_LT(pipe_name.length(), kMaxPipeNameLength); | 
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1080 | 1079 | 
| 1081 bool Channel::Send(Message* message) { | 1080 bool Channel::Send(Message* message) { | 
| 1082   return channel_impl_->Send(message); | 1081   return channel_impl_->Send(message); | 
| 1083 } | 1082 } | 
| 1084 | 1083 | 
| 1085 int Channel::GetClientFileDescriptor() const { | 1084 int Channel::GetClientFileDescriptor() const { | 
| 1086   return channel_impl_->GetClientFileDescriptor(); | 1085   return channel_impl_->GetClientFileDescriptor(); | 
| 1087 } | 1086 } | 
| 1088 | 1087 | 
| 1089 }  // namespace IPC | 1088 }  // namespace IPC | 
| OLD | NEW | 
|---|