From 9e8a57cec793cce10392e7375651120faf596a01 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 12 Nov 2022 14:15:02 +0100 Subject: [PATCH] libc: Add getdtablesize() No system call for this, since the limit is fixed right now --- libs/libc/include/unistd.h | 3 +++ libs/libc/src/unistd.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/libs/libc/include/unistd.h b/libs/libc/include/unistd.h index b9f98ef7..b903f850 100644 --- a/libs/libc/include/unistd.h +++ b/libs/libc/include/unistd.h @@ -103,6 +103,9 @@ extern "C" int chdir(const char* path); // Not implemented. int pipe(int fd[2]); // Not implemented. + /* Returns the maximum number of file descriptors a process can have open at the same time. */ + int getdtablesize(void); + #ifdef __cplusplus } #endif diff --git a/libs/libc/src/unistd.cpp b/libs/libc/src/unistd.cpp index 2fdb32cf..bd042c6a 100644 --- a/libs/libc/src/unistd.cpp +++ b/libs/libc/src/unistd.cpp @@ -163,4 +163,9 @@ extern "C" { NOT_IMPLEMENTED("pipe"); } + + int getdtablesize(void) + { + return OPEN_MAX; + } } \ No newline at end of file