Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: base/sync_socket_posix.cc

Issue 6410105: run iwyu on base! Base URL: svn://svn.chromium.org/chrome/trunk/src/base
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/stringprintf.cc ('k') | base/synchronization/cancellation_flag.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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"
6
7 #include <errno.h>
8 #include <limits.h> 5 #include <limits.h>
9 #include <stdio.h> 6 #include <stddef.h>
10 #include <sys/types.h> 7 #include <sys/filio.h>
11 #include <sys/ioctl.h> 8 #include <sys/ioctl.h>
12 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <unistd.h>
13 11
14 #include "base/file_util.h" 12 #include "base/file_util.h"
15 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/sync_socket.h"
15 #include "build/build_config.h"
16 16
17 17
18 namespace base { 18 namespace base {
19 19
20 namespace { 20 namespace {
21 // To avoid users sending negative message lengths to Send/Receive 21 // 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. 22 // we clamp message lengths, which are size_t, to no more than INT_MAX.
23 const size_t kMaxMessageLength = static_cast<size_t>(INT_MAX); 23 const size_t kMaxMessageLength = static_cast<size_t>(INT_MAX);
24 24
25 static const SyncSocket::Handle kInvalidHandle = -1; 25 static const SyncSocket::Handle kInvalidHandle = -1;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 size_t SyncSocket::Peek() { 101 size_t SyncSocket::Peek() {
102 int number_chars; 102 int number_chars;
103 if (-1 == ioctl(handle_, FIONREAD, &number_chars)) { 103 if (-1 == ioctl(handle_, FIONREAD, &number_chars)) {
104 // If there is an error in ioctl, signal that the channel would block. 104 // If there is an error in ioctl, signal that the channel would block.
105 return 0; 105 return 0;
106 } 106 }
107 return (size_t) number_chars; 107 return (size_t) number_chars;
108 } 108 }
109 109
110 } // namespace base 110 } // namespace base
OLDNEW
« no previous file with comments | « base/stringprintf.cc ('k') | base/synchronization/cancellation_flag.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698