LibC: Add a lot of stub implementations for different libc functions

some ports want to link against these, but they are not ever called
based on simple testing

This patch adds stubs for
- openlog
- syslog
- getrusage
- mlock
- mprotect
- getpeername
- shutdown
- tzset
- mktime
This commit is contained in:
Bananymous 2024-08-22 14:28:39 +03:00
parent ca8832c0e1
commit 500f774b7f
6 changed files with 63 additions and 0 deletions

View File

@ -25,12 +25,14 @@ set(LIBC_SOURCES
sys/banan-os.cpp
sys/ioctl.cpp
sys/mman.cpp
sys/resource.cpp
sys/select.cpp
sys/socket.cpp
sys/stat.cpp
sys/time.cpp
sys/utsname.cpp
sys/wait.cpp
syslog.cpp
termios.cpp
time.cpp
unistd.cpp

View File

@ -27,3 +27,16 @@ int msync(void* addr, size_t len, int flags)
{
return syscall(SYS_MSYNC, addr, len, flags);
}
#include <BAN/Assert.h>
int mlock(const void*, size_t)
{
ASSERT_NOT_REACHED();
}
int mprotect(void*, size_t, int)
{
ASSERT_NOT_REACHED();
}

View File

@ -0,0 +1,7 @@
#include <BAN/Assert.h>
#include <sys/resource.h>
int getrusage(int, struct rusage*)
{
ASSERT_NOT_REACHED();
}

View File

@ -77,3 +77,17 @@ int setsockopt(int socket, int level, int option_name, const void* option_value,
{
return syscall(SYS_SETSOCKOPT, socket, level, option_name, option_value, option_len);
}
#include <BAN/Assert.h>
int getpeername(int, struct sockaddr* __restrict, socklen_t* __restrict)
{
ASSERT_NOT_REACHED();
}
int shutdown(int, int)
{
ASSERT_NOT_REACHED();
}

View File

@ -0,0 +1,12 @@
#include <BAN/Assert.h>
#include <syslog.h>
void openlog(const char*, int, int)
{
ASSERT_NOT_REACHED();
}
void syslog(int, const char*, ...)
{
ASSERT_NOT_REACHED();
}

View File

@ -452,3 +452,18 @@ size_t strftime(char* __restrict s, size_t maxsize, const char* __restrict forma
s[len++] = '\0';
return len;
}
#include <BAN/Assert.h>
long timezone;
void tzset()
{
ASSERT_NOT_REACHED();
}
time_t mktime(struct tm*)
{
ASSERT_NOT_REACHED();
}