24#ifndef LLVM_SUPPORT_PROCESS_H
25#define LLVM_SUPPORT_PROCESS_H
32#include <system_error>
86 std::chrono::nanoseconds &user_time,
87 std::chrono::nanoseconds &sys_time);
108 static std::optional<std::string>
113 static std::optional<std::string>
216 [[noreturn]]
static void Exit(
int RetCode,
bool NoCleanup =
false);
219 [[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 void PreventCoreFiles()
This function makes the necessary calls to the operating system to prevent core files or any other ki...
static std::error_code SafelyCloseFileDescriptor(int FD)
static const char * OutputColor(char c, bool bold, bool bg)
This function returns the colorcode escape sequences.
static bool StandardOutHasColors()
This function determines whether the terminal connected to standard output supports colors.
static Expected< unsigned > getPageSize()
Get the process's page size.
static bool FileDescriptorIsDisplayed(int fd)
This function determines if the given file descriptor is connected to a "tty" or "console" window.
static 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 bool StandardErrIsDisplayed()
This function determines if the standard error is connected to a "tty" or "console" window.
static void Exit(int RetCode, bool NoCleanup=false)
Equivalent to ::exit(), except when running inside a CrashRecoveryContext.
static const char * OutputBold(bool bg)
Same as OutputColor, but only enables the bold attribute.
static bool FileDescriptorHasColors(int fd)
This function determines if the given file descriptor is displayd and supports colors.
static void UseANSIEscapeCodes(bool enable)
Enables or disables whether ANSI escape sequences are used to output colors.
static unsigned getPageSizeEstimate()
Get the process's estimated page size.
static std::optional< std::string > GetEnv(StringRef name)
static unsigned StandardErrColumns()
This function determines the number of columns in the window if standard error is connected to a "tty...
static bool AreCoreFilesPrevented()
true if PreventCoreFiles has been called, false otherwise.
static unsigned GetRandomNumber()
Get the result of a process wide random number generator.
static const char * OutputReverse()
This function returns the escape sequence to reverse forground and background colors.
static bool StandardErrHasColors()
This function determines whether the terminal connected to standard error supports colors.
static std::error_code FixupStandardFileDescriptors()
static unsigned StandardOutColumns()
This function determines the number of columns in the window if standard output is connected to a "tt...
static bool StandardOutIsDisplayed()
This function determines if the standard output is connected to a "tty" or "console" window.
static 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 bool StandardInIsUserInput()
This function determines if the standard input is connected directly to a user's input (keyboard prob...
static const char * ResetColor()
Resets the terminals colors, or returns an escape sequence to do so.
static bool ColorNeedsFlush()
Whether changing colors requires the output to be flushed.
static size_t GetMallocUsage()
Return process memory usage.
static Pid getProcessId()
Get the process's identifier.
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.