From 175e9328bf9d403c70a0fd3721d1839538558422 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 3 Oct 2017 23:10:21 +0200 Subject: pkgs/sandbox: Implement a path cache First of all this is to bring down the amount of syscalls we're doing but it's also useful to avoid errors when we try to mount a path over an already mounted path. Signed-off-by: aszlig --- .../build-support/build-sandbox/src/path-cache.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 pkgs/games/build-support/build-sandbox/src/path-cache.cc (limited to 'pkgs/games/build-support/build-sandbox/src/path-cache.cc') diff --git a/pkgs/games/build-support/build-sandbox/src/path-cache.cc b/pkgs/games/build-support/build-sandbox/src/path-cache.cc new file mode 100644 index 00000000..5bfa43a7 --- /dev/null +++ b/pkgs/games/build-support/build-sandbox/src/path-cache.cc @@ -0,0 +1,21 @@ +#include +#include + +typedef std::set *path_cache; + +extern "C" { + path_cache new_path_cache(void) + { + return new std::set(); + } + + void free_path_cache(path_cache pc) + { + delete pc; + } + + bool cache_path(path_cache pc, const char *path) + { + return pc->insert(std::string(path)).second; + } +} -- cgit 1.4.1