OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <limits.h> | 8 #include <limits.h> |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
11 #include <sys/ioctl.h> | 11 #include <sys/ioctl.h> |
12 #include <sys/socket.h> | 12 #include <sys/socket.h> |
13 #if defined(OS_SOLARIS) | |
Evan Martin
2011/06/24 17:51:18
Can you put a newline before this?
| |
14 #include <sys/filio.h> | |
15 #endif | |
13 | 16 |
14 #include "base/file_util.h" | 17 #include "base/file_util.h" |
15 #include "base/logging.h" | 18 #include "base/logging.h" |
16 | 19 |
17 | 20 |
18 namespace base { | 21 namespace base { |
19 | 22 |
20 namespace { | 23 namespace { |
21 // To avoid users sending negative message lengths to Send/Receive | 24 // To avoid users sending negative message lengths to Send/Receive |
22 // we clamp message lengths, which are size_t, to no more than INT_MAX. | 25 // we clamp message lengths, which are size_t, to no more than INT_MAX. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 size_t SyncSocket::Peek() { | 110 size_t SyncSocket::Peek() { |
108 int number_chars; | 111 int number_chars; |
109 if (-1 == ioctl(handle_, FIONREAD, &number_chars)) { | 112 if (-1 == ioctl(handle_, FIONREAD, &number_chars)) { |
110 // If there is an error in ioctl, signal that the channel would block. | 113 // If there is an error in ioctl, signal that the channel would block. |
111 return 0; | 114 return 0; |
112 } | 115 } |
113 return (size_t) number_chars; | 116 return (size_t) number_chars; |
114 } | 117 } |
115 | 118 |
116 } // namespace base | 119 } // namespace base |
OLD | NEW |