Revert "Revert "adb: extend sync protocol's stat support.""

This reverts commit afa4b5d6eb45bbee8671a1bb93ea70506fb326e3.

Add functions to translate errno to and from the linux asm-generic
values, since mips has different values.

Bug: http://b/33058958
Test: python test_device.py with both old and new adbd
Change-Id: I1a122235f3e793ed10b3bf3ad293388015134150
diff --git a/adb/transport.cpp b/adb/transport.cpp
index 132702d..7b82b19 100644
--- a/adb/transport.cpp
+++ b/adb/transport.cpp
@@ -49,6 +49,7 @@
 
 const char* const kFeatureShell2 = "shell_v2";
 const char* const kFeatureCmd = "cmd";
+const char* const kFeatureStat2 = "stat_v2";
 
 static std::string dump_packet(const char* name, const char* func, apacket* p) {
     unsigned  command = p->msg.command;
@@ -771,7 +772,8 @@
     // Local static allocation to avoid global non-POD variables.
     static const FeatureSet* features = new FeatureSet{
         kFeatureShell2,
-        kFeatureCmd
+        kFeatureCmd,
+        kFeatureStat2,
         // Increment ADB_SERVER_VERSION whenever the feature list changes to
         // make sure that the adb client and server features stay in sync
         // (http://b/24370690).