Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Unified Diff: sandbox/linux/seccomp-bpf/demo.cc

Issue 10833044: Refactored ErrorCode into it's own class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, and removed "protected" as requested by jln Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sandbox/linux/seccomp-bpf/demo.cc
diff --git a/sandbox/linux/seccomp-bpf/demo.cc b/sandbox/linux/seccomp-bpf/demo.cc
index ebedcbe99061b9d9df4740f8db15aa9f0d4ecb0f..9c1ca8b2ed31592f5fa1aec3da6bc2ab4c96d9f8 100644
--- a/sandbox/linux/seccomp-bpf/demo.cc
+++ b/sandbox/linux/seccomp-bpf/demo.cc
@@ -28,6 +28,7 @@
#include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
#include "sandbox/linux/seccomp-bpf/util.h"
+using playground2::ErrorCode;
using playground2::Sandbox;
using playground2::Util;
@@ -135,7 +136,7 @@ static intptr_t defaultHandler(const struct arch_seccomp_data& data,
return -ERR;
}
-static Sandbox::ErrorCode evaluator(int sysno) {
+static ErrorCode evaluator(int sysno) {
switch (sysno) {
#if defined(__NR_accept)
case __NR_accept: case __NR_accept4:
@@ -220,7 +221,7 @@ static Sandbox::ErrorCode evaluator(int sysno) {
case __NR_time:
case __NR_uname:
case __NR_write: case __NR_writev:
- return Sandbox::SB_ALLOWED;
+ return ErrorCode::ERR_ALLOWED;
// The following system calls are temporarily permitted. This must be
// tightened later. But we currently don't implement enough of the sandboxing
@@ -252,11 +253,11 @@ static Sandbox::ErrorCode evaluator(int sysno) {
case __NR_clone:
case __NR_munmap: case __NR_mprotect: case __NR_madvise:
case __NR_remap_file_pages:
- return Sandbox::SB_ALLOWED;
+ return ErrorCode::ERR_ALLOWED;
// Everything that isn't explicitly allowed is denied.
default:
- return Sandbox::ErrorCode(defaultHandler, NULL);
+ return Sandbox::Trap(defaultHandler, NULL);
}
}

Powered by Google App Engine
This is Rietveld 408576698