| 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" |
| 6 #if defined(TARGET_OS_ANDROID) |
| 7 |
| 5 #include "bin/file.h" | 8 #include "bin/file.h" |
| 6 | 9 |
| 7 #include <errno.h> | 10 #include <errno.h> // NOLINT |
| 8 #include <fcntl.h> | 11 #include <fcntl.h> // NOLINT |
| 9 #include <sys/stat.h> | 12 #include <sys/stat.h> // NOLINT |
| 10 #include <unistd.h> | 13 #include <unistd.h> // NOLINT |
| 11 #include <libgen.h> | 14 #include <libgen.h> // NOLINT |
| 12 | 15 |
| 13 #include "bin/builtin.h" | 16 #include "bin/builtin.h" |
| 14 #include "bin/log.h" | 17 #include "bin/log.h" |
| 15 | 18 |
| 16 class FileHandle { | 19 class FileHandle { |
| 17 public: | 20 public: |
| 18 explicit FileHandle(int fd) : fd_(fd) { } | 21 explicit FileHandle(int fd) : fd_(fd) { } |
| 19 ~FileHandle() { } | 22 ~FileHandle() { } |
| 20 int fd() const { return fd_; } | 23 int fd() const { return fd_; } |
| 21 void set_fd(int fd) { fd_ = fd; } | 24 void set_fd(int fd) { fd_ = fd; } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 int result = fstat(fd, &buf); | 238 int result = fstat(fd, &buf); |
| 236 if (result == -1) { | 239 if (result == -1) { |
| 237 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); | 240 FATAL2("Failed stat on file descriptor %d: %s", fd, strerror(errno)); |
| 238 } | 241 } |
| 239 if (S_ISCHR(buf.st_mode)) return kTerminal; | 242 if (S_ISCHR(buf.st_mode)) return kTerminal; |
| 240 if (S_ISFIFO(buf.st_mode)) return kPipe; | 243 if (S_ISFIFO(buf.st_mode)) return kPipe; |
| 241 if (S_ISSOCK(buf.st_mode)) return kSocket; | 244 if (S_ISSOCK(buf.st_mode)) return kSocket; |
| 242 if (S_ISREG(buf.st_mode)) return kFile; | 245 if (S_ISREG(buf.st_mode)) return kFile; |
| 243 return kOther; | 246 return kOther; |
| 244 } | 247 } |
| 248 |
| 249 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |