• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2016 The ChromiumOS Authors
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 #ifndef _SCOPED_MINIJAIL_H_
7 #define _SCOPED_MINIJAIL_H_
8 
9 #include <memory>
10 
11 #include "libminijail.h"
12 
13 namespace mj
14 {
15 
16 namespace internal
17 {
18 
19 struct ScopedMinijailDeleter {
operatorScopedMinijailDeleter20 	inline void operator()(minijail *j) const
21 	{
22 		if (j) {
23 			minijail_destroy(j);
24 		}
25 	}
26 };
27 
28 } // namespace internal
29 
30 } // namespace mj
31 
32 using ScopedMinijail =
33     std::unique_ptr<minijail, mj::internal::ScopedMinijailDeleter>;
34 
35 #endif /* _SCOPED_MINIJAIL_H_ */
36