OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sandbox/mac/seatbelt.h" | 5 #include "sandbox/mac/seatbelt.h" |
6 | 6 |
7 extern "C" { | 7 extern "C" { |
8 #include <sandbox.h> | 8 #include <sandbox.h> |
9 | 9 |
10 int sandbox_init_with_parameters(const char* profile, | 10 int sandbox_init_with_parameters(const char* profile, |
11 uint64_t flags, | 11 uint64_t flags, |
12 const char* const parameters[], | 12 const char* const parameters[], |
13 char** errorbuf); | 13 char** errorbuf); |
14 }; | 14 }; |
15 | 15 |
16 namespace sandbox { | 16 namespace sandbox { |
17 | 17 |
18 // Initialize the static member variables. | |
19 #pragma clang diagnostic push | |
20 #pragma clang diagnostic ignored "-Wdeprecated-declarations" | |
21 const char* Seatbelt::kProfileNoInternet = kSBXProfileNoInternet; | |
22 const char* Seatbelt::kProfileNoNetwork = kSBXProfileNoNetwork; | |
23 const char* Seatbelt::kProfileNoWrite = kSBXProfileNoWrite; | |
24 const char* Seatbelt::kProfileNoWriteExceptTemporary = | |
25 kSBXProfileNoWriteExceptTemporary; | |
Robert Sesek
2016/09/23 20:47:55
Formatting here is a bit odd. Did clang-format do
Greg K
2016/09/23 21:14:05
Done.
| |
26 const char* Seatbelt::kProfilePureComputation = | |
27 kSBXProfilePureComputation; | |
28 #pragma clang diagnostic pop | |
29 | |
18 // static | 30 // static |
19 int Seatbelt::Init(const char* profile, uint64_t flags, char** errorbuf) { | 31 int Seatbelt::Init(const char* profile, uint64_t flags, char** errorbuf) { |
20 // OS X deprecated these functions, but did not provide a suitable replacement, | 32 // OS X deprecated these functions, but did not provide a suitable replacement, |
21 // so ignore the deprecation warning. | 33 // so ignore the deprecation warning. |
22 #pragma clang diagnostic push | 34 #pragma clang diagnostic push |
23 #pragma clang diagnostic ignored "-Wdeprecated-declarations" | 35 #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
24 return ::sandbox_init(profile, flags, errorbuf); | 36 return ::sandbox_init(profile, flags, errorbuf); |
25 #pragma clang diagnostic pop | 37 #pragma clang diagnostic pop |
26 } | 38 } |
27 | 39 |
28 // static | 40 // static |
29 int Seatbelt::InitWithParams(const char* profile, | 41 int Seatbelt::InitWithParams(const char* profile, |
30 uint64_t flags, | 42 uint64_t flags, |
31 const char* const parameters[], | 43 const char* const parameters[], |
32 char** errorbuf) { | 44 char** errorbuf) { |
33 return ::sandbox_init_with_parameters(profile, flags, parameters, errorbuf); | 45 return ::sandbox_init_with_parameters(profile, flags, parameters, errorbuf); |
34 } | 46 } |
35 | 47 |
36 // static | 48 // static |
37 void Seatbelt::FreeError(char* errorbuf) { | 49 void Seatbelt::FreeError(char* errorbuf) { |
38 // OS X deprecated these functions, but did not provide a suitable replacement, | 50 // OS X deprecated these functions, but did not provide a suitable replacement, |
39 // so ignore the deprecation warning. | 51 // so ignore the deprecation warning. |
40 #pragma clang diagnostic push | 52 #pragma clang diagnostic push |
41 #pragma clang diagnostic ignored "-Wdeprecated-declarations" | 53 #pragma clang diagnostic ignored "-Wdeprecated-declarations" |
42 return ::sandbox_free_error(errorbuf); | 54 return ::sandbox_free_error(errorbuf); |
43 #pragma clang diagnostic pop | 55 #pragma clang diagnostic pop |
44 } | 56 } |
45 | 57 |
46 } // namespace sandbox | 58 } // namespace sandbox |
OLD | NEW |