daemons only need to restore the signal mask anyway, nothing else. Change-Id: Id2a91f33ccf68f4d1af1bc526973a4bee066ff0b
37 lines
807 B
C++
37 lines
807 B
C++
#pragma once
|
|
///@file
|
|
|
|
#include <optional>
|
|
#include <sys/resource.h>
|
|
|
|
#include "lix/libutil/types.hh"
|
|
|
|
namespace nix {
|
|
|
|
/**
|
|
* If cgroups are active, attempt to calculate the number of CPUs available.
|
|
* If cgroups are unavailable or if cpu.max is set to "max", return 0.
|
|
*/
|
|
unsigned int getMaxCPU();
|
|
|
|
/**
|
|
* Increase the stack size rlimit if it is currently smaller than `stackSize`.
|
|
*/
|
|
void ensureStackSizeAtLeast(rlim_t stackSize);
|
|
|
|
/**
|
|
* Restore the original inherited Unix process context (such as signal
|
|
* masks, stack size). This should generally be called after fork for a process
|
|
* intending to simply execve.
|
|
*
|
|
* See startSignalHandlerThread(), saveSignalMask().
|
|
*/
|
|
void restoreProcessContext();
|
|
|
|
/**
|
|
* @return the path of the current executable.
|
|
*/
|
|
std::optional<Path> getSelfExe();
|
|
|
|
}
|