Mike Frysinger | 50e31fa | 2018-01-19 18:59:49 -0500 | [diff] [blame] | 1 | /* 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 Obes | d50f819 | 2016-07-14 15:59:59 -0400 | [diff] [blame] | 5 | |
Chirantan Ekbote | 59e4737 | 2017-07-12 11:22:01 -0700 | [diff] [blame] | 6 | #ifndef _SCOPED_MINIJAIL_H_ |
| 7 | #define _SCOPED_MINIJAIL_H_ |
| 8 | |
Jorge Lucangeli Obes | d50f819 | 2016-07-14 15:59:59 -0400 | [diff] [blame] | 9 | #include <memory> |
| 10 | |
| 11 | #include "libminijail.h" |
| 12 | |
| 13 | namespace { |
| 14 | struct ScopedMinijailDeleter { |
| 15 | inline void operator()(minijail *j) const { |
| 16 | if (j) { |
| 17 | minijail_destroy(j); |
| 18 | } |
| 19 | } |
| 20 | }; |
| 21 | } |
| 22 | |
| 23 | using ScopedMinijail = std::unique_ptr<minijail, ScopedMinijailDeleter>; |
Chirantan Ekbote | 59e4737 | 2017-07-12 11:22:01 -0700 | [diff] [blame] | 24 | |
| 25 | #endif /* _SCOPED_MINIJAIL_H_ */ |