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

Unified Diff: base/android/fifo_utils.cc

Issue 16599008: Move CreateFIFO() and RedirectStream() from testing/android/ to base/android/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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
« no previous file with comments | « base/android/fifo_utils.h ('k') | base/base.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/fifo_utils.cc
diff --git a/base/android/fifo_utils.cc b/base/android/fifo_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..86997fa02ef1b89008df2ebf48647a4f706f6c00
--- /dev/null
+++ b/base/android/fifo_utils.cc
@@ -0,0 +1,25 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/android/fifo_utils.h"
+
+#include <sys/stat.h>
+
+#include "base/files/file_path.h"
+
+namespace base {
+namespace android {
+
+bool CreateFIFO(const FilePath& path, int mode) {
+ // Default permissions for mkfifo() is ignored, chmod() is required.
+ return mkfifo(path.value().c_str(), mode) == 0 &&
+ chmod(path.value().c_str(), mode) == 0;
+}
+
+bool RedirectStream(FILE* stream, const FilePath& path, const char* mode) {
+ return freopen(path.value().c_str(), mode, stream) != NULL;
+}
+
+} // namespace android
+} // namespace base
« no previous file with comments | « base/android/fifo_utils.h ('k') | base/base.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698