24#ifndef LLVM_SUPPORT_PROCESS_H
25#define LLVM_SUPPORT_PROCESS_H
33#include <system_error>
87 std::chrono::nanoseconds &user_time,
88 std::chrono::nanoseconds &sys_time);
109 LLVM_ABI static std::optional<std::string>
114 LLVM_ABI static std::optional<std::string>
217 [[noreturn]]
LLVM_ABI static void Exit(
int RetCode,
bool NoCleanup =
false);
220 [[noreturn]]
static void ExitNoCleanup(
int RetCode);
static cl::opt< int > PageSize("imp-null-check-page-size", cl::desc("The page size of the target in bytes"), cl::init(4096), cl::Hidden)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
A collection of legacy interfaces for querying information about the current executing process.
static LLVM_ABI void UseANSIEscapeCodes(bool enable)
Enables or disables whether ANSI escape sequences are used to output colors.
static LLVM_ABI std::error_code SafelyCloseFileDescriptor(int FD)
static LLVM_ABI void GetTimeUsage(TimePoint<> &elapsed, std::chrono::nanoseconds &user_time, std::chrono::nanoseconds &sys_time)
This static function will set user_time to the amount of CPU time spent in user (non-kernel) mode and...
static LLVM_ABI std::error_code FixupStandardFileDescriptors()
static LLVM_ABI Pid getProcessId()
Get the process's identifier.
static LLVM_ABI size_t GetMallocUsage()
Return process memory usage.
static LLVM_ABI bool ColorNeedsFlush()
Whether changing colors requires the output to be flushed.
static LLVM_ABI std::optional< std::string > FindInEnvPath(StringRef EnvName, StringRef FileName, ArrayRef< std::string > IgnoreList, char Separator=EnvPathSeparator)
This function searches for an existing file in the list of directories in a PATH like environment var...
static LLVM_ABI void Exit(int RetCode, bool NoCleanup=false)
Equivalent to ::exit(), except when running inside a CrashRecoveryContext.
static LLVM_ABI const char * ResetColor()
Resets the terminals colors, or returns an escape sequence to do so.
static LLVM_ABI unsigned GetRandomNumber()
Get the result of a process wide random number generator.
static LLVM_ABI bool FileDescriptorIsDisplayed(int fd)
This function determines if the given file descriptor is connected to a "tty" or "console" window.
static LLVM_ABI Expected< unsigned > getPageSize()
Get the process's page size.
static LLVM_ABI const char * OutputColor(char c, bool bold, bool bg)
This function returns the colorcode escape sequences.
static LLVM_ABI const char * OutputBold(bool bg)
Same as OutputColor, but only enables the bold attribute.
static unsigned getPageSizeEstimate()
Get the process's estimated page size.
static LLVM_ABI unsigned StandardErrColumns()
This function determines the number of columns in the window if standard error is connected to a "tty...
static LLVM_ABI bool AreCoreFilesPrevented()
true if PreventCoreFiles has been called, false otherwise.
static LLVM_ABI std::optional< std::string > GetEnv(StringRef name)
static LLVM_ABI bool FileDescriptorHasColors(int fd)
This function determines if the given file descriptor is displayd and supports colors.
static LLVM_ABI bool StandardInIsUserInput()
This function determines if the standard input is connected directly to a user's input (keyboard prob...
static LLVM_ABI void PreventCoreFiles()
This function makes the necessary calls to the operating system to prevent core files or any other ki...
static LLVM_ABI bool StandardErrHasColors()
This function determines whether the terminal connected to standard error supports colors.
static LLVM_ABI const char * OutputReverse()
This function returns the escape sequence to reverse forground and background colors.
static LLVM_ABI bool StandardErrIsDisplayed()
This function determines if the standard error is connected to a "tty" or "console" window.
static LLVM_ABI bool StandardOutHasColors()
This function determines whether the terminal connected to standard output supports colors.
static LLVM_ABI unsigned StandardOutColumns()
This function determines the number of columns in the window if standard output is connected to a "tt...
static LLVM_ABI bool StandardOutIsDisplayed()
This function determines if the standard output is connected to a "tty" or "console" window.
std::chrono::time_point< std::chrono::system_clock, D > TimePoint
A time point on the system clock.
const char EnvPathSeparator
This is the OS-specific separator for PATH like environment variables:
This is an optimization pass for GlobalISel generic memory operations.
ArrayRef(const T &OneElt) -> ArrayRef< T >
void consumeError(Error Err)
Consume a Error without doing anything.