LibC: Add stubs that I have locally

I'm not sure if these are used by anything but I would assume so as I
have added them :D

functions added:
- getprotobyname
- open_memstream
- munlock
- lockf
- nice
- crypt
- getsid
- wcstoul
This commit is contained in:
Bananymous 2026-01-06 16:06:40 +02:00
parent 89959b800c
commit a00695bdac
5 changed files with 49 additions and 0 deletions

View File

@ -319,3 +319,9 @@ struct servent* getservbyname(const char* name, const char* proto)
dwarnln("TODO: getservbyname(\"{}\", \"{}\")", name, proto);
return nullptr;
}
struct protoent* getprotobynumber(int proto)
{
dwarnln("TODO: getprotobynumber({})", proto);
return nullptr;
}

View File

@ -649,6 +649,13 @@ char* gets(char* buffer)
}
}
FILE* open_memstream(char** bufp, size_t* sizep)
{
(void)bufp;
(void)sizep;
ASSERT_NOT_REACHED();
}
int pclose(FILE* file)
{
if (file->pid == -1)

View File

@ -53,6 +53,11 @@ int mlock(const void*, size_t)
ASSERT_NOT_REACHED();
}
int munlock(const void*, size_t)
{
ASSERT_NOT_REACHED();
}
int shm_open(const char* name, int oflag, mode_t mode)
{
(void)name;

View File

@ -689,6 +689,30 @@ int getpagesize(void)
return PAGE_SIZE;
}
int lockf(int fildes, int function, off_t size)
{
(void)fildes;
(void)function;
(void)size;
derrorln("TODO: lockf");
ASSERT_NOT_REACHED();
}
int nice(int incr)
{
dwarnln("TODO: nice({})", incr);
errno = EPERM;
return -1;
}
char* crypt(const char* key, const char* salt)
{
(void)key;
(void)salt;
derrorln("TODO: crypt");
ASSERT_NOT_REACHED();
}
char* getpass(const char* prompt)
{
static char buffer[PASS_MAX];
@ -774,6 +798,12 @@ pid_t getpgid(pid_t pid)
return syscall(SYS_GET_PGID, pid);
}
pid_t getsid(pid_t pid)
{
(void)pid;
ASSERT_NOT_REACHED();
}
int tcgetpgrp(int fildes)
{
return syscall(SYS_TCGETPGRP, fildes);

View File

@ -26,6 +26,7 @@ int wcwidth(wchar_t wc)
wchar_t* wcstok(wchar_t* __restrict, const wchar_t* __restrict, wchar_t** __restrict) { ASSERT_NOT_REACHED(); }
long wcstol(const wchar_t* __restrict, wchar_t** __restrict, int) { ASSERT_NOT_REACHED(); }
unsigned long wcstoul(const wchar_t* __restrict, wchar_t** __restrict, int) { ASSERT_NOT_REACHED(); }
int swprintf(wchar_t* __restrict, size_t, const wchar_t* __restrict, ...) { ASSERT_NOT_REACHED(); }
size_t wcrtomb(char* __restrict s, wchar_t ws, mbstate_t* __restrict ps)