14093d16dSSalvatore Benedetto /* 2*173f54f1SMatt 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 */ 472da2cceeSshatty }; 482da2cceeSshatty 492da2cceeSshatty #define RUSAGE_SELF 0 502da2cceeSshatty #define RUSAGE_CHILDREN -1 512da2cceeSshatty 52051f8828SAxel Dörfler 53051f8828SAxel Dörfler /* getpriority()/setpriority() definitions */ 54051f8828SAxel Dörfler 55051f8828SAxel Dörfler #define PRIO_PROCESS 0 56051f8828SAxel Dörfler #define PRIO_PGRP 1 57051f8828SAxel Dörfler #define PRIO_USER 2 58051f8828SAxel Dörfler 592da2cceeSshatty 604093d16dSSalvatore Benedetto __BEGIN_DECLS 612da2cceeSshatty 6214701025SAxel Dörfler extern int getrusage(int who, struct rusage *rusage); 63051f8828SAxel Dörfler 64051f8828SAxel Dörfler extern int getrlimit(int resource, struct rlimit * rlp); 65051f8828SAxel Dörfler extern int setrlimit(int resource, const struct rlimit * rlp); 66051f8828SAxel Dörfler 67b9320128SIngo Weinhold /* ToDo: The following POSIX calls are missing (in BeOS as well): 68b9320128SIngo Weinhold * int getpriority(int which, id_t who); 69b9320128SIngo Weinhold * int setpriority(int which, id_t who, int priority); */ 70051f8828SAxel Dörfler 714093d16dSSalvatore Benedetto __END_DECLS 72051f8828SAxel Dörfler 73051f8828SAxel Dörfler #endif /* _SYS_RESOURCE_H */ 74