From 6cda639869fb2fe06eaa4e4dd54c69e01e8c55bf Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 9 Aug 2024 17:02:20 +0300 Subject: [PATCH] LibC: Add stubs for tmpfile, mktemp and fchmod --- userspace/libraries/LibC/include/stdlib.h | 1 + userspace/libraries/LibC/stdio.cpp | 5 +++++ userspace/libraries/LibC/stdlib.cpp | 5 +++++ userspace/libraries/LibC/sys/stat.cpp | 7 +++++++ 4 files changed, 18 insertions(+) diff --git a/userspace/libraries/LibC/include/stdlib.h b/userspace/libraries/LibC/include/stdlib.h index aaeeb4e6..63449d2b 100644 --- a/userspace/libraries/LibC/include/stdlib.h +++ b/userspace/libraries/LibC/include/stdlib.h @@ -73,6 +73,7 @@ int mblen(const char* s, size_t n); size_t mbstowcs(wchar_t* __restrict pwcs, const char* __restrict s, size_t n); int mbtowc(wchar_t* __restrict pwc, const char* __restrict s, size_t n); char* mkdtemp(char* _template); +char* mktemp(char* _template); int mkstemp(char* _template); long mrand48(void); long nrand48(unsigned short xsubi[3]); diff --git a/userspace/libraries/LibC/stdio.cpp b/userspace/libraries/LibC/stdio.cpp index 097491e7..223c3d78 100644 --- a/userspace/libraries/LibC/stdio.cpp +++ b/userspace/libraries/LibC/stdio.cpp @@ -840,3 +840,8 @@ int vsscanf(const char* s, const char* format, va_list arguments) }, &s ); } + +FILE* tmpfile(void) +{ + ASSERT_NOT_REACHED(); +} diff --git a/userspace/libraries/LibC/stdlib.cpp b/userspace/libraries/LibC/stdlib.cpp index 8a11b025..e96785f9 100644 --- a/userspace/libraries/LibC/stdlib.cpp +++ b/userspace/libraries/LibC/stdlib.cpp @@ -514,6 +514,11 @@ int putenv(char* string) return 0; } +char* mktemp(char*) +{ + ASSERT_NOT_REACHED(); +} + size_t mbstowcs(wchar_t* __restrict pwcs, const char* __restrict s, size_t n) { auto* us = reinterpret_cast(s); diff --git a/userspace/libraries/LibC/sys/stat.cpp b/userspace/libraries/LibC/sys/stat.cpp index 8e2a270a..4e6fe002 100644 --- a/userspace/libraries/LibC/sys/stat.cpp +++ b/userspace/libraries/LibC/sys/stat.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -11,6 +13,11 @@ int chmod(const char* path, mode_t mode) return syscall(SYS_CHMOD, path, mode); } +int fchmod(int, mode_t) +{ + ASSERT_NOT_REACHED(); +} + int fstat(int fildes, struct stat* buf) { return syscall(SYS_FSTAT, fildes, buf);