1
0
Fork 0
mirror of https://passt.top/passt synced 2025-05-22 17:25:35 +02:00

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 <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2023-11-03 13:22:58 +11:00 committed by Stefano Brivio
parent 17d40d1cb5
commit 4f0b9f91e4
2 changed files with 54 additions and 0 deletions

1
util.h
View file

@ -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);