1 /* 2 * Copyright (c) 1982, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)resource.h 8.4 (Berkeley) 01/09/95 8 */ 9 10 #ifndef _SYS_RESOURCE_H_ 11 #define _SYS_RESOURCE_H_ 12 13 /* 14 * Process priority specifications to get/setpriority. 15 */ 16 #define PRIO_MIN -20 17 #define PRIO_MAX 20 18 19 #define PRIO_PROCESS 0 20 #define PRIO_PGRP 1 21 #define PRIO_USER 2 22 23 /* 24 * Resource utilization information. 25 */ 26 27 #define RUSAGE_SELF 0 28 #define RUSAGE_CHILDREN -1 29 30 struct rusage { 31 struct timeval ru_utime; /* user time used */ 32 struct timeval ru_stime; /* system time used */ 33 long ru_maxrss; /* max resident set size */ 34 #define ru_first ru_ixrss 35 long ru_ixrss; /* integral shared memory size */ 36 long ru_idrss; /* integral unshared data " */ 37 long ru_isrss; /* integral unshared stack " */ 38 long ru_minflt; /* page reclaims */ 39 long ru_majflt; /* page faults */ 40 long ru_nswap; /* swaps */ 41 long ru_inblock; /* block input operations */ 42 long ru_oublock; /* block output operations */ 43 long ru_msgsnd; /* messages sent */ 44 long ru_msgrcv; /* messages received */ 45 long ru_nsignals; /* signals received */ 46 long ru_nvcsw; /* voluntary context switches */ 47 long ru_nivcsw; /* involuntary " */ 48 #define ru_last ru_nivcsw 49 }; 50 51 /* 52 * Resource limits 53 */ 54 #define RLIMIT_CPU 0 /* cpu time in milliseconds */ 55 #define RLIMIT_FSIZE 1 /* maximum file size */ 56 #define RLIMIT_DATA 2 /* data size */ 57 #define RLIMIT_STACK 3 /* stack size */ 58 #define RLIMIT_CORE 4 /* core file size */ 59 #define RLIMIT_RSS 5 /* resident set size */ 60 #define RLIMIT_MEMLOCK 6 /* locked-in-memory address space */ 61 #define RLIMIT_NPROC 7 /* number of processes */ 62 #define RLIMIT_NOFILE 8 /* number of open files */ 63 64 #define RLIM_NLIMITS 9 /* number of resource limits */ 65 66 #define RLIM_INFINITY (((u_quad_t)1 << 63) - 1) 67 68 struct orlimit { 69 int32_t rlim_cur; /* current (soft) limit */ 70 int32_t rlim_max; /* maximum value for rlim_cur */ 71 }; 72 73 struct rlimit { 74 quad_t rlim_cur; /* current (soft) limit */ 75 quad_t rlim_max; /* maximum value for rlim_cur */ 76 }; 77 78 /* Load average structure. */ 79 struct loadavg { 80 fixpt_t ldavg[3]; 81 long fscale; 82 }; 83 84 #ifdef KERNEL 85 extern struct loadavg averunnable; 86 87 #else 88 #include <sys/cdefs.h> 89 90 __BEGIN_DECLS 91 int getpriority __P((int, int)); 92 int getrlimit __P((int, struct rlimit *)); 93 int getrusage __P((int, struct rusage *)); 94 int setpriority __P((int, int, int)); 95 int setrlimit __P((int, const struct rlimit *)); 96 __END_DECLS 97 98 #endif /* KERNEL */ 99 #endif /* !_SYS_RESOURCE_H_ */ 100