blob: 32496b1afc713de3f9e09e3f9441c1563927d189 [file] [log] [blame]
Luis Hector Chavezedec56e2017-09-19 15:43:53 -07001// 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 Fan713061e2021-03-08 15:45:12 +09007#include <base/check.h>
Luis Hector Chavezedec56e2017-09-19 15:43:53 -07008#include <base/logging.h>
9
10namespace libcontainer {
11
12Container::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
19Container::~Container() {
20 container_destroy(container_);
21}
22
23} // namespace libcontainer