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

Unified Diff: base/process_util_posix.cc

Issue 9176013: [ChromeOS] Add option to set controlling terminal when launching process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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/process_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_posix.cc
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index 5a1d4425bbb280f1a501c6bccfa08caf33ee1bcf..47a53c2d4c16c52b2c0de0b024b4e9550b2119d7 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -32,6 +32,10 @@
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
+#if defined(OS_CHROMEOS)
+#include <sys/ioctl.h>
+#endif
+
#if defined(OS_FREEBSD)
#include <sys/event.h>
#include <sys/ucontext.h>
@@ -677,6 +681,20 @@ bool LaunchProcess(const std::vector<std::string>& argv,
// DANGER: no calls to malloc are allowed from now on:
// http://crbug.com/36678
+#if defined(OS_CHROMEOS)
+ if (options.ctrl_terminal_fd >= 0) {
+ // Set process' controlling terminal.
+ if (HANDLE_EINTR(setsid()) != -1) {
+ if (HANDLE_EINTR(
+ ioctl(options.ctrl_terminal_fd, TIOCSCTTY, NULL)) == -1) {
+ RAW_LOG(WARNING, "ioctl(TIOCSCTTY), ctrl terminal not set");
+ }
+ } else {
+ RAW_LOG(WARNING, "setsid failed, ctrl terminal not set");
+ }
+ }
+#endif // defined(OS_CHROMEOS)
+
if (options.fds_to_remap) {
for (file_handle_mapping_vector::const_iterator
it = options.fds_to_remap->begin();
« no previous file with comments | « base/process_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698