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

Side by Side Diff: util/mach/mach_extensions.cc

Issue 577293002: Use task_t, thread_t, and exception_handler_t uniformly (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "util/mach/mach_extensions.h" 15 #include "util/mach/mach_extensions.h"
16 16
17 #include <AvailabilityMacros.h> 17 #include <AvailabilityMacros.h>
18 #include <pthread.h> 18 #include <pthread.h>
19 19
20 #include "util/mac/mac_util.h" 20 #include "util/mac/mac_util.h"
21 21
22 namespace crashpad { 22 namespace crashpad {
23 23
24 mach_port_t MachThreadSelf() { 24 thread_t MachThreadSelf() {
25 // The pthreads library keeps its own copy of the mach_port_t. Using it does 25 // The pthreads library keeps its own copy of the thread port. Using it does
26 // not increment its reference count. 26 // not increment its reference count.
27 return pthread_mach_thread_np(pthread_self()); 27 return pthread_mach_thread_np(pthread_self());
28 } 28 }
29 29
30 exception_mask_t ExcMaskAll() { 30 exception_mask_t ExcMaskAll() {
31 // This is necessary because of the way that the kernel validates 31 // This is necessary because of the way that the kernel validates
32 // exception_mask_t arguments to 32 // exception_mask_t arguments to
33 // {host,task,thread}_{get,set,swap}_exception_ports(). It is strict, 33 // {host,task,thread}_{get,set,swap}_exception_ports(). It is strict,
34 // rejecting attempts to operate on any bits that it does not recognize. See 34 // rejecting attempts to operate on any bits that it does not recognize. See
35 // 10.9.4 xnu-2422.110.17/osfmk/mach/ipc_host.c and 35 // 10.9.4 xnu-2422.110.17/osfmk/mach/ipc_host.c and
(...skipping 26 matching lines...) Expand all
62 } 62 }
63 #endif 63 #endif
64 64
65 // 10.9 added EXC_MASK_GUARD. See 10.9.4 65 // 10.9 added EXC_MASK_GUARD. See 10.9.4
66 // xnu-2422.110.17/osfmk/mach/exception_types.h. 66 // xnu-2422.110.17/osfmk/mach/exception_types.h.
67 const exception_mask_t kExcMaskAll_10_9 = kExcMaskAll_10_8 | EXC_MASK_GUARD; 67 const exception_mask_t kExcMaskAll_10_9 = kExcMaskAll_10_8 | EXC_MASK_GUARD;
68 return kExcMaskAll_10_9; 68 return kExcMaskAll_10_9;
69 } 69 }
70 70
71 } // namespace crashpad 71 } // namespace crashpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698