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 * Copyright 2017 - 2026 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_RUNTIME_PROCESS_H
17#define LIEF_RUNTIME_PROCESS_H
18#include <unordered_map>
19#include <cstdint>
20#include <string>
21
23#include "LIEF/visibility.h"
24#include <optional>
25
26
27namespace LIEF::assembly {
28class Engine;
29}
30
31
32namespace LIEF::runtime {
33
37 public:
39 struct EnvVars {
40 std::unordered_map<std::string, std::string> vars;
41
42 bool empty() const {
43 return vars.empty();
44 }
45 };
46
48 static int32_t pid();
49
51 static uint32_t tid();
52
54 static constexpr ARCH arch() {
55 return runtime::arch();
56 }
57
59 static constexpr PLATFORMS platform() {
60 return runtime::platform();
61 }
62
68 static uint32_t page_size();
69
71 static std::optional<std::string> get_env(const std::string& key);
72
74 static EnvVars get_envs();
75
78};
79}
80
81#endif
This class interfaces the assembler/disassembler support.
Definition Engine.hpp:37
This structure represents the current process and provides functions to query process-level informati...
Definition Process.hpp:36
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:54
static constexpr PLATFORMS platform()
Return the target platform of the current process.
Definition Process.hpp:59
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:24
ARCH
Definition runtime/utils.hpp:37
PLATFORMS
Definition runtime/utils.hpp:28
This structure wraps environment variables.
Definition Process.hpp:39
bool empty() const
Definition Process.hpp:42
std::unordered_map< std::string, std::string > vars
Definition Process.hpp:40
#define LIEF_API
Definition visibility.h:45