summaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2020-12-07 23:47:39 +0300
committerEvgeny Zinoviev <me@ch1p.io>2020-12-07 23:47:55 +0300
commita5511a0b0f74cc15c807bcee39fd9b4bc44beae2 (patch)
tree44595ba638d1123244c1f02a2aee183c5686454f /utils.h
parent2551cab43facf32a5a2b3768ae3034cd10095619 (diff)
implement a way for programs in the mount namespace (with glibc binaries) to launch processes in the original namespace (with musl binaries)
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/utils.h b/utils.h
new file mode 100644
index 0000000..cc9f610
--- /dev/null
+++ b/utils.h
@@ -0,0 +1,35 @@
+#ifndef VOIDNSRUN_UTILS_H
+#define VOIDNSRUN_UTILS_H
+
+#include <stdbool.h>
+#include "config.h"
+
+struct strarray {
+ size_t end;
+ size_t size;
+ char **list;
+};
+
+struct intarray {
+ size_t end;
+ size_t size;
+ int *list;
+};
+
+bool isdir(const char *s);
+bool isexe(const char *s);
+bool exists(const char *s);
+bool mkfile(const char *s);
+
+int send_fd(int sock, int fd);
+int recv_fd(int sock);
+
+bool isxbpscommand(const char *s);
+
+void strarray_alloc(struct strarray *a, size_t size);
+bool strarray_append(struct strarray *a, char *s);
+
+void intarray_alloc(struct intarray *i, size_t size);
+bool intarray_append(struct intarray *a, int i);
+
+#endif //VOIDNSRUN_UTILS_H