added an Haiku-specific RLIMIT (NumOpenVnodeMONitors) (UNIMPLEMENTED yet) (we might want to renumber it),

and used that one and NOFILE to implement R5 private calls _kset_[fd|mon]_limit_()


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17545 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2006-05-22 19:37:40 +00:00
parent 239974d018
commit c2be814ab5
2 changed files with 20 additions and 2 deletions

View File

@ -25,6 +25,10 @@ struct rlimit {
#define RLIMIT_NOFILE 4 /* number of open files */
#define RLIMIT_STACK 5 /* stack size */
#define RLIMIT_AS 6 /* address space size */
/* Haiku-specifics */
#define RLIMIT_NOVMON 7 /* number of open vnode monitors */
#define RLIM_NLIMITS 8 /* number of resource limits */
#define RLIM_INFINITY (0xffffffffUL)
#define RLIM_SAVED_MAX RLIM_INFINITY

View File

@ -10,7 +10,9 @@
#include <SupportDefs.h>
#include <sys/resource.h>
#include <syscalls.h>
#include <errno.h>
int _kset_mon_limit_(int num);
@ -23,14 +25,26 @@ int _kset_cpu_state_(int cpuNum, int state);
int
_kset_mon_limit_(int num)
{
return B_ERROR;
struct rlimit rl;
if (num < 1)
return EINVAL;
rl.rlim_cur = num;
if (setrlimit(RLIMIT_NOVMON, &rl) < 0)
return errno;
return B_OK;
}
int
_kset_fd_limit_(int num)
{
return B_ERROR;
struct rlimit rl;
if (num < 1)
return EINVAL;
rl.rlim_cur = num;
if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
return errno;
return B_OK;
}