mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
LibC: Implement getdtablesize()
This commit is contained in:
parent
8fee285d72
commit
cf1baddb67
Notes:
sideshowbarker
2024-07-17 16:33:03 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/cf1baddb67 Pull-request: https://github.com/SerenityOS/serenity/pull/13342 Reviewed-by: https://github.com/linusg ✅
@ -23,6 +23,7 @@
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysmacros.h>
|
||||
@ -980,4 +981,12 @@ int chroot(const char* path)
|
||||
dbgln("FIXME: chroot(\"{}\")", path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/7908799/xsh/getdtablesize.html
|
||||
int getdtablesize()
|
||||
{
|
||||
rlimit dtablesize;
|
||||
int rc = getrlimit(RLIMIT_NOFILE, &dtablesize);
|
||||
__RETURN_WITH_ERRNO(rc, dtablesize.rlim_cur, rc);
|
||||
}
|
||||
}
|
||||
|
@ -118,6 +118,7 @@ int unveil(const char* path, const char* permissions);
|
||||
char* getpass(const char* prompt);
|
||||
int pause(void);
|
||||
int chroot(const char*);
|
||||
int getdtablesize(void);
|
||||
|
||||
enum {
|
||||
_PC_NAME_MAX,
|
||||
|
Loading…
Reference in New Issue
Block a user