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

Unified Diff: sandbox/linux/seccomp-bpf/bpf_tests.h

Issue 12223109: SECCOMP-BPF: Refactor the BPF sandbox API to use fewer "static" fields and methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make sure unnamed namespaces are always top-level Created 7 years, 10 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/bpf_tests.h
diff --git a/sandbox/linux/seccomp-bpf/bpf_tests.h b/sandbox/linux/seccomp-bpf/bpf_tests.h
index d631428b85e2e97a49fea8cb4860087a3e3534bd..680ece601ff636f2ee94fd6c7a18235657dfa340 100644
--- a/sandbox/linux/seccomp-bpf/bpf_tests.h
+++ b/sandbox/linux/seccomp-bpf/bpf_tests.h
@@ -5,6 +5,10 @@
#ifndef SANDBOX_LINUX_SECCOMP_BPF_BPF_TESTS_H__
#define SANDBOX_LINUX_SECCOMP_BPF_BPF_TESTS_H__
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
#include "sandbox/linux/tests/unit_tests.h"
#include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
@@ -81,17 +85,19 @@ class BpfTests : public UnitTests {
playground2::Sandbox::STATUS_AVAILABLE);
// Initialize and then start the sandbox with our custom policy
- playground2::Sandbox::set_proc_fd(proc_fd);
- playground2::Sandbox::SetSandboxPolicy(arg->policy(), &arg->aux_);
- playground2::Sandbox::StartSandbox();
+ playground2::Sandbox sandbox;
+ sandbox.set_proc_fd(proc_fd);
+ sandbox.SetSandboxPolicy(arg->policy(), &arg->aux_);
+ sandbox.Sandbox::StartSandbox();
arg->test()(arg->aux_);
} else {
// Call the compiler and verify the policy. That's the least we can do,
// if we don't have kernel support.
- playground2::Sandbox::SetSandboxPolicy(arg->policy(), &arg->aux_);
+ playground2::Sandbox sandbox;
+ sandbox.SetSandboxPolicy(arg->policy(), &arg->aux_);
playground2::Sandbox::Program *program =
- playground2::Sandbox::AssembleFilter(true /* force_verification */);
+ sandbox.AssembleFilter(true /* force_verification */);
delete program;
sandbox::UnitTests::IgnoreThisTest();
}

Powered by Google App Engine
This is Rietveld 408576698