mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:27:45 +00:00
LibC: Implement getdtablesize()
This commit is contained in:
parent
8fee285d72
commit
cf1baddb67
2 changed files with 10 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue