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

Unified Diff: sandbox/mac/seatbelt.h

Issue 2914693002: Add IsSandboxed() function to seatbelt wrapper. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « sandbox/mac/sandbox_mac_compiler_unittest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/mac/seatbelt.h
diff --git a/sandbox/mac/seatbelt.h b/sandbox/mac/seatbelt.h
index 2a5db08e4b6f3a38b9c19eac383fb62cab6a52b5..af935d7e3586d1689572cee9692ba18fd72a3897 100644
--- a/sandbox/mac/seatbelt.h
+++ b/sandbox/mac/seatbelt.h
@@ -5,11 +5,40 @@
#ifndef SANDBOX_MAC_SEATBELT_H_
#define SANDBOX_MAC_SEATBELT_H_
+#include <sys/types.h>
#include <cstdint>
#include "base/macros.h"
#include "sandbox/mac/seatbelt_export.h"
+extern "C" {
+
+enum sandbox_filter_type {
Robert Sesek 2017/05/31 17:31:08 Why is this extern C? I don't see this in /usr/inc
+ SANDBOX_FILTER_NONE,
+ SANDBOX_FILTER_PATH,
+ SANDBOX_FILTER_GLOBAL_NAME,
+ SANDBOX_FILTER_LOCAL_NAME,
+ SANDBOX_FILTER_APPLEEVENT_DESTINATION,
+ SANDBOX_FILTER_RIGHT_NAME,
+ SANDBOX_FILTER_PREFERENCE_DOMAIN,
+ SANDBOX_FILTER_KEXT_BUNDLE_ID,
+ SANDBOX_FILTER_INFO_TYPE,
+ SANDBOX_FILTER_NOTIFICATION
+};
+
+extern const enum sandbox_filter_type SANDBOX_CHECK_NO_REPORT;
+extern const enum sandbox_filter_type SANDBOX_CHECK_CANONICAL;
+
+// Not deprecated. The canonical usage to test if sandboxed is
+// sandbox_check(getpid(), NULL, SANDBOX_FILTER_NONE), which returns
+// 1 if sandboxed.
+int sandbox_check(pid_t pid,
Robert Sesek 2017/05/31 17:31:08 Rather than exposing this as a C function, let's w
Greg K 2017/05/31 17:36:25 I wanted to do this, but I'm not sure how to pass
Robert Sesek 2017/05/31 18:09:58 Argh yeah the varargs is frustrating. Unless there
Greg K 2017/05/31 18:14:37 Right now I only plan to use it to check if it's s
Robert Sesek 2017/05/31 18:19:08 That sounds good. Keeping APIs minimal is always t
Greg K 2017/06/01 18:42:08 Done.
+ const char* operation,
+ sandbox_filter_type type,
+ ...);
+
+}; // extern "C"
+
namespace sandbox {
// This class exists because OS X deprecated the sandbox functions,
« no previous file with comments | « sandbox/mac/sandbox_mac_compiler_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698