[PATCH 2/3] tools/nolibc: add creat()

From: Thomas Weißschuh

Date: Sun Apr 19 2026 - 11:30:32 EST


creat() is a simple wrapper around open().

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
tools/include/nolibc/fcntl.h | 10 ++++++++++
1 file changed, 10 insertions(+)

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 */

--
2.53.0