From 0130ef88ea280e67037fa76bcedc59db17d9a8ca Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 4 Dec 2006 17:17:13 +0000 Subject: * 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. --- src/libutil/util.hh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/libutil/util.hh') diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 0d39ffee9eae..b88508dec30d 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -139,6 +139,8 @@ extern void (*writeToStderr) (const unsigned char * buf, size_t count); void readFull(int fd, unsigned char * buf, size_t count); void writeFull(int fd, const unsigned char * buf, size_t count); +MakeError(EndOfFile, Error) + /* Read a file descriptor until EOF occurs. */ string drainFD(int fd); @@ -147,6 +149,19 @@ string drainFD(int fd); /* Automatic cleanup of resources. */ + +template +struct AutoDeleteArray +{ + T * p; + AutoDeleteArray(T * p) : p(p) { } + ~AutoDeleteArray() + { + delete [] p; + } +}; + + class AutoDelete { string path; @@ -229,6 +244,8 @@ void inline checkInterrupt() if (_isInterrupted) _interrupted(); } +MakeError(Interrupted, Error) + /* String packing / unpacking. */ string packStrings(const Strings & strings); -- cgit 1.4.1