| Index: runtime/bin/socket_android.cc
|
| diff --git a/runtime/bin/socket_android.cc b/runtime/bin/socket_android.cc
|
| index 8bb8f076e2485de602500a5822bbb8ac4d0f884e..20715a39b06375f89a4b5ab9d8b6098ddf2c8fdf 100644
|
| --- a/runtime/bin/socket_android.cc
|
| +++ b/runtime/bin/socket_android.cc
|
| @@ -9,12 +9,14 @@
|
| #include <stdio.h> // NOLINT
|
| #include <stdlib.h> // NOLINT
|
| #include <string.h> // NOLINT
|
| +#include <sys/stat.h> // NOLINT
|
| #include <unistd.h> // NOLINT
|
| #include <netinet/tcp.h> // NOLINT
|
|
|
| -#include "bin/socket.h"
|
| #include "bin/fdutils.h"
|
| +#include "bin/file.h"
|
| #include "bin/log.h"
|
| +#include "bin/socket.h"
|
|
|
|
|
| namespace dart {
|
| @@ -152,6 +154,17 @@ void Socket::GetError(intptr_t fd, OSError* os_error) {
|
| }
|
|
|
|
|
| +int Socket::GetType(intptr_t fd) {
|
| + struct stat buf;
|
| + int result = fstat(fd, &buf);
|
| + if (result == -1) return -1;
|
| + if (S_ISCHR(buf.st_mode)) return File::kTerminal;
|
| + if (S_ISFIFO(buf.st_mode)) return File::kPipe;
|
| + if (S_ISREG(buf.st_mode)) return File::kFile;
|
| + return File::kOther;
|
| +}
|
| +
|
| +
|
| intptr_t Socket::GetStdioHandle(int num) {
|
| return static_cast<intptr_t>(num);
|
| }
|
|
|