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

Unified Diff: util/mach/mach_extensions.cc

Issue 809103002: Add NewMachPort() and its test, and switch call sites to use it (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years 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 | « util/mach/mach_extensions.h ('k') | util/mach/mach_extensions_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mach/mach_extensions.cc
diff --git a/util/mach/mach_extensions.cc b/util/mach/mach_extensions.cc
index 86ca7bf24b6cb19a80f5461e0d6a011f5324b8e9..63aae31d9ce92253c1df8b6a9bc2a265f3ba14e6 100644
--- a/util/mach/mach_extensions.cc
+++ b/util/mach/mach_extensions.cc
@@ -17,6 +17,7 @@
#include <AvailabilityMacros.h>
#include <pthread.h>
+#include "base/mac/mach_logging.h"
#include "util/mac/mac_util.h"
namespace crashpad {
@@ -27,6 +28,13 @@ thread_t MachThreadSelf() {
return pthread_mach_thread_np(pthread_self());
}
+mach_port_t NewMachPort(mach_port_right_t right) {
+ mach_port_t port = MACH_PORT_NULL;
+ kern_return_t kr = mach_port_allocate(mach_task_self(), right, &port);
+ MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr) << "mach_port_allocate";
+ return port;
+}
+
exception_mask_t ExcMaskAll() {
// This is necessary because of the way that the kernel validates
// exception_mask_t arguments to
« no previous file with comments | « util/mach/mach_extensions.h ('k') | util/mach/mach_extensions_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698