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:
@@ -25,6 +25,10 @@ struct rlimit {
|
|||||||
#define RLIMIT_NOFILE 4 /* number of open files */
|
#define RLIMIT_NOFILE 4 /* number of open files */
|
||||||
#define RLIMIT_STACK 5 /* stack size */
|
#define RLIMIT_STACK 5 /* stack size */
|
||||||
#define RLIMIT_AS 6 /* address space 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_INFINITY (0xffffffffUL)
|
||||||
#define RLIM_SAVED_MAX RLIM_INFINITY
|
#define RLIM_SAVED_MAX RLIM_INFINITY
|
||||||
|
|||||||
@@ -10,7 +10,9 @@
|
|||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
|
#include <sys/resource.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
int _kset_mon_limit_(int num);
|
int _kset_mon_limit_(int num);
|
||||||
@@ -23,14 +25,26 @@ int _kset_cpu_state_(int cpuNum, int state);
|
|||||||
int
|
int
|
||||||
_kset_mon_limit_(int num)
|
_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
|
int
|
||||||
_kset_fd_limit_(int num)
|
_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user