2008-08-10 20:29:51 +04:00
|
|
|
/*
|
2008-08-10 21:02:34 +04:00
|
|
|
* Copyright 2003-2008, Haiku Inc. All Rights Reserved.
|
2008-08-10 20:29:51 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2003-09-21 00:41:11 +04:00
|
|
|
#ifndef _SYS_RESOURCE_H
|
|
|
|
#define _SYS_RESOURCE_H
|
|
|
|
|
2009-11-24 22:44:07 +03:00
|
|
|
|
|
|
|
#include <config/types.h>
|
|
|
|
|
2008-08-10 20:29:51 +04:00
|
|
|
#include <sys/cdefs.h>
|
2003-09-21 19:51:03 +04:00
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
|
|
|
|
/* getrlimit()/setrlimit() definitions */
|
|
|
|
|
2009-11-24 22:44:07 +03:00
|
|
|
typedef __haiku_addr_t rlim_t;
|
2003-09-21 00:41:11 +04:00
|
|
|
|
|
|
|
struct rlimit {
|
2003-09-21 19:51:03 +04:00
|
|
|
rlim_t rlim_cur; /* current soft limit */
|
|
|
|
rlim_t rlim_max; /* hard limit */
|
2003-09-21 00:41:11 +04:00
|
|
|
};
|
|
|
|
|
2008-05-11 01:30:34 +04:00
|
|
|
/* ToDo: the only supported mode is RLIMIT_NOFILE right now */
|
2003-09-21 19:51:03 +04:00
|
|
|
#define RLIMIT_CORE 0 /* size of the core file */
|
|
|
|
#define RLIMIT_CPU 1 /* CPU time per team */
|
2009-12-22 19:53:28 +03:00
|
|
|
#define RLIMIT_DATA 2 /* data segment size */
|
2003-09-21 19:51:03 +04:00
|
|
|
#define RLIMIT_FSIZE 3 /* file size */
|
|
|
|
#define RLIMIT_NOFILE 4 /* number of open files */
|
|
|
|
#define RLIMIT_STACK 5 /* stack size */
|
|
|
|
#define RLIMIT_AS 6 /* address space size */
|
2006-05-22 23:37:40 +04:00
|
|
|
/* Haiku-specifics */
|
|
|
|
#define RLIMIT_NOVMON 7 /* number of open vnode monitors */
|
|
|
|
|
2009-12-22 19:53:28 +03:00
|
|
|
#define RLIM_NLIMITS 8 /* number of resource limits */
|
2003-09-21 00:41:11 +04:00
|
|
|
|
|
|
|
#define RLIM_INFINITY (0xffffffffUL)
|
2003-09-21 19:51:03 +04:00
|
|
|
#define RLIM_SAVED_MAX RLIM_INFINITY
|
|
|
|
#define RLIM_SAVED_CUR RLIM_INFINITY
|
2003-09-21 00:41:11 +04:00
|
|
|
|
|
|
|
|
2003-09-21 19:51:03 +04:00
|
|
|
/* getrusage() definitions */
|
2003-09-21 00:41:11 +04:00
|
|
|
|
|
|
|
struct rusage {
|
2003-09-21 19:51:03 +04:00
|
|
|
struct timeval ru_utime; /* user time used */
|
|
|
|
struct timeval ru_stime; /* system time used */
|
2003-09-21 00:41:11 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define RUSAGE_SELF 0
|
|
|
|
#define RUSAGE_CHILDREN -1
|
|
|
|
|
2003-09-21 19:51:03 +04:00
|
|
|
|
|
|
|
/* getpriority()/setpriority() definitions */
|
|
|
|
|
|
|
|
#define PRIO_PROCESS 0
|
|
|
|
#define PRIO_PGRP 1
|
|
|
|
#define PRIO_USER 2
|
|
|
|
|
2003-09-21 00:41:11 +04:00
|
|
|
|
2008-08-10 20:29:51 +04:00
|
|
|
__BEGIN_DECLS
|
2003-09-21 00:41:11 +04:00
|
|
|
|
2003-09-21 19:53:54 +04:00
|
|
|
extern int getrusage(int who, struct rusage *rusage);
|
2003-09-21 19:51:03 +04:00
|
|
|
|
|
|
|
extern int getrlimit(int resource, struct rlimit * rlp);
|
|
|
|
extern int setrlimit(int resource, const struct rlimit * rlp);
|
|
|
|
|
2008-05-11 01:30:34 +04:00
|
|
|
/* ToDo: The following POSIX calls are missing (in BeOS as well):
|
|
|
|
* int getpriority(int which, id_t who);
|
|
|
|
* int setpriority(int which, id_t who, int priority); */
|
2003-09-21 19:51:03 +04:00
|
|
|
|
2008-08-10 20:29:51 +04:00
|
|
|
__END_DECLS
|
2003-09-21 19:51:03 +04:00
|
|
|
|
|
|
|
#endif /* _SYS_RESOURCE_H */
|