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 17 typedef __haiku_addr_t rlim_t; 18 19 struct 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 44 struct rusage { 45 struct timeval ru_utime; /* user time used */ 46 struct timeval ru_stime; /* system time used */ 47 48 /* unused, only for compatibility with other systems */ 49 long ru_maxrss; 50 long ru_ixrss; 51 long ru_idrss; 52 long ru_isrss; 53 long ru_minflt; 54 long ru_majflt; 55 long ru_nswap; 56 long ru_inblock; 57 long ru_oublock; 58 long ru_msgsnd; 59 long ru_msgrcv; 60 long ru_nsignals; 61 long ru_nvcsw; 62 long ru_nivcsw; 63 }; 64 65 #define RUSAGE_SELF 0 66 #define RUSAGE_CHILDREN -1 67 68 69 /* getpriority()/setpriority() definitions */ 70 71 #define PRIO_PROCESS 0 72 #define PRIO_PGRP 1 73 #define PRIO_USER 2 74 75 76 __BEGIN_DECLS 77 78 extern int getrusage(int who, struct rusage *rusage); 79 80 extern int getrlimit(int resource, struct rlimit * rlp); 81 extern int setrlimit(int resource, const struct rlimit * rlp); 82 83 extern int getpriority(int which, id_t who); 84 extern int setpriority(int which, id_t who, int priority); 85 86 __END_DECLS 87 88 #endif /* _SYS_RESOURCE_H */ 89