[PUSHED] nvptx: Implement 'creat'
Thomas Schwinge <[email protected]> Mon, 13 Apr 2026 23:37:15 +0200
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
... via the existing (stub) 'open' implementation; some code would like to
'creat' instead of 'open'ing with the applicable flags.
---
newlib/libc/machine/nvptx/misc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/newlib/libc/machine/nvptx/misc.c b/newlib/libc/machine/nvptx/misc.c
index 829921ec25..6af770a525 100644
--- a/newlib/libc/machine/nvptx/misc.c
+++ b/newlib/libc/machine/nvptx/misc.c
@@ -13,6 +13,7 @@
* they apply.
*/
+#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -62,6 +63,11 @@ open (const char *pathname, int flags, ...) {
return -1;
}
+int
+creat (const char *path, mode_t mode) {
+ return open (path, O_CREAT | O_WRONLY | O_TRUNC, mode);
+}
+
ssize_t
read(int fd, void *buf, size_t count) {
return 0;
--
2.34.1