| OLD | NEW |
| 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 #if !defined(DART_IO_DISABLED) | 5 #if !defined(DART_IO_DISABLED) |
| 6 | 6 |
| 7 #include "platform/globals.h" | 7 #include "platform/globals.h" |
| 8 #if defined(TARGET_OS_ANDROID) | 8 #if defined(TARGET_OS_ANDROID) |
| 9 | 9 |
| 10 #include "bin/socket.h" | 10 #include "bin/socket.h" |
| 11 #include "bin/socket_android.h" | 11 #include "bin/socket_android.h" |
| 12 | 12 |
| 13 #include <errno.h> // NOLINT | 13 #include <errno.h> // NOLINT |
| 14 #include <netinet/tcp.h> // NOLINT | 14 #include <netinet/tcp.h> // NOLINT |
| 15 #include <stdio.h> // NOLINT | 15 #include <stdio.h> // NOLINT |
| 16 #include <stdlib.h> // NOLINT | 16 #include <stdlib.h> // NOLINT |
| 17 #include <string.h> // NOLINT | 17 #include <string.h> // NOLINT |
| 18 #include <sys/stat.h> // NOLINT | 18 #include <sys/stat.h> // NOLINT |
| 19 #include <unistd.h> // NOLINT | 19 #include <unistd.h> // NOLINT |
| 20 | 20 |
| 21 #include "bin/fdutils.h" | 21 #include "bin/fdutils.h" |
| 22 #include "bin/file.h" | 22 #include "bin/file.h" |
| 23 #include "platform/signal_blocker.h" | 23 #include "platform/signal_blocker.h" |
| 24 | 24 |
| 25 namespace dart { | 25 namespace dart { |
| 26 namespace bin { | 26 namespace bin { |
| 27 | 27 |
| 28 static void FDUtils::SaveErrorAndClose(intptr_t fd) { | |
| 29 int err = errno; | |
| 30 VOID_TEMP_FAILURE_RETRY(close(fd)); | |
| 31 errno = err; | |
| 32 } | |
| 33 | |
| 34 | |
| 35 SocketAddress::SocketAddress(struct sockaddr* sa) { | 28 SocketAddress::SocketAddress(struct sockaddr* sa) { |
| 36 ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN); | 29 ASSERT(INET6_ADDRSTRLEN >= INET_ADDRSTRLEN); |
| 37 if (!Socket::FormatNumericAddress(*reinterpret_cast<RawAddr*>(sa), as_string_, | 30 if (!Socket::FormatNumericAddress(*reinterpret_cast<RawAddr*>(sa), as_string_, |
| 38 INET6_ADDRSTRLEN)) { | 31 INET6_ADDRSTRLEN)) { |
| 39 as_string_[0] = 0; | 32 as_string_[0] = 0; |
| 40 } | 33 } |
| 41 socklen_t salen = GetAddrLength(*reinterpret_cast<RawAddr*>(sa)); | 34 socklen_t salen = GetAddrLength(*reinterpret_cast<RawAddr*>(sa)); |
| 42 memmove(reinterpret_cast<void*>(&addr_), sa, salen); | 35 memmove(reinterpret_cast<void*>(&addr_), sa, salen); |
| 43 } | 36 } |
| 44 | 37 |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 return NO_RETRY_EXPECTED(setsockopt(fd, proto, MCAST_LEAVE_GROUP, &mreq, | 576 return NO_RETRY_EXPECTED(setsockopt(fd, proto, MCAST_LEAVE_GROUP, &mreq, |
| 584 sizeof(mreq))) == 0; | 577 sizeof(mreq))) == 0; |
| 585 } | 578 } |
| 586 | 579 |
| 587 } // namespace bin | 580 } // namespace bin |
| 588 } // namespace dart | 581 } // namespace dart |
| 589 | 582 |
| 590 #endif // defined(TARGET_OS_ANDROID) | 583 #endif // defined(TARGET_OS_ANDROID) |
| 591 | 584 |
| 592 #endif // !defined(DART_IO_DISABLED) | 585 #endif // !defined(DART_IO_DISABLED) |
| OLD | NEW |