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

Unified Diff: mojo/services/native_support/public/interfaces/process.mojom

Issue 1321253010: Add a "native_support" service. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix android? Created 5 years, 3 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 | « mojo/services/native_support/public/interfaces/BUILD.gn ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/native_support/public/interfaces/process.mojom
diff --git a/mojo/services/native_support/public/interfaces/process.mojom b/mojo/services/native_support/public/interfaces/process.mojom
new file mode 100644
index 0000000000000000000000000000000000000000..ca4010c864a7116f97bd7b9a012f48550c9bd0b3
--- /dev/null
+++ b/mojo/services/native_support/public/interfaces/process.mojom
@@ -0,0 +1,65 @@
+// Copyright 2015 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.
+
+[DartPackage="mojo_services"]
+module native_support;
+
+import "files/public/interfaces/file.mojom";
+import "files/public/interfaces/types.mojom";
+
+// Interface for dealing with (e.g., starting) "native" processes.
+interface Process {
+ // Spawns a process, optionally redirecting stdin/stdout/stderr from/to the
+ // corresponding |mojo.files.File| (if null, redirects from/to /dev/null).
+ // |path| is the path to the binary to execute; |argv| is the argv to give to
+ // the process (if null, it just takes |argv[0]| to be |path| with no other
+ // arguments); |envp| is the environment to give to the process, consisting of
+ // an array of strings of the form "NAME=value" (if null, simply inherits the
+ // environment from the parent, whatever that is).
+ // TODO(vtl): This should really take an array of |mojo.files.File|s (or maybe
+ // two, one for input and the other for output), corresponding to FDs, but the
+ // C++ bindings generator doesn't support arrays of interfaces yet
+ // (https://github.com/domokit/mojo/issues/412).
+ // TODO(vtl): The implementation currently ignores |argv[0]| and always fills
+ // it in with |path|.
+ // TODO(vtl): Inheriting |envp| from the parent is somewhat dubious, and
+ // there's also no way to just specify modifications or limit inheritance.
+ Spawn(string path,
+ array<string>? argv,
+ array<string>? envp,
+ mojo.files.File? stdin_file,
+ mojo.files.File? stdout_file,
+ mojo.files.File? stderr_file,
+ ProcessController& process_controller) => (mojo.files.Error error);
+ // Like |Spawn()|, except that the child's stdin/stdout/stderr are redirected
+ // from/to |terminal_file|, which should be a |mojo.files.File| for a terminal
+ // (i.e., one that behaves like one, including responding to the required
+ // ioctls).
+ SpawnWithTerminal(
+ string path,
+ array<string>? argv,
+ array<string>? envp,
+ mojo.files.File terminal_file,
+ ProcessController& process_controller) => (mojo.files.Error error);
+};
+
+// Interface for controlling a process started by one of |Process|'s facilities
+// (in particular, |Spawn()| or |SpawnWithTerminal()|).
+// TODO(vtl): What does it do if this is closed (without being detached)? Kill
+// with SIGHUP?
+interface ProcessController {
+ // Wait for process completion.
+ // TODO(vtl): Add options (e.g., timeout)?
+ Wait() => (mojo.files.Error error, int32 exit_status);
+
+ // Kill the process with the given signal (note: does not wait). |signal|
+ // should be nonnegative. This is not valid after a successful call to
+ // |Wait()|.
+ // TODO(vtl): Add constants for signals. (For standard POSIX signals, the
+ // values should be the same as the POSIX-specified values, so using POSIX
+ // macros for the values should always be OK.)
+ Kill(int32 signal) => (mojo.files.Error error);
+
+ // TODO(vtl): Add a "Detach()"?
+};
« no previous file with comments | « mojo/services/native_support/public/interfaces/BUILD.gn ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698