1/*
2 * Copyright 2003-2012 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _SYS_RESOURCE_H
6#define _SYS_RESOURCE_H
7
8
9#include <config/types.h>
10
11#include <sys/cdefs.h>
12#include <sys/time.h>
13
14
15/* getrlimit()/setrlimit() definitions */
16
17typedef __haiku_addr_t rlim_t;
18
19struct rlimit {
20	rlim_t	rlim_cur;		/* current soft limit */
21	rlim_t	rlim_max;		/* hard limit */
22};
23
24/* ToDo: the only supported mode is RLIMIT_NOFILE right now */
25#define RLIMIT_CORE		0	/* size of the core file */
26#define RLIMIT_CPU		1	/* CPU time per team */
27#define RLIMIT_DATA		2	/* data segment size */
28#define RLIMIT_FSIZE	3	/* file size */
29#define RLIMIT_NOFILE	4	/* number of open files */
30#define RLIMIT_STACK	5	/* stack size */
31#define RLIMIT_AS		6	/* address space size */
32/* Haiku-specifics */
33#define RLIMIT_NOVMON	7	/* number of open vnode monitors */
34
35#define RLIM_NLIMITS	8	/* number of resource limits */
36
37#define RLIM_INFINITY	(0xffffffffUL)
38#define RLIM_SAVED_MAX	RLIM_INFINITY
39#define RLIM_SAVED_CUR	RLIM_INFINITY
40
41
42/* getrusage() definitions */
43
44struct rusage {
45	struct timeval ru_utime;	/* user time used */
46	struct timeval ru_stime;	/* system time used */
47};
48
49#define RUSAGE_SELF     0
50#define RUSAGE_CHILDREN -1
51
52
53/* getpriority()/setpriority() definitions */
54
55#define PRIO_PROCESS	0
56#define PRIO_PGRP		1
57#define PRIO_USER		2
58
59
60__BEGIN_DECLS
61
62extern int getrusage(int who, struct rusage *rusage);
63
64extern int getrlimit(int resource, struct rlimit * rlp);
65extern int setrlimit(int resource, const struct rlimit * rlp);
66
67extern int getpriority(int which, id_t who);
68extern int setpriority(int which, id_t who, int priority);
69
70__END_DECLS
71
72#endif	/* _SYS_RESOURCE_H */
73