| Index: sandbox/linux/seccomp-bpf/die.cc
|
| diff --git a/sandbox/linux/seccomp-bpf/die.cc b/sandbox/linux/seccomp-bpf/die.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b63411c0a3841499ac10611aca55c488b3a90b47
|
| --- /dev/null
|
| +++ b/sandbox/linux/seccomp-bpf/die.cc
|
| @@ -0,0 +1,29 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "sandbox/linux/seccomp-bpf/die.h"
|
| +
|
| +
|
| +namespace playground2 {
|
| +
|
| +bool Die::CallHandler(const char *msg, const char *file, int line) {
|
| + if (!HasCustomHandler()) {
|
| + return false;
|
| + }
|
| + handlers_.back()(msg, file, line);
|
| + return true;
|
| +}
|
| +
|
| +void Die::LogToStderr(const char *msg, const char *file, int line) {
|
| + if (msg) {
|
| + char buf[40];
|
| + sprintf(buf, "%d", line);
|
| + std::string s = std::string(file) + ":" + buf + ":" + msg + "\n";
|
| + if (HANDLE_EINTR(write(2, s.c_str(), s.length()))) { }
|
| + }
|
| +}
|
| +
|
| +std::vector<Die::Handler> Die::handlers_;
|
| +
|
| +} // namespace
|
|
|