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 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 getsockopt(fd, | 161 getsockopt(fd, |
162 SOL_SOCKET, | 162 SOL_SOCKET, |
163 SO_ERROR, | 163 SO_ERROR, |
164 reinterpret_cast<void*>(&errorNumber), | 164 reinterpret_cast<void*>(&errorNumber), |
165 &len); | 165 &len); |
166 os_error->SetCodeAndMessage(OSError::kSystem, errorNumber); | 166 os_error->SetCodeAndMessage(OSError::kSystem, errorNumber); |
167 } | 167 } |
168 | 168 |
169 | 169 |
170 int Socket::GetType(intptr_t fd) { | 170 int Socket::GetType(intptr_t fd) { |
171 struct stat64 buf; | 171 struct stat buf; |
172 int result = fstat64(fd, &buf); | 172 int result = fstat(fd, &buf); |
173 if (result == -1) return -1; | 173 if (result == -1) return -1; |
174 if (S_ISCHR(buf.st_mode)) return File::kTerminal; | 174 if (S_ISCHR(buf.st_mode)) return File::kTerminal; |
175 if (S_ISFIFO(buf.st_mode)) return File::kPipe; | 175 if (S_ISFIFO(buf.st_mode)) return File::kPipe; |
176 if (S_ISREG(buf.st_mode)) return File::kFile; | 176 if (S_ISREG(buf.st_mode)) return File::kFile; |
177 return File::kOther; | 177 return File::kOther; |
178 } | 178 } |
179 | 179 |
180 | 180 |
181 intptr_t Socket::GetStdioHandle(intptr_t num) { | 181 intptr_t Socket::GetStdioHandle(intptr_t num) { |
182 Socket::SetNonBlocking(num); | 182 Socket::SetNonBlocking(num); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 IPPROTO_TCP, | 362 IPPROTO_TCP, |
363 TCP_NODELAY, | 363 TCP_NODELAY, |
364 reinterpret_cast<char *>(&on), | 364 reinterpret_cast<char *>(&on), |
365 sizeof(on))) == 0; | 365 sizeof(on))) == 0; |
366 } | 366 } |
367 | 367 |
368 } // namespace bin | 368 } // namespace bin |
369 } // namespace dart | 369 } // namespace dart |
370 | 370 |
371 #endif // defined(TARGET_OS_ANDROID) | 371 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |