1 | //===-- Procfs.h ---------------------------------------------- -*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "lldb/lldb-types.h" |
10 | #include "llvm/Support/Error.h" |
11 | #include <vector> |
12 | |
13 | namespace lldb_private { |
14 | namespace process_linux { |
15 | |
16 | /// \return |
17 | /// The content of /proc/cpuinfo and cache it if errors didn't happen. |
18 | llvm::Expected<llvm::ArrayRef<uint8_t>> GetProcfsCpuInfo(); |
19 | |
20 | /// \return |
21 | /// A list of available logical core ids given the contents of |
22 | /// /proc/cpuinfo. |
23 | llvm::Expected<std::vector<lldb::cpu_id_t>> |
24 | GetAvailableLogicalCoreIDs(llvm::StringRef cpuinfo); |
25 | |
26 | /// \return |
27 | /// A list with all the logical cores available in the system and cache it |
28 | /// if errors didn't happen. |
29 | llvm::Expected<llvm::ArrayRef<lldb::cpu_id_t>> GetAvailableLogicalCoreIDs(); |
30 | |
31 | /// \return |
32 | /// The current value of /proc/sys/kernel/yama/ptrace_scope, parsed as an |
33 | /// integer, or an error if the proc file cannot be read or has non-integer |
34 | /// contents. |
35 | llvm::Expected<int> GetPtraceScope(); |
36 | |
37 | } // namespace process_linux |
38 | } // namespace lldb_private |
39 | |