blob: 266858eaf5a375db468608dbff8c8e39e81b5ace [file] [log] [blame]
Elly Jonesa44d22d2012-01-05 18:05:56 -05001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Elly Jones0c016cc2011-12-19 16:19:22 -05002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Alex Vakulenko262be3f2014-07-30 15:25:50 -07005#ifndef DEBUGD_SRC_SUBPROCESS_TOOL_H_
6#define DEBUGD_SRC_SUBPROCESS_TOOL_H_
Elly Jones0c016cc2011-12-19 16:19:22 -05007
8#include <map>
Ben Chan23142892017-02-15 12:34:13 -08009#include <memory>
Elly Jones0c016cc2011-12-19 16:19:22 -050010#include <string>
11
Ben Chan657bed82014-09-02 20:40:51 -070012#include <base/macros.h>
Eric Carusocc7106c2017-04-27 14:22:42 -070013#include <brillo/errors/error.h>
Elly Jones0c016cc2011-12-19 16:19:22 -050014
Ben Chan23142892017-02-15 12:34:13 -080015#include "debugd/src/process_with_id.h"
Elly Jones0c016cc2011-12-19 16:19:22 -050016
Ben Chan23142892017-02-15 12:34:13 -080017namespace debugd {
Elly Jones0c016cc2011-12-19 16:19:22 -050018
19class SubprocessTool {
20 public:
Ben Chan78f89532014-08-29 09:35:09 -070021 SubprocessTool() = default;
22 virtual ~SubprocessTool() = default;
Elly Jones0c016cc2011-12-19 16:19:22 -050023
Mike Frysinger1250df12017-09-20 02:52:37 -040024 virtual ProcessWithId* CreateProcess(bool sandboxed = true,
25 bool allow_root_mount_ns = false);
Jorge Lucangeli Obes623f8ca2014-09-18 10:50:06 -070026
Eric Carusocc7106c2017-04-27 14:22:42 -070027 virtual bool Stop(const std::string& handle, brillo::ErrorPtr* error);
Ben Chana0011d82014-05-13 00:19:29 -070028
Elly Jones0c016cc2011-12-19 16:19:22 -050029 private:
Ben Chan23142892017-02-15 12:34:13 -080030 std::map<std::string, std::unique_ptr<ProcessWithId>> processes_;
Ben Chana0011d82014-05-13 00:19:29 -070031
Elly Jones0c016cc2011-12-19 16:19:22 -050032 DISALLOW_COPY_AND_ASSIGN(SubprocessTool);
33};
34
Ben Chana0011d82014-05-13 00:19:29 -070035} // namespace debugd
Elly Jones0c016cc2011-12-19 16:19:22 -050036
Alex Vakulenko262be3f2014-07-30 15:25:50 -070037#endif // DEBUGD_SRC_SUBPROCESS_TOOL_H_