OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/unix_domain_socket_util.h" | 5 #include "ipc/unix_domain_socket_util.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 <sys/socket.h> | 10 #include <sys/socket.h> |
10 #include <sys/stat.h> | 11 #include <sys/stat.h> |
11 #include <sys/un.h> | 12 #include <sys/un.h> |
12 #include <unistd.h> | 13 #include <unistd.h> |
13 | 14 |
14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
15 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
16 #include "base/files/scoped_file.h" | 17 #include "base/files/scoped_file.h" |
17 #include "base/logging.h" | 18 #include "base/logging.h" |
18 #include "base/posix/eintr_wrapper.h" | 19 #include "base/posix/eintr_wrapper.h" |
| 20 #include "build/build_config.h" |
19 | 21 |
20 namespace IPC { | 22 namespace IPC { |
21 | 23 |
22 // Verify that kMaxSocketNameLength is a decent size. | 24 // Verify that kMaxSocketNameLength is a decent size. |
23 static_assert(sizeof(((sockaddr_un*)0)->sun_path) >= kMaxSocketNameLength, | 25 static_assert(sizeof(((sockaddr_un*)0)->sun_path) >= kMaxSocketNameLength, |
24 "sun_path is too long."); | 26 "sun_path is too long."); |
25 | 27 |
26 namespace { | 28 namespace { |
27 | 29 |
28 // Returns fd (>= 0) on success, -1 on failure. If successful, fills in | 30 // Returns fd (>= 0) on success, -1 on failure. If successful, fills in |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // It's safe to keep listening on |server_listen_fd| even if the attempt to | 194 // It's safe to keep listening on |server_listen_fd| even if the attempt to |
193 // set O_NONBLOCK failed on the client fd. | 195 // set O_NONBLOCK failed on the client fd. |
194 return true; | 196 return true; |
195 } | 197 } |
196 | 198 |
197 *server_socket = accept_fd.release(); | 199 *server_socket = accept_fd.release(); |
198 return true; | 200 return true; |
199 } | 201 } |
200 | 202 |
201 } // namespace IPC | 203 } // namespace IPC |
OLD | NEW |