aboutgitcodebugslistschat
path: root/util.h
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2023-05-21 14:47:07 +0200
committerStefano Brivio <sbrivio@redhat.com>2023-05-23 16:13:18 +0200
commitb0881aae6d91845821b2732f3fc8890e3d9ec4d2 (patch)
treef509bda5008a4f1737725eaa6d37295e8da0d937 /util.h
parent25f1d1a84f459fe197508b07fc7cdb858d7468ee (diff)
downloadpasst-b0881aae6d91845821b2732f3fc8890e3d9ec4d2.tar
passt-b0881aae6d91845821b2732f3fc8890e3d9ec4d2.tar.gz
passt-b0881aae6d91845821b2732f3fc8890e3d9ec4d2.tar.bz2
passt-b0881aae6d91845821b2732f3fc8890e3d9ec4d2.tar.lz
passt-b0881aae6d91845821b2732f3fc8890e3d9ec4d2.tar.xz
passt-b0881aae6d91845821b2732f3fc8890e3d9ec4d2.tar.zst
passt-b0881aae6d91845821b2732f3fc8890e3d9ec4d2.zip
util, conf: Add and use ns_is_init() helper
We'll need this in isolate_initial(). While at it, don't rely on BUFSIZ: the earlier issue we had with musl reminded me it's not a magic "everything will fit" value. Size the read buffer to what we actually need from uid_map, and check for the final newline too, because uid_map is organised in lines. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.h')
-rw-r--r--util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/util.h b/util.h
index ba3e3da..26892aa 100644
--- a/util.h
+++ b/util.h
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <stdarg.h>
+#include <stdbool.h>
#include "log.h"
@@ -216,6 +217,7 @@ char *line_read(char *buf, size_t len, int fd);
void procfs_scan_listen(struct ctx *c, uint8_t proto, int ip_version, int ns,
uint8_t *map, uint8_t *exclude);
int ns_enter(const struct ctx *c);
+bool ns_is_init(void);
void write_pidfile(int fd, pid_t pid);
int __daemon(int pidfile_fd, int devnull_fd);
int fls(unsigned long x);