blob: 70c19fb638643a19cba2cb9f8cd369c9f28e29f0 [file] [log] [blame]
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcontainer/config.h"
#include <utility>
#include <base/callback.h>
#include <base/check.h>
#include <base/logging.h>
// TODO(lhchavez): Remove this once container_config only holds a pointer to
// libcontainer::Config.
extern void container_config_add_hook(struct container_config* c,
minijail_hook_event_t event,
libcontainer::HookCallback callback);
namespace libcontainer {
Config::Config() : config_(container_config_create()) {
// container_config_create() allocates using std::nothrow, so we need to
// explicitly call abort(2) when allocation fails.
Config::~Config() {
void Config::AddHook(minijail_hook_event_t event,
libcontainer::HookCallback callback) {
container_config_add_hook(config_, event, std::move(callback));
} // namespace libcontainer