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

Side by Side Diff: base/process/process_handle_freebsd.cc

Issue 185713005: Add support for FreeBSD in base/ , base/process/ , and base/threading so that the bootstrap binary … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/process_handle.h" 5 #include "base/process/process_handle.h"
6 6
7 #include <sys/sysctl.h> 7 #include <sys/sysctl.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <sys/user.h>
9 #include <unistd.h> 10 #include <unistd.h>
10 11
11 namespace base { 12 namespace base {
12 13
13 ProcessId GetParentProcessId(ProcessHandle process) { 14 ProcessId GetParentProcessId(ProcessHandle process) {
14 struct kinfo_proc info; 15 struct kinfo_proc info;
15 size_t length; 16 size_t length;
16 int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process }; 17 int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process };
17 18
18 if (sysctl(mib, arraysize(mib), &info, &length, NULL, 0) < 0) 19 if (sysctl(mib, arraysize(mib), &info, &length, NULL, 0) < 0)
(...skipping 11 matching lines...) Expand all
30 31
31 if (sysctl(mib, arraysize(mib), pathname, &length, NULL, 0) < 0 || 32 if (sysctl(mib, arraysize(mib), pathname, &length, NULL, 0) < 0 ||
32 length == 0) { 33 length == 0) {
33 return FilePath(); 34 return FilePath();
34 } 35 }
35 36
36 return FilePath(std::string(pathname)); 37 return FilePath(std::string(pathname));
37 } 38 }
38 39
39 } // namespace base 40 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698