diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-09-11 12:34:25 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-09-14 15:42:55 +0200 |
commit | ee9dff34f9317509cb2b833d07a0d5e01a36a4ae (patch) | |
tree | 47027d9453eb3fe69f61bdc31d6d480a20e1217a /nix/libutil/util.hh | |
parent | 27cc51c269fbe9d2ca65711d281c63ae441a9b4a (diff) | |
download | guix-ee9dff34f9317509cb2b833d07a0d5e01a36a4ae.tar.gz |
daemon: Move 'Agent' to libutil.
* nix/libstore/build.cc (DerivationGoal::tryBuildHook): Add "offload" to 'args' and pass settings.guixProgram as the first argument to Agent::Agent. (pathNullDevice, commonChildInit, Agent, Agent::Agent) (Agent::~Agent): Move to... * nix/libutil/util.cc: ... here. * nix/libutil/util.hh (struct Agent, commonChildInit): New declarations.
Diffstat (limited to 'nix/libutil/util.hh')
-rw-r--r-- | nix/libutil/util.hh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/nix/libutil/util.hh b/nix/libutil/util.hh index 9e3c14bdd4..13cff44316 100644 --- a/nix/libutil/util.hh +++ b/nix/libutil/util.hh @@ -264,6 +264,29 @@ public: void setKillSignal(int signal); }; +/* An "agent" is a helper program that runs in the background and that we talk + to over pipes, such as the "guix offload" program. */ +struct Agent +{ + /* Pipes for talking to the agent. */ + Pipe toAgent; + + /* Pipe for the agent's standard output/error. */ + Pipe fromAgent; + + /* Pipe for build standard output/error--e.g., for build processes started + by "guix offload". */ + Pipe builderOut; + + /* The process ID of the agent. */ + Pid pid; + + /* The command and arguments passed to the agent. */ + Agent(const string &command, const Strings &args); + + ~Agent(); +}; + /* Kill all processes running under the specified uid by sending them a SIGKILL. */ @@ -295,6 +318,8 @@ void closeMostFDs(const set<int> & exceptions); /* Set the close-on-exec flag for the given file descriptor. */ void closeOnExec(int fd); +/* Common initialisation performed in child processes. */ +void commonChildInit(Pipe & logPipe); /* User interruption. */ |