sl@0: /*- sl@0: * Copyright (c) 1982, 1986, 1993 sl@0: * The Regents of the University of California. All rights reserved. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the above copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 4. Neither the name of the University nor the names of its contributors sl@0: * may be used to endorse or promote products derived from this software sl@0: * without specific prior written permission. sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * sl@0: * @(#)resource.h 8.4 (Berkeley) 1/9/95 sl@0: * $FreeBSD: src/sys/sys/resource.h,v 1.29 2005/01/07 02:29:23 imp Exp $ sl@0: * sl@0: * © Portions copyright (c) 2006 Nokia Corporation. All rights reserved. sl@0: */ sl@0: sl@0: #ifndef _SYS_RESOURCE_H_ sl@0: #define _SYS_RESOURCE_H_ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: #include <_ansi.h> sl@0: #endif //__SYMBIAN32__ sl@0: /* sl@0: * Process priority specifications to get/setpriority. sl@0: */ sl@0: #define PRIO_MIN -20 sl@0: #define PRIO_MAX 20 sl@0: sl@0: #define PRIO_PROCESS 0 sl@0: #define PRIO_PGRP 1 sl@0: #define PRIO_USER 2 sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: enum { sl@0: UPPER_LIMIT_PRIORITY_HIGHEST = -20, sl@0: LOWER_LIMIT_PRIORITY_HIGHEST = -16, sl@0: sl@0: UPPER_LIMIT_PRIORITY_ABOVE_NORMAL = -15, sl@0: LOWER_LIMIT_PRIORITY_ABOVE_NORMAL = -6, sl@0: sl@0: UPPER_LIMIT_PRIORITY_NORMAL = -5, sl@0: LOWER_LIMIT_PRIORITY_NORMAL = 4, sl@0: sl@0: UPPER_LIMIT_PRIORITY_BELOW_NORMAL = 5, sl@0: LOWER_LIMIT_PRIORITY_BELOW_NORMAL = 14, sl@0: sl@0: UPPER_LIMIT_PRIORITY_LOWEST = 15, sl@0: LOWER_LIMIT_PRIORITY_LOWEST = 20 sl@0: }; sl@0: #endif /* __SYMBIAN32__ */ sl@0: /* sl@0: * Resource utilization information. sl@0: * sl@0: * Locking key: sl@0: * c - locked by proc mtx sl@0: * j - locked by sched_lock mtx sl@0: * n - not locked, lazy sl@0: */ sl@0: sl@0: #define RUSAGE_SELF 0 sl@0: #define RUSAGE_CHILDREN -1 sl@0: sl@0: struct rusage { sl@0: struct timeval ru_utime; /* (n) user time used */ sl@0: struct timeval ru_stime; /* (n) system time used */ sl@0: long ru_maxrss; /* (j) max resident set size */ sl@0: #define ru_first ru_ixrss sl@0: long ru_ixrss; /* (j) integral shared memory size */ sl@0: long ru_idrss; /* (j) integral unshared data " */ sl@0: long ru_isrss; /* (j) integral unshared stack " */ sl@0: long ru_minflt; /* (c) page reclaims */ sl@0: long ru_majflt; /* (c) page faults */ sl@0: long ru_nswap; /* (c + j) swaps */ sl@0: long ru_inblock; /* (n) block input operations */ sl@0: long ru_oublock; /* (n) block output operations */ sl@0: long ru_msgsnd; /* (n) messages sent */ sl@0: long ru_msgrcv; /* (n) messages received */ sl@0: long ru_nsignals; /* (c) signals received */ sl@0: long ru_nvcsw; /* (j) voluntary context switches */ sl@0: long ru_nivcsw; /* (j) involuntary " */ sl@0: #define ru_last ru_nivcsw sl@0: }; sl@0: sl@0: /* sl@0: * Resource limits sl@0: */ sl@0: #define RLIMIT_CPU 0 /* cpu time in milliseconds */ sl@0: #define RLIMIT_FSIZE 1 /* maximum file size */ sl@0: #define RLIMIT_DATA 2 /* data size */ sl@0: #define RLIMIT_STACK 3 /* stack size */ sl@0: #define RLIMIT_CORE 4 /* core file size */ sl@0: #define RLIMIT_RSS 5 /* resident set size */ sl@0: #define RLIMIT_MEMLOCK 6 /* locked-in-memory address space */ sl@0: #define RLIMIT_NPROC 7 /* number of processes */ sl@0: #define RLIMIT_NOFILE 8 /* number of open files */ sl@0: #define RLIMIT_SBSIZE 9 /* maximum size of all socket buffers */ sl@0: #define RLIMIT_VMEM 10 /* virtual process size (inclusive of mmap) */ sl@0: #define RLIMIT_AS RLIMIT_VMEM /* standard name for RLIMIT_VMEM */ sl@0: sl@0: #define RLIM_NLIMITS 11 /* number of resource limits */ sl@0: sl@0: #define RLIM_INFINITY ((rlim_t)(((uint64_t)1 << 63) - 1)) sl@0: /* XXX Missing: RLIM_SAVED_MAX, RLIM_SAVED_CUR */ sl@0: sl@0: sl@0: /* sl@0: * Resource limit string identifiers sl@0: */ sl@0: sl@0: #ifdef _RLIMIT_IDENT sl@0: static char *rlimit_ident[] = { sl@0: "cpu", sl@0: "fsize", sl@0: "data", sl@0: "stack", sl@0: "core", sl@0: "rss", sl@0: "memlock", sl@0: "nproc", sl@0: "nofile", sl@0: "sbsize", sl@0: "vmem", sl@0: }; sl@0: #endif sl@0: sl@0: #ifndef _RLIM_T_DECLARED sl@0: typedef __rlim_t rlim_t; sl@0: #define _RLIM_T_DECLARED sl@0: #endif sl@0: sl@0: struct rlimit { sl@0: rlim_t rlim_cur; /* current (soft) limit */ sl@0: rlim_t rlim_max; /* maximum value for rlim_cur */ sl@0: }; sl@0: sl@0: #if __BSD_VISIBLE sl@0: sl@0: struct orlimit { sl@0: __int32_t rlim_cur; /* current (soft) limit */ sl@0: __int32_t rlim_max; /* maximum value for rlim_cur */ sl@0: }; sl@0: sl@0: struct loadavg { sl@0: __fixpt_t ldavg[3]; sl@0: long fscale; sl@0: }; sl@0: sl@0: #define CP_USER 0 sl@0: #define CP_NICE 1 sl@0: #define CP_SYS 2 sl@0: #define CP_INTR 3 sl@0: #define CP_IDLE 4 sl@0: #define CPUSTATES 5 sl@0: sl@0: #endif /* __BSD_VISIBLE */ sl@0: sl@0: #ifdef _KERNEL sl@0: sl@0: extern struct loadavg averunnable; sl@0: extern long cp_time[CPUSTATES]; sl@0: sl@0: #else sl@0: sl@0: __BEGIN_DECLS sl@0: /* XXX 2nd arg to [gs]etpriority() should be an id_t */ sl@0: IMPORT_C int getpriority(int, int); sl@0: IMPORT_C int setpriority(int, int, int); sl@0: __END_DECLS sl@0: sl@0: #endif /* _KERNEL */ sl@0: #endif /* !_SYS_RESOURCE_H_ */