Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: runtime/bin/socket_android.cc

Issue 15894004: dart:io | Fix a few bugs in the Android port of dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/bin/file_android.cc ('K') | « runtime/bin/file_android.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« runtime/bin/file_android.cc ('K') | « runtime/bin/file_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698