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

Side by Side Diff: runtime/bin/socket_macos.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_MACOS) 6 #if defined(TARGET_OS_MACOS)
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 186
187 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) { 187 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) {
188 ASSERT(fd >= 0); 188 ASSERT(fd >= 0);
189 RawAddr raw; 189 RawAddr raw;
190 socklen_t size = sizeof(raw); 190 socklen_t size = sizeof(raw);
191 if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS( 191 if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS(
192 getpeername(fd, 192 getpeername(fd,
193 &raw.addr, 193 &raw.addr,
194 &size))) { 194 &size))) {
195 const int kBufferSize = 1024;
196 char error_message[kBufferSize];
197 strerror_r(errno, error_message, kBufferSize);
198 Log::PrintErr("Error getpeername: %s\n", error_message);
199 return NULL; 195 return NULL;
200 } 196 }
201 *port = SocketAddress::GetAddrPort(&raw); 197 *port = SocketAddress::GetAddrPort(&raw);
202 return new SocketAddress(&raw.addr); 198 return new SocketAddress(&raw.addr);
203 } 199 }
204 200
205 201
206 void Socket::GetError(intptr_t fd, OSError* os_error) { 202 void Socket::GetError(intptr_t fd, OSError* os_error) {
207 int len = sizeof(errno); 203 int len = sizeof(errno);
208 getsockopt(fd, 204 getsockopt(fd,
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 632
637 bool Socket::LeaveMulticast( 633 bool Socket::LeaveMulticast(
638 intptr_t fd, RawAddr* addr, RawAddr* interface, int interfaceIndex) { 634 intptr_t fd, RawAddr* addr, RawAddr* interface, int interfaceIndex) {
639 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); 635 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false);
640 } 636 }
641 637
642 } // namespace bin 638 } // namespace bin
643 } // namespace dart 639 } // namespace dart
644 640
645 #endif // defined(TARGET_OS_MACOS) 641 #endif // defined(TARGET_OS_MACOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698