diff options
Diffstat (limited to 'chromium/sandbox/linux/seccomp-bpf/trap.h')
-rw-r--r-- | chromium/sandbox/linux/seccomp-bpf/trap.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/chromium/sandbox/linux/seccomp-bpf/trap.h b/chromium/sandbox/linux/seccomp-bpf/trap.h index 334a30d965a..adc6d7f5e22 100644 --- a/chromium/sandbox/linux/seccomp-bpf/trap.h +++ b/chromium/sandbox/linux/seccomp-bpf/trap.h @@ -12,6 +12,7 @@ #include <vector> #include "base/basictypes.h" +#include "sandbox/sandbox_export.h" namespace sandbox { @@ -25,7 +26,7 @@ class ErrorCode; // Preferably, that means that no other threads should be running at that // time. For the purposes of our sandbox, this assertion should always be // true. Threads are incompatible with the seccomp sandbox anyway. -class Trap { +class SANDBOX_EXPORT Trap { public: // TrapFnc is a pointer to a function that handles Seccomp traps in // user-space. The seccomp policy can request that a trap handler gets @@ -62,10 +63,6 @@ class Trap { static ErrorCode ErrorCodeFromTrapId(uint16_t id); private: - // The destructor is unimplemented. Don't ever attempt to destruct this - // object. It'll break subsequent system calls that trigger a SIGSYS. - ~Trap(); - struct TrapKey { TrapKey(TrapFnc f, const void* a, bool s) : fnc(f), aux(a), safe(s) {} TrapFnc fnc; @@ -75,6 +72,14 @@ class Trap { }; typedef std::map<TrapKey, uint16_t> TrapIds; + // Our constructor is private. A shared global instance is created + // automatically as needed. + Trap(); + + // The destructor is unimplemented. Don't ever attempt to destruct this + // object. It'll break subsequent system calls that trigger a SIGSYS. + ~Trap(); + // We only have a very small number of methods. We opt to make them static // and have them internally call GetInstance(). This is a little more // convenient than having each caller obtain short-lived reference to the @@ -104,11 +109,9 @@ class Trap { size_t trap_array_capacity_; // Currently allocated capacity of array bool has_unsafe_traps_; // Whether unsafe traps have been enabled - // Our constructor is private. A shared global instance is created - // automatically as needed. // Copying and assigning is unimplemented. It doesn't make sense for a // singleton. - DISALLOW_IMPLICIT_CONSTRUCTORS(Trap); + DISALLOW_COPY_AND_ASSIGN(Trap); }; } // namespace sandbox |