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/types.h> | 10 #include <sys/types.h> |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 PLOG(ERROR) << "fcntl(O_NONBLOCK) " << pipe_name; | 163 PLOG(ERROR) << "fcntl(O_NONBLOCK) " << pipe_name; |
164 if (HANDLE_EINTR(close(fd)) < 0) | 164 if (HANDLE_EINTR(close(fd)) < 0) |
165 PLOG(ERROR) << "close " << pipe_name; | 165 PLOG(ERROR) << "close " << pipe_name; |
166 return false; | 166 return false; |
167 } | 167 } |
168 | 168 |
169 // Delete any old FS instances. | 169 // Delete any old FS instances. |
170 unlink(pipe_name.c_str()); | 170 unlink(pipe_name.c_str()); |
171 | 171 |
172 // Make sure the path we need exists. | 172 // Make sure the path we need exists. |
173 FilePath path(pipe_name); | 173 base::FilePath path(pipe_name); |
174 FilePath dir_path = path.DirName(); | 174 base::FilePath dir_path = path.DirName(); |
175 if (!file_util::CreateDirectory(dir_path)) { | 175 if (!file_util::CreateDirectory(dir_path)) { |
176 if (HANDLE_EINTR(close(fd)) < 0) | 176 if (HANDLE_EINTR(close(fd)) < 0) |
177 PLOG(ERROR) << "close " << pipe_name; | 177 PLOG(ERROR) << "close " << pipe_name; |
178 return false; | 178 return false; |
179 } | 179 } |
180 | 180 |
181 // Create unix_addr structure. | 181 // Create unix_addr structure. |
182 struct sockaddr_un unix_addr; | 182 struct sockaddr_un unix_addr; |
183 memset(&unix_addr, 0, sizeof(unix_addr)); | 183 memset(&unix_addr, 0, sizeof(unix_addr)); |
184 unix_addr.sun_family = AF_UNIX; | 184 unix_addr.sun_family = AF_UNIX; |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 delete m; | 731 delete m; |
732 } | 732 } |
733 | 733 |
734 // Close any outstanding, received file descriptors. | 734 // Close any outstanding, received file descriptors. |
735 ClearInputFDs(); | 735 ClearInputFDs(); |
736 } | 736 } |
737 | 737 |
738 // static | 738 // static |
739 bool Channel::ChannelImpl::IsNamedServerInitialized( | 739 bool Channel::ChannelImpl::IsNamedServerInitialized( |
740 const std::string& channel_id) { | 740 const std::string& channel_id) { |
741 return file_util::PathExists(FilePath(channel_id)); | 741 return file_util::PathExists(base::FilePath(channel_id)); |
742 } | 742 } |
743 | 743 |
744 #if defined(OS_LINUX) | 744 #if defined(OS_LINUX) |
745 // static | 745 // static |
746 void Channel::ChannelImpl::SetGlobalPid(int pid) { | 746 void Channel::ChannelImpl::SetGlobalPid(int pid) { |
747 global_pid_ = pid; | 747 global_pid_ = pid; |
748 } | 748 } |
749 #endif // OS_LINUX | 749 #endif // OS_LINUX |
750 | 750 |
751 // Called by libevent when we can read from the pipe without blocking. | 751 // Called by libevent when we can read from the pipe without blocking. |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 | 1184 |
1185 | 1185 |
1186 #if defined(OS_LINUX) | 1186 #if defined(OS_LINUX) |
1187 // static | 1187 // static |
1188 void Channel::SetGlobalPid(int pid) { | 1188 void Channel::SetGlobalPid(int pid) { |
1189 ChannelImpl::SetGlobalPid(pid); | 1189 ChannelImpl::SetGlobalPid(pid); |
1190 } | 1190 } |
1191 #endif // OS_LINUX | 1191 #endif // OS_LINUX |
1192 | 1192 |
1193 } // namespace IPC | 1193 } // namespace IPC |
OLD | NEW |