[PUSHED] nvptx: Implement 'creat'

Message ID 20260413213714.2946392-1-tschwinge@baylibre.com
State New
Headers
Series [PUSHED] nvptx: Implement 'creat' |

Commit Message

Thomas Schwinge April 13, 2026, 9:37 p.m. UTC
  ... 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(+)
  

Patch

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;