Nix  2.93.0-dev
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
shared.hh File Reference
#include "lix/libutil/args.hh"
#include "lix/libutil/args/root.hh"
#include "lix/libmain/common-args.hh"
#include "lix/libstore/path.hh"
#include "lix/libstore/derived-path.hh"
#include "lix/libutil/processes.hh"
#include "lix/libutil/strings.hh"
#include <signal.h>
Include dependency graph for shared.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  nix::LegacyArgs
 
class  nix::RunPager
 
struct  nix::PrintFreed
 

Functions

int nix::handleExceptions (const std::string &programName, std::function< void()> fun)
 
void nix::initNix ()
 
void nix::printVersion (const std::string &programName)
 
void nix::printGCWarning ()
 
kj::Promise< Result< void > > nix::printMissing (ref< Store > store, const std::vector< DerivedPath > &paths, Verbosity lvl)
 
kj::Promise< Result< void > > nix::printMissing (ref< Store > store, const StorePathSet &willBuild, const StorePathSet &willSubstitute, const StorePathSet &unknown, uint64_t downloadSize, uint64_t narSize, Verbosity lvl)
 
std::string nix::getArg (const std::string &opt, Strings::iterator &i, const Strings::iterator &end)
 
template<class N >
nix::getIntArg (const std::string &opt, Strings::iterator &i, const Strings::iterator &end, bool allowUnit)
 
void nix::showManPage (const std::string &name)
 
std::string nix::showBytes (uint64_t bytes)
 
void nix::detectStackOverflow ()
 
void nix::defaultStackOverflowHandler (siginfo_t *info, void *ctx)
 

Variables

volatile ::sig_atomic_t nix::blockInt
 
std::function< void(siginfo_t *info, void *ctx) nix::stackOverflowHandler )
 

Function Documentation

◆ defaultStackOverflowHandler()

void nix::defaultStackOverflowHandler ( siginfo_t * info,
void * ctx )

The default, robust implementation of stackOverflowHandler.

Prints an error message directly to stderr using a syscall instead of the logger. Exits the process immediately after.

◆ detectStackOverflow()

void nix::detectStackOverflow ( )

Install a SIGSEGV handler to detect stack overflows. See also registerCrashHandler().

◆ initNix()

void nix::initNix ( )

Don't forget to call initPlugins() after settings are initialized!

◆ printGCWarning()

void nix::printGCWarning ( )

Ugh. No better place to put this.

◆ showManPage()

void nix::showManPage ( const std::string & name)

Show the manual page for the specified program.

Variable Documentation

◆ stackOverflowHandler

std::function< void(siginfo_t *info, void *ctx) nix::stackOverflowHandler) (defaultStackOverflowHandler) ( )

Pluggable behavior to run in case of a stack overflow.

Default value: defaultStackOverflowHandler.

This is called by the handler installed by detectStackOverflow().

This gives Lix library consumers a limit opportunity to report the error condition. The handler should exit the process. See defaultStackOverflowHandler() for a reference implementation.

NOTE: Use with diligence, because this runs in the signal handler, with very limited stack space and a potentially a corrupted heap, all while the failed thread is blocked indefinitely. All functions called must be reentrant.