]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools/nolibc: add creat()
authorThomas Weißschuh <linux@weissschuh.net>
Sun, 19 Apr 2026 15:29:04 +0000 (17:29 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Mon, 27 Apr 2026 17:25:30 +0000 (19:25 +0200)
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
tools/include/nolibc/fcntl.h

index ed2f5553c65a0bb31dcfe7d6cf63b565e236eb9c..56650a36f85693ffcb47b0f0674bc3d0497bad37 100644 (file)
@@ -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 */