about summary refs log tree commit diff
path: root/src/libutil/util.hh
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-12-04T17·17+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-12-04T17·17+0000
commit0130ef88ea280e67037fa76bcedc59db17d9a8ca (patch)
tree120a616c9a9ee296d2c1832f1b238c281df016ae /src/libutil/util.hh
parent4740baf3a61c48c07f12f23927c84ca9892088a8 (diff)
* 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.

Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r--src/libutil/util.hh17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 0d39ffee9e..b88508dec3 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 <class T>
+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);