summaryrefslogtreecommitdiff
path: root/adb/sysdeps/errno.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2016-12-05 13:16:02 -0800
committerJosh Gao <jmgao@google.com>2016-12-05 13:16:02 -0800
commitafa4b5d6eb45bbee8671a1bb93ea70506fb326e3 (patch)
tree1c4900d798817ecdf6af7bc0e11f12c0083bd2a7 /adb/sysdeps/errno.cpp
parent43c02b27cd50a75f0fecb44e56a9bf32c6923aef (diff)
Revert "adb: extend sync protocol's stat support."
This reverts commit d6d5c38469203a63c686517d765a7e6d2bc24656.
Diffstat (limited to 'adb/sysdeps/errno.cpp')
-rw-r--r--adb/sysdeps/errno.cpp74
1 files changed, 0 insertions, 74 deletions
diff --git a/adb/sysdeps/errno.cpp b/adb/sysdeps/errno.cpp
deleted file mode 100644
index 0f7f58ad67..0000000000
--- a/adb/sysdeps/errno.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "sysdeps/errno.h"
-
-#include <errno.h>
-
-#include <thread>
-#include <unordered_map>
-
-#include "adb.h"
-
-#if defined(_WIN32)
-#define ETXTBSY EBUSY
-#endif
-
-static std::unordered_map<int, int> initialize_translations() {
- std::unordered_map<int, int> translations;
-#if defined(__linux__)
-#define ERRNO_VALUE(error_name, linux_value) static_assert((error_name) == (linux_value), "")
-#else
-#define ERRNO_VALUE(error_name, linux_value) \
- translations.insert(std::make_pair((linux_value), (error_name)))
-#endif
- // Untranslated errno values returned by open: EDQUOT, ENODEV, ENXIO, EWOULDBLOCK
- ERRNO_VALUE(EACCES, 13);
- ERRNO_VALUE(EEXIST, 17);
- ERRNO_VALUE(EFAULT, 14);
- ERRNO_VALUE(EFBIG, 27);
- ERRNO_VALUE(EINTR, 4);
- ERRNO_VALUE(EINVAL, 22);
- ERRNO_VALUE(EIO, 5);
- ERRNO_VALUE(EISDIR, 21);
- ERRNO_VALUE(ELOOP, 40);
- ERRNO_VALUE(EMFILE, 24);
- ERRNO_VALUE(ENAMETOOLONG, 36);
- ERRNO_VALUE(ENFILE, 23);
- ERRNO_VALUE(ENOENT, 2);
- ERRNO_VALUE(ENOMEM, 12);
- ERRNO_VALUE(ENOSPC, 28);
- ERRNO_VALUE(ENOTDIR, 20);
- ERRNO_VALUE(EOVERFLOW, 75);
- ERRNO_VALUE(EPERM, 1);
- ERRNO_VALUE(EROFS, 30);
- ERRNO_VALUE(ETXTBSY, 26);
- return translations;
-}
-
-int translate_linux_errno(int error) {
-#if defined(__linux__)
- UNUSED(initialize_translations);
- return error;
-#else
- static std::unordered_map<int, int> translations = initialize_translations();
- auto it = translations.find(error);
- if (it != translations.end()) {
- return it->second;
- }
- fatal("received unexpected remote errno: %d", error);
-#endif
-}