OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/linux/seccomp-bpf/die.h" | |
6 #include "sandbox/linux/seccomp-bpf/errorcode.h" | 5 #include "sandbox/linux/seccomp-bpf/errorcode.h" |
7 | 6 |
| 7 #include "sandbox/linux/seccomp-bpf/die.h" |
| 8 #include "sandbox/linux/seccomp-bpf/linux_seccomp.h" |
| 9 |
8 namespace sandbox { | 10 namespace sandbox { |
9 | 11 |
| 12 ErrorCode::ErrorCode() : error_type_(ET_INVALID), err_(SECCOMP_RET_INVALID) { |
| 13 } |
| 14 |
10 ErrorCode::ErrorCode(int err) { | 15 ErrorCode::ErrorCode(int err) { |
11 switch (err) { | 16 switch (err) { |
12 case ERR_ALLOWED: | 17 case ERR_ALLOWED: |
13 err_ = SECCOMP_RET_ALLOW; | 18 err_ = SECCOMP_RET_ALLOW; |
14 error_type_ = ET_SIMPLE; | 19 error_type_ = ET_SIMPLE; |
15 break; | 20 break; |
16 case ERR_MIN_ERRNO... ERR_MAX_ERRNO: | 21 case ERR_MIN_ERRNO... ERR_MAX_ERRNO: |
17 err_ = SECCOMP_RET_ERRNO + err; | 22 err_ = SECCOMP_RET_ERRNO + err; |
18 error_type_ = ET_SIMPLE; | 23 error_type_ = ET_SIMPLE; |
19 break; | 24 break; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } else { | 103 } else { |
99 return false; | 104 return false; |
100 } | 105 } |
101 } else { | 106 } else { |
102 SANDBOX_DIE("Corrupted ErrorCode"); | 107 SANDBOX_DIE("Corrupted ErrorCode"); |
103 } | 108 } |
104 } | 109 } |
105 } | 110 } |
106 | 111 |
107 } // namespace sandbox | 112 } // namespace sandbox |
OLD | NEW |