-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.cc
35 lines (26 loc) · 1.06 KB
/
config.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// 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/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.
CHECK(config_);
}
Config::~Config() {
container_config_destroy(config_);
}
void Config::AddHook(minijail_hook_event_t event,
libcontainer::HookCallback callback) {
container_config_add_hook(config_, event, std::move(callback));
}
} // namespace libcontainer