LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
Process.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 *
3 * Licensed under the Apache License, Version 2.0 (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
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef LIEF_RUNTIME_PROCESS_H
16#define LIEF_RUNTIME_PROCESS_H
17#include <unordered_map>
18#include <cstdint>
19#include <string>
20
22#include "LIEF/visibility.h"
23#include <optional>
24
25
26namespace LIEF::assembly {
27class Engine;
28}
29
30
31namespace LIEF::runtime {
32
36 public:
38 struct EnvVars {
39 std::unordered_map<std::string, std::string> vars;
40
41 bool empty() const {
42 return vars.empty();
43 }
44 };
45
47 static int32_t pid();
48
50 static uint32_t tid();
51
53 static constexpr ARCH arch() {
54 return runtime::arch();
55 }
56
58 static constexpr PLATFORMS platform() {
59 return runtime::platform();
60 }
61
67 static uint32_t page_size();
68
70 static std::optional<std::string> get_env(const std::string& key);
71
73 static EnvVars get_envs();
74
77};
78}
79
80#endif
This class interfaces the assembler/disassembler support.
Definition Engine.hpp:38
This structure represents the current process and provides functions to query process-level informati...
Definition Process.hpp:35
static int32_t pid()
Get the Process ID of the current process.
static uint32_t page_size()
Return the number of bytes in a memory page.
static EnvVars get_envs()
Return the environment variables present in the current process.
static std::optional< std::string > get_env(const std::string &key)
Return the environment variable associated with the given key.
static constexpr ARCH arch()
Return the target architecture of the current process.
Definition Process.hpp:53
static constexpr PLATFORMS platform()
Return the target platform of the current process.
Definition Process.hpp:58
static uint32_t tid()
Get the Thread ID of the current thread.
static assembly::Engine * default_engine()
Return the assembler/disassembler for the current process.
Namespace related to assembly/disassembly support.
Definition Abstract/Binary.hpp:48
Definition android/Host.hpp:23
ARCH
Definition runtime/utils.hpp:36
PLATFORMS
Definition runtime/utils.hpp:27
This structure wraps environment variables.
Definition Process.hpp:38
bool empty() const
Definition Process.hpp:41
std::unordered_map< std::string, std::string > vars
Definition Process.hpp:39
#define LIEF_API
Definition visibility.h:44