mirror of
https://github.com/NixOS/nix
synced 2025-06-26 20:01:15 +02:00
* Daemon mode (`nix-worker --daemon'). Clients connect to the server
via the Unix domain socket in /nix/var/nix/daemon.socket. The server forks a worker process per connection. * readString(): use the heap, not the stack. * Some protocol fixes.
This commit is contained in:
parent
4740baf3a6
commit
0130ef88ea
7 changed files with 182 additions and 53 deletions
|
@ -191,18 +191,6 @@ Strings readDirectory(const Path & path)
|
|||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
struct AutoDeleteArray
|
||||
{
|
||||
T * p;
|
||||
AutoDeleteArray(T * p) : p(p) { }
|
||||
~AutoDeleteArray()
|
||||
{
|
||||
delete [] p;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
string readFile(int fd)
|
||||
{
|
||||
struct stat st;
|
||||
|
@ -468,7 +456,7 @@ void readFull(int fd, unsigned char * buf, size_t count)
|
|||
if (errno == EINTR) continue;
|
||||
throw SysError("reading from file");
|
||||
}
|
||||
if (res == 0) throw Error("unexpected end-of-file");
|
||||
if (res == 0) throw EndOfFile("unexpected end-of-file");
|
||||
count -= res;
|
||||
buf += res;
|
||||
}
|
||||
|
@ -707,6 +695,7 @@ int Pid::wait(bool block)
|
|||
if (res == 0 && !block) return -1;
|
||||
if (errno != EINTR)
|
||||
throw SysError("cannot get child exit status");
|
||||
checkInterrupt();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -793,7 +782,7 @@ void _interrupted()
|
|||
kills the program! */
|
||||
if (!std::uncaught_exception()) {
|
||||
_isInterrupted = 0;
|
||||
throw Error("interrupted by the user");
|
||||
throw Interrupted("interrupted by the user");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue