Luis Hector Chavez | edec56e | 2017-09-19 15:43:53 -0700 | [diff] [blame] | 1 | // Copyright 2017 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "libcontainer/container.h" |
| 6 | |
Qijiang Fan | 713061e | 2021-03-08 15:45:12 +0900 | [diff] [blame] | 7 | #include <base/check.h> |
Luis Hector Chavez | edec56e | 2017-09-19 15:43:53 -0700 | [diff] [blame] | 8 | #include <base/logging.h> |
| 9 | |
| 10 | namespace libcontainer { |
| 11 | |
| 12 | Container::Container(base::StringPiece name, const base::FilePath& rundir) |
| 13 | : container_(container_new(name.data(), rundir.value().c_str())) { |
| 14 | // container_new() allocates using std::nothrow, so we need to explicitly |
| 15 | // call abort(2) when allocation fails. |
| 16 | CHECK(container_); |
| 17 | } |
| 18 | |
| 19 | Container::~Container() { |
| 20 | container_destroy(container_); |
| 21 | } |
| 22 | |
| 23 | } // namespace libcontainer |