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

Side by Side Diff: base/process_util_mac.mm

Issue 19064002: Split ProcessHandle and its related routines into base/process/process_handle.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « base/process_util_linux.cc ('k') | base/process_util_openbsd.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/process_util.h" 5 #include "base/process_util.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <crt_externs.h> 8 #include <crt_externs.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <mach/mach.h> 10 #include <mach/mach.h>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 EXC_MASK_BREAKPOINT; 50 EXC_MASK_BREAKPOINT;
51 51
52 // Setting the exception port to MACH_PORT_NULL may not be entirely 52 // Setting the exception port to MACH_PORT_NULL may not be entirely
53 // kosher to restore the default exception handler, but in practice, 53 // kosher to restore the default exception handler, but in practice,
54 // it results in the exception port being set to Apple Crash Reporter, 54 // it results in the exception port being set to Apple Crash Reporter,
55 // the desired behavior. 55 // the desired behavior.
56 task_set_exception_ports(mach_task_self(), exception_mask, MACH_PORT_NULL, 56 task_set_exception_ports(mach_task_self(), exception_mask, MACH_PORT_NULL,
57 EXCEPTION_DEFAULT, THREAD_STATE_NONE); 57 EXCEPTION_DEFAULT, THREAD_STATE_NONE);
58 } 58 }
59 59
60 ProcessId GetParentProcessId(ProcessHandle process) {
61 struct kinfo_proc info;
62 size_t length = sizeof(struct kinfo_proc);
63 int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process };
64 if (sysctl(mib, 4, &info, &length, NULL, 0) < 0) {
65 DPLOG(ERROR) << "sysctl";
66 return -1;
67 }
68 if (length == 0)
69 return -1;
70 return info.kp_eproc.e_ppid;
71 }
72
73 } // namespace base 60 } // namespace base
OLDNEW
« no previous file with comments | « base/process_util_linux.cc ('k') | base/process_util_openbsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698