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

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: 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..97566c97b59dac6facf864f5d3faaf3c44071588 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,17 @@ thread_t MachThreadSelf() {
return pthread_mach_thread_np(pthread_self());
}
+mach_port_t NewMachPort(mach_port_right_t right) {
+ mach_port_t port;
Robert Sesek 2014/12/17 20:06:47 = MACH_PORT_NULL, and then you can just do MACH_LO
+ kern_return_t kr = mach_port_allocate(mach_task_self(), right, &port);
+ if (kr != KERN_SUCCESS) {
+ MACH_LOG(ERROR, kr) << "mach_port_allocate";
+ return MACH_PORT_NULL;
+ }
+
+ 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