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 "base/sync_socket.h" | 5 #include "base/sync_socket.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <limits.h> | 9 #include <limits.h> |
| 10 #include <stddef.h> |
10 #include <stdio.h> | 11 #include <stdio.h> |
11 #include <sys/ioctl.h> | 12 #include <sys/ioctl.h> |
12 #include <sys/socket.h> | 13 #include <sys/socket.h> |
13 #include <sys/types.h> | 14 #include <sys/types.h> |
14 | 15 |
15 #if defined(OS_SOLARIS) | 16 #if defined(OS_SOLARIS) |
16 #include <sys/filio.h> | 17 #include <sys/filio.h> |
17 #endif | 18 #endif |
18 | 19 |
19 #include "base/files/file_util.h" | 20 #include "base/files/file_util.h" |
20 #include "base/logging.h" | 21 #include "base/logging.h" |
21 #include "base/threading/thread_restrictions.h" | 22 #include "base/threading/thread_restrictions.h" |
| 23 #include "build/build_config.h" |
22 | 24 |
23 namespace base { | 25 namespace base { |
24 | 26 |
25 namespace { | 27 namespace { |
26 // To avoid users sending negative message lengths to Send/Receive | 28 // To avoid users sending negative message lengths to Send/Receive |
27 // we clamp message lengths, which are size_t, to no more than INT_MAX. | 29 // we clamp message lengths, which are size_t, to no more than INT_MAX. |
28 const size_t kMaxMessageLength = static_cast<size_t>(INT_MAX); | 30 const size_t kMaxMessageLength = static_cast<size_t>(INT_MAX); |
29 | 31 |
30 // Writes |length| of |buffer| into |handle|. Returns the number of bytes | 32 // Writes |length| of |buffer| into |handle|. Returns the number of bytes |
31 // written or zero on error. |length| must be greater than 0. | 33 // written or zero on error. |length| must be greater than 0. |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 return len; | 239 return len; |
238 } | 240 } |
239 | 241 |
240 // static | 242 // static |
241 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, | 243 bool CancelableSyncSocket::CreatePair(CancelableSyncSocket* socket_a, |
242 CancelableSyncSocket* socket_b) { | 244 CancelableSyncSocket* socket_b) { |
243 return SyncSocket::CreatePair(socket_a, socket_b); | 245 return SyncSocket::CreatePair(socket_a, socket_b); |
244 } | 246 } |
245 | 247 |
246 } // namespace base | 248 } // namespace base |
OLD | NEW |