14093d16dSSalvatore Benedetto /* 2173f54f1SMatt Madia * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. 34093d16dSSalvatore Benedetto * Distributed under the terms of the MIT License. 44093d16dSSalvatore Benedetto */ 52da2cceeSshatty #ifndef _SYS_RESOURCE_H 62da2cceeSshatty #define _SYS_RESOURCE_H 72da2cceeSshatty 82222d055SIngo Weinhold 92222d055SIngo Weinhold #include <config/types.h> 102222d055SIngo Weinhold 114093d16dSSalvatore Benedetto #include <sys/cdefs.h> 12051f8828SAxel Dörfler #include <sys/time.h> 13051f8828SAxel Dörfler 14051f8828SAxel Dörfler 15051f8828SAxel Dörfler /* getrlimit()/setrlimit() definitions */ 162da2cceeSshatty 172222d055SIngo Weinhold typedef __haiku_addr_t rlim_t; 182da2cceeSshatty 192da2cceeSshatty struct rlimit { 20051f8828SAxel Dörfler rlim_t rlim_cur; /* current soft limit */ 21051f8828SAxel Dörfler rlim_t rlim_max; /* hard limit */ 222da2cceeSshatty }; 232da2cceeSshatty 24b9320128SIngo Weinhold /* ToDo: the only supported mode is RLIMIT_NOFILE right now */ 25051f8828SAxel Dörfler #define RLIMIT_CORE 0 /* size of the core file */ 26051f8828SAxel Dörfler #define RLIMIT_CPU 1 /* CPU time per team */ 27051f8828SAxel Dörfler #define RLIMIT_DATA 2 /* data segment size */ 28051f8828SAxel Dörfler #define RLIMIT_FSIZE 3 /* file size */ 29051f8828SAxel Dörfler #define RLIMIT_NOFILE 4 /* number of open files */ 30051f8828SAxel Dörfler #define RLIMIT_STACK 5 /* stack size */ 31051f8828SAxel Dörfler #define RLIMIT_AS 6 /* address space size */ 32c2be814aSFrançois Revol /* Haiku-specifics */ 33c2be814aSFrançois Revol #define RLIMIT_NOVMON 7 /* number of open vnode monitors */ 34c2be814aSFrançois Revol 35c2be814aSFrançois Revol #define RLIM_NLIMITS 8 /* number of resource limits */ 362da2cceeSshatty 372da2cceeSshatty #define RLIM_INFINITY (0xffffffffUL) 38051f8828SAxel Dörfler #define RLIM_SAVED_MAX RLIM_INFINITY 39051f8828SAxel Dörfler #define RLIM_SAVED_CUR RLIM_INFINITY 402da2cceeSshatty 412da2cceeSshatty 42051f8828SAxel Dörfler /* getrusage() definitions */ 432da2cceeSshatty 442da2cceeSshatty struct rusage { 45051f8828SAxel Dörfler struct timeval ru_utime; /* user time used */ 46051f8828SAxel Dörfler struct timeval ru_stime; /* system time used */ 47*7d961f97SJérôme Duval 48*7d961f97SJérôme Duval /* unused, only for compatibility with other systems */ 49*7d961f97SJérôme Duval long ru_maxrss; 50*7d961f97SJérôme Duval long ru_ixrss; 51*7d961f97SJérôme Duval long ru_idrss; 52*7d961f97SJérôme Duval long ru_isrss; 53*7d961f97SJérôme Duval long ru_minflt; 54*7d961f97SJérôme Duval long ru_majflt; 55*7d961f97SJérôme Duval long ru_nswap; 56*7d961f97SJérôme Duval long ru_inblock; 57*7d961f97SJérôme Duval long ru_oublock; 58*7d961f97SJérôme Duval long ru_msgsnd; 59*7d961f97SJérôme Duval long ru_msgrcv; 60*7d961f97SJérôme Duval long ru_nsignals; 61*7d961f97SJérôme Duval long ru_nvcsw; 62*7d961f97SJérôme Duval long ru_nivcsw; 632da2cceeSshatty }; 642da2cceeSshatty 652da2cceeSshatty #define RUSAGE_SELF 0 662da2cceeSshatty #define RUSAGE_CHILDREN -1 672da2cceeSshatty 68051f8828SAxel Dörfler 69051f8828SAxel Dörfler /* getpriority()/setpriority() definitions */ 70051f8828SAxel Dörfler 71051f8828SAxel Dörfler #define PRIO_PROCESS 0 72051f8828SAxel Dörfler #define PRIO_PGRP 1 73051f8828SAxel Dörfler #define PRIO_USER 2 74051f8828SAxel Dörfler 752da2cceeSshatty 764093d16dSSalvatore Benedetto __BEGIN_DECLS 772da2cceeSshatty 7814701025SAxel Dörfler extern int getrusage(int who, struct rusage *rusage); 79051f8828SAxel Dörfler 80051f8828SAxel Dörfler extern int getrlimit(int resource, struct rlimit * rlp); 81051f8828SAxel Dörfler extern int setrlimit(int resource, const struct rlimit * rlp); 82051f8828SAxel Dörfler 838ae2e956STimothy Gu extern int getpriority(int which, id_t who); 848ae2e956STimothy Gu extern int setpriority(int which, id_t who, int priority); 85051f8828SAxel Dörfler 864093d16dSSalvatore Benedetto __END_DECLS 87051f8828SAxel Dörfler 88051f8828SAxel Dörfler #endif /* _SYS_RESOURCE_H */ 89