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 */ 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 namespace internal { 16 17 struct ScopedMinijailDeleter { operatorScopedMinijailDeleter18 inline void operator()(minijail *j) const { 19 if (j) { 20 minijail_destroy(j); 21 } 22 } 23 }; 24 25 } // namespace internal 26 27 } // namespace mj 28 29 using ScopedMinijail = 30 std::unique_ptr<minijail, mj::internal::ScopedMinijailDeleter>; 31 32 #endif /* _SCOPED_MINIJAIL_H_ */ 33