Index: sandbox/linux/seccomp-bpf/kernel_return_value_helpers.h |
diff --git a/sandbox/linux/seccomp-bpf/kernel_return_value_helpers.h b/sandbox/linux/seccomp-bpf/kernel_return_value_helpers.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..117607034eef926ee66370238c90a29e14f49611 |
--- /dev/null |
+++ b/sandbox/linux/seccomp-bpf/kernel_return_value_helpers.h |
@@ -0,0 +1,23 @@ |
+// Copyright 2014 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. |
+ |
+#ifndef SANDBOX_LINUX_SERVICES_KERNEL_RETURN_VALUE_HELPERS_H__ |
jln (very slow on Chromium)
2014/06/03 01:00:33
Only one trailing "_".
nedeljko
2014/06/03 15:32:18
I looked in most of the *.h files in seccomp-bpf f
|
+#define SANDBOX_LINUX_SERVICES_KERNEL_RETURN_VALUE_HELPERS_H__ |
+ |
+#include <signal.h> |
+ |
+namespace sandbox { |
+ |
+// In order for errno to be converted to the value that kernel returns to |
+// indicate an error in syscall, errno needs to be negated on Intel/Arm. On |
+// Mips this is not the case since Mips has different mechanism for indicating |
+// error. |
+int ErrnoToKernelRet(int kernel_ret); |
jln (very slow on Chromium)
2014/06/03 01:00:33
The argument is an errno, not |kernel_ret|
The do
nedeljko
2014/06/03 15:32:18
Done.
|
+ |
+// The return value from the syscall is written to appropriate register. |
jln (very slow on Chromium)
2014/06/03 01:00:33
// Set the registers in |ctx| to match what they w
nedeljko
2014/06/03 15:32:18
Done.
|
+void PutValueInUcontext(int ret_val, ucontext_t* ctx); |
+ |
+} // namespace sandbox |
+ |
+#endif // SANDBOX_LINUX_SERVICES_KERNEL_RETURN_VALUE_HELPERS_H__ |