diff options
Diffstat (limited to 'nix/libutil/util.hh')
-rw-r--r-- | nix/libutil/util.hh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nix/libutil/util.hh b/nix/libutil/util.hh index ab2395e959..648d6f19a4 100644 --- a/nix/libutil/util.hh +++ b/nix/libutil/util.hh @@ -19,6 +19,12 @@ namespace nix { /* Return an environment variable. */ string getEnv(const string & key, const string & def = ""); +/* Find the absolute filename corresponding to PROGRAM, searching PATH if + PROGRAM is a relative filename. If PROGRAM is an absolute filename for a + file that doesn't exist, or it can't be found in PATH, then return the + empty string. */ +string findProgram(const string & program); + /* Return an absolutized path, resolving paths relative to the specified directory, or the current directory otherwise. The path is also canonicalised. */ @@ -207,6 +213,10 @@ public: int borrow(); }; +/* Send and receive an FD on a unix-domain socket, along with a single null + byte of regular data. */ +void sendFD(int sock, int fd); +int receiveFD(int sock); class Pipe { @@ -370,6 +380,12 @@ string parseString(std::istream & str); bool endOfList(std::istream & str); +/* Escape a string that contains octal-encoded escape codes such as + used in /etc/fstab and /proc/mounts (e.g. "foo\040bar" decodes to + "foo bar"). */ +string decodeOctalEscaped(const string & s); + + /* Exception handling in destructors: print an error message, then ignore the exception. */ void ignoreException(); |