OLD | NEW |
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 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 &errno, | 164 &errno, |
165 reinterpret_cast<socklen_t*>(&len)); | 165 reinterpret_cast<socklen_t*>(&len)); |
166 os_error->SetCodeAndMessage(OSError::kSystem, errno); | 166 os_error->SetCodeAndMessage(OSError::kSystem, errno); |
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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 IPPROTO_TCP, | 394 IPPROTO_TCP, |
395 TCP_NODELAY, | 395 TCP_NODELAY, |
396 reinterpret_cast<char *>(&on), | 396 reinterpret_cast<char *>(&on), |
397 sizeof(on))) == 0; | 397 sizeof(on))) == 0; |
398 } | 398 } |
399 | 399 |
400 } // namespace bin | 400 } // namespace bin |
401 } // namespace dart | 401 } // namespace dart |
402 | 402 |
403 #endif // defined(TARGET_OS_MACOS) | 403 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |