summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2026-04-19 18:29:04 +0300
committerThomas Weißschuh <linux@weissschuh.net>2026-04-27 20:25:30 +0300
commit7ffb6e99c3662322fd9ffdd4417c2aabd4af95b9 (patch)
tree69d61cf630cd4cd3e620cbb1bf0d7b2357113688
parent0cb18b5b27b9a61298cb9c5e6f7f87e27b4529c9 (diff)
downloadlinux-7ffb6e99c3662322fd9ffdd4417c2aabd4af95b9.tar.xz
tools/nolibc: add creat()
creat() is a simple wrapper around open(). Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Acked-by: Willy Tarreau <w@1wt.eu> Link: https://patch.msgid.link/20260419-nolibc-open-mode-v1-2-8dc5a960daa7@weissschuh.net
-rw-r--r--tools/include/nolibc/fcntl.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/include/nolibc/fcntl.h b/tools/include/nolibc/fcntl.h
index ed2f5553c65a..56650a36f856 100644
--- a/tools/include/nolibc/fcntl.h
+++ b/tools/include/nolibc/fcntl.h
@@ -66,4 +66,14 @@ int open(const char *path, int flags, ...)
return __sysret(_sys_open(path, flags, mode));
}
+/*
+ * int creat(const char *path, mode_t mode);
+ */
+
+static __attribute__((unused))
+int creat(const char *path, mode_t mode)
+{
+ return open(path, O_CREAT | O_WRONLY | O_TRUNC, mode);
+}
+
#endif /* _NOLIBC_FCNTL_H */