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

Side by Side Diff: runtime/bin/socket_linux.cc

Issue 163903002: Prototype of I/O statistics for Observatory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 6 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_LINUX) 6 #if defined(TARGET_OS_LINUX)
7 7
8 #include <errno.h> // NOLINT 8 #include <errno.h> // NOLINT
9 #include <stdio.h> // NOLINT 9 #include <stdio.h> // NOLINT
10 #include <stdlib.h> // NOLINT 10 #include <stdlib.h> // NOLINT
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 187
188 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) { 188 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) {
189 ASSERT(fd >= 0); 189 ASSERT(fd >= 0);
190 RawAddr raw; 190 RawAddr raw;
191 socklen_t size = sizeof(raw); 191 socklen_t size = sizeof(raw);
192 if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS( 192 if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS(
193 getpeername(fd, 193 getpeername(fd,
194 &raw.addr, 194 &raw.addr,
195 &size))) { 195 &size))) {
196 const int kBufferSize = 1024;
197 char error_buf[kBufferSize];
198 Log::PrintErr("Error getpeername: %s\n",
199 strerror_r(errno, error_buf, kBufferSize));
200 return NULL; 196 return NULL;
201 } 197 }
202 *port = SocketAddress::GetAddrPort(&raw); 198 *port = SocketAddress::GetAddrPort(&raw);
203 return new SocketAddress(&raw.addr); 199 return new SocketAddress(&raw.addr);
204 } 200 }
205 201
206 202
207 void Socket::GetError(intptr_t fd, OSError* os_error) { 203 void Socket::GetError(intptr_t fd, OSError* os_error) {
208 int len = sizeof(errno); 204 int len = sizeof(errno);
209 int err = 0; 205 int err = 0;
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 mreq.gr_interface = interfaceIndex; 622 mreq.gr_interface = interfaceIndex;
627 memmove(&mreq.gr_group, &addr->ss, SocketAddress::GetAddrLength(addr)); 623 memmove(&mreq.gr_group, &addr->ss, SocketAddress::GetAddrLength(addr));
628 return TEMP_FAILURE_RETRY_BLOCK_SIGNALS(setsockopt( 624 return TEMP_FAILURE_RETRY_BLOCK_SIGNALS(setsockopt(
629 fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0; 625 fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0;
630 } 626 }
631 627
632 } // namespace bin 628 } // namespace bin
633 } // namespace dart 629 } // namespace dart
634 630
635 #endif // defined(TARGET_OS_LINUX) 631 #endif // defined(TARGET_OS_LINUX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698