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

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

Issue 22634003: Replaced strerror() calls with threadsafe strerror_r() (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | « runtime/bin/eventhandler_android.cc ('k') | runtime/bin/eventhandler_macos.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "bin/eventhandler.h" 8 #include "bin/eventhandler.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // recv to peek for whether the other end of the socket 313 // recv to peek for whether the other end of the socket
314 // actually closed. 314 // actually closed.
315 char buffer; 315 char buffer;
316 ssize_t bytesPeeked = 316 ssize_t bytesPeeked =
317 TEMP_FAILURE_RETRY(recv(sd->fd(), &buffer, 1, MSG_PEEK)); 317 TEMP_FAILURE_RETRY(recv(sd->fd(), &buffer, 1, MSG_PEEK));
318 ASSERT(EAGAIN == EWOULDBLOCK); 318 ASSERT(EAGAIN == EWOULDBLOCK);
319 if (bytesPeeked == 0) { 319 if (bytesPeeked == 0) {
320 event_mask = (1 << kCloseEvent); 320 event_mask = (1 << kCloseEvent);
321 sd->MarkClosedRead(); 321 sd->MarkClosedRead();
322 } else if (errno != EWOULDBLOCK) { 322 } else if (errno != EWOULDBLOCK) {
323 Log::PrintErr("Error recv: %s\n", strerror(errno)); 323 const int kBufferSize = 1024;
324 char error_buf[kBufferSize];
325 Log::PrintErr("Error recv: %s\n",
326 strerror_r(errno, error_buf, kBufferSize));
324 } 327 }
325 } 328 }
326 } 329 }
327 } 330 }
328 331
329 if ((events & EPOLLOUT) != 0) { 332 if ((events & EPOLLOUT) != 0) {
330 if ((events & EPOLLERR) != 0) { 333 if ((events & EPOLLERR) != 0) {
331 event_mask = (1 << kErrorEvent); 334 event_mask = (1 << kErrorEvent);
332 sd->MarkClosedWrite(); 335 sd->MarkClosedWrite();
333 } else { 336 } else {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 446
444 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { 447 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) {
445 // The hashmap does not support keys with value 0. 448 // The hashmap does not support keys with value 0.
446 return dart::Utils::WordHash(fd + 1); 449 return dart::Utils::WordHash(fd + 1);
447 } 450 }
448 451
449 } // namespace bin 452 } // namespace bin
450 } // namespace dart 453 } // namespace dart
451 454
452 #endif // defined(TARGET_OS_LINUX) 455 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler_android.cc ('k') | runtime/bin/eventhandler_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698