blob: 27bf4876ba302f32189d414d3223a7d5d1d8f836 [file] [log] [blame]
Mike Frysinger50e31fa2018-01-19 18:59:49 -05001/* Copyright 2016 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 */
Jorge Lucangeli Obesd50f8192016-07-14 15:59:59 -04005
Chirantan Ekbote59e47372017-07-12 11:22:01 -07006#ifndef _SCOPED_MINIJAIL_H_
7#define _SCOPED_MINIJAIL_H_
8
Jorge Lucangeli Obesd50f8192016-07-14 15:59:59 -04009#include <memory>
10
11#include "libminijail.h"
12
13namespace {
14struct ScopedMinijailDeleter {
15 inline void operator()(minijail *j) const {
16 if (j) {
17 minijail_destroy(j);
18 }
19 }
20};
21}
22
23using ScopedMinijail = std::unique_ptr<minijail, ScopedMinijailDeleter>;
Chirantan Ekbote59e47372017-07-12 11:22:01 -070024
25#endif /* _SCOPED_MINIJAIL_H_ */