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_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
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 Loading... |
185 struct stat buf; | 185 struct stat buf; |
186 int result = fstat(fd, &buf); | 186 int result = fstat(fd, &buf); |
187 if (result == -1) return -1; | 187 if (result == -1) return -1; |
188 if (S_ISCHR(buf.st_mode)) return File::kTerminal; | 188 if (S_ISCHR(buf.st_mode)) return File::kTerminal; |
189 if (S_ISFIFO(buf.st_mode)) return File::kPipe; | 189 if (S_ISFIFO(buf.st_mode)) return File::kPipe; |
190 if (S_ISREG(buf.st_mode)) return File::kFile; | 190 if (S_ISREG(buf.st_mode)) return File::kFile; |
191 return File::kOther; | 191 return File::kOther; |
192 } | 192 } |
193 | 193 |
194 | 194 |
195 intptr_t Socket::GetStdioHandle(int num) { | 195 intptr_t Socket::GetStdioHandle(intptr_t num) { |
196 return static_cast<intptr_t>(num); | 196 return num; |
197 } | 197 } |
198 | 198 |
199 | 199 |
200 AddressList<SocketAddress>* Socket::LookupAddress(const char* host, | 200 AddressList<SocketAddress>* Socket::LookupAddress(const char* host, |
201 int type, | 201 int type, |
202 OSError** os_error) { | 202 OSError** os_error) { |
203 // Perform a name lookup for a host name. | 203 // Perform a name lookup for a host name. |
204 struct addrinfo hints; | 204 struct addrinfo hints; |
205 memset(&hints, 0, sizeof(hints)); | 205 memset(&hints, 0, sizeof(hints)); |
206 hints.ai_family = SocketAddress::FromType(type); | 206 hints.ai_family = SocketAddress::FromType(type); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 IPPROTO_TCP, | 416 IPPROTO_TCP, |
417 TCP_NODELAY, | 417 TCP_NODELAY, |
418 reinterpret_cast<char *>(&on), | 418 reinterpret_cast<char *>(&on), |
419 sizeof(on))) == 0; | 419 sizeof(on))) == 0; |
420 } | 420 } |
421 | 421 |
422 } // namespace bin | 422 } // namespace bin |
423 } // namespace dart | 423 } // namespace dart |
424 | 424 |
425 #endif // defined(TARGET_OS_LINUX) | 425 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |