From 4f0b9f91e40ac004f955e73860ee1a0eee9cab95 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 3 Nov 2023 13:22:58 +1100 Subject: util: Add open_in_ns() helper Most of our helpers which need to enter the pasta network namespace are quite specialised. Add one which is rather general - it just open()s a given file in the namespace context and returns the fd back to the main namespace. This will have some future uses. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- util.h | 1 + 1 file changed, 1 insertion(+) (limited to 'util.h') diff --git a/util.h b/util.h index 9effc54..78a8fb2 100644 --- a/util.h +++ b/util.h @@ -219,6 +219,7 @@ int bitmap_isset(const uint8_t *map, int bit); char *line_read(char *buf, size_t len, int fd); void ns_enter(const struct ctx *c); bool ns_is_init(void); +int open_in_ns(const struct ctx *c, const char *path, int flags); void write_pidfile(int fd, pid_t pid); int __daemon(int pidfile_fd, int devnull_fd); int fls(unsigned long x); -- cgit v1.2.3