X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fcommon%2Fbinder_device.cpp;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fcommon%2Fbinder_device.cpp;h=892222b7d5a80d4900ec1e53c9b4a7e50a1173b1;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git
diff --git a/src/type3_AndroidCloud/anbox-master/src/anbox/common/binder_device.cpp b/src/type3_AndroidCloud/anbox-master/src/anbox/common/binder_device.cpp
new file mode 100644
index 0000000..892222b
--- /dev/null
+++ b/src/type3_AndroidCloud/anbox-master/src/anbox/common/binder_device.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2018 Canonical Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ *
+ */
+
+#include "anbox/common/binder_device.h"
+#include "anbox/common/binderfs.h"
+#include "anbox/defer_action.h"
+#include "anbox/logger.h"
+#include "anbox/utils.h"
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+namespace anbox {
+namespace common {
+std::unique_ptr BinderDevice::create(const std::string& path) {
+ return std::unique_ptr(new BinderDevice(path));
+}
+
+BinderDevice::BinderDevice(const std::string& path) :
+ path_{path} {
+ if (::chmod(path.c_str(), 0666) < 0)
+ ERROR("Failed to change permissions of binder node %s: %s", path, std::strerror(errno));
+}
+
+BinderDevice::~BinderDevice() {
+ if (::unlink(path_.c_str()) < 0)
+ ERROR("Failed to remove binder node %s: %s", path_, std::strerror(errno));
+}
+} // namespace common
+} // namespace anbox