os/ossrv/genericopenlibs/openenvcore/include/sys/resource.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*-
sl@0
     2
 * Copyright (c) 1982, 1986, 1993
sl@0
     3
 *	The Regents of the University of California.  All rights reserved.
sl@0
     4
 *
sl@0
     5
 * Redistribution and use in source and binary forms, with or without
sl@0
     6
 * modification, are permitted provided that the following conditions
sl@0
     7
 * are met:
sl@0
     8
 * 1. Redistributions of source code must retain the above copyright
sl@0
     9
 *    notice, this list of conditions and the following disclaimer.
sl@0
    10
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    11
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    12
 *    documentation and/or other materials provided with the distribution.
sl@0
    13
 * 4. Neither the name of the University nor the names of its contributors
sl@0
    14
 *    may be used to endorse or promote products derived from this software
sl@0
    15
 *    without specific prior written permission.
sl@0
    16
 *
sl@0
    17
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0
    18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    20
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0
    21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    27
 * SUCH DAMAGE.
sl@0
    28
 *
sl@0
    29
 *	@(#)resource.h	8.4 (Berkeley) 1/9/95
sl@0
    30
 * $FreeBSD: src/sys/sys/resource.h,v 1.29 2005/01/07 02:29:23 imp Exp $
sl@0
    31
 *
sl@0
    32
 * © Portions copyright (c) 2006 Nokia Corporation.  All rights reserved.
sl@0
    33
 */
sl@0
    34
sl@0
    35
#ifndef _SYS_RESOURCE_H_
sl@0
    36
#define	_SYS_RESOURCE_H_
sl@0
    37
sl@0
    38
#include <sys/cdefs.h>
sl@0
    39
#include <sys/_timeval.h>
sl@0
    40
#include <sys/_types.h>
sl@0
    41
sl@0
    42
#ifdef __SYMBIAN32__
sl@0
    43
#include <_ansi.h>
sl@0
    44
#endif //__SYMBIAN32__
sl@0
    45
/*
sl@0
    46
 * Process priority specifications to get/setpriority.
sl@0
    47
 */
sl@0
    48
#define	PRIO_MIN	-20
sl@0
    49
#define	PRIO_MAX	20
sl@0
    50
sl@0
    51
#define	PRIO_PROCESS	0
sl@0
    52
#define	PRIO_PGRP	1
sl@0
    53
#define	PRIO_USER	2
sl@0
    54
sl@0
    55
#ifdef __SYMBIAN32__
sl@0
    56
enum {
sl@0
    57
    UPPER_LIMIT_PRIORITY_HIGHEST = -20,
sl@0
    58
    LOWER_LIMIT_PRIORITY_HIGHEST = -16,
sl@0
    59
 
sl@0
    60
    UPPER_LIMIT_PRIORITY_ABOVE_NORMAL = -15,
sl@0
    61
    LOWER_LIMIT_PRIORITY_ABOVE_NORMAL = -6,
sl@0
    62
 
sl@0
    63
    UPPER_LIMIT_PRIORITY_NORMAL = -5,
sl@0
    64
    LOWER_LIMIT_PRIORITY_NORMAL = 4,
sl@0
    65
 
sl@0
    66
    UPPER_LIMIT_PRIORITY_BELOW_NORMAL = 5,
sl@0
    67
    LOWER_LIMIT_PRIORITY_BELOW_NORMAL = 14,
sl@0
    68
 
sl@0
    69
    UPPER_LIMIT_PRIORITY_LOWEST = 15,
sl@0
    70
    LOWER_LIMIT_PRIORITY_LOWEST = 20
sl@0
    71
};
sl@0
    72
#endif /* __SYMBIAN32__ */
sl@0
    73
/*
sl@0
    74
 * Resource utilization information.
sl@0
    75
 *
sl@0
    76
 * Locking key:
sl@0
    77
 *      c - locked by proc mtx
sl@0
    78
 *      j - locked by sched_lock mtx
sl@0
    79
 *      n - not locked, lazy
sl@0
    80
 */
sl@0
    81
sl@0
    82
#define	RUSAGE_SELF	0
sl@0
    83
#define	RUSAGE_CHILDREN	-1
sl@0
    84
sl@0
    85
struct rusage {
sl@0
    86
	struct timeval ru_utime;	/* (n) user time used */
sl@0
    87
	struct timeval ru_stime;	/* (n) system time used */
sl@0
    88
	long	ru_maxrss;		/* (j) max resident set size */
sl@0
    89
#define	ru_first	ru_ixrss
sl@0
    90
	long	ru_ixrss;		/* (j) integral shared memory size */
sl@0
    91
	long	ru_idrss;		/* (j) integral unshared data " */
sl@0
    92
	long	ru_isrss;		/* (j) integral unshared stack " */
sl@0
    93
	long	ru_minflt;		/* (c) page reclaims */
sl@0
    94
	long	ru_majflt;		/* (c) page faults */
sl@0
    95
	long	ru_nswap;		/* (c + j) swaps */
sl@0
    96
	long	ru_inblock;		/* (n) block input operations */
sl@0
    97
	long	ru_oublock;		/* (n) block output operations */
sl@0
    98
	long	ru_msgsnd;		/* (n) messages sent */
sl@0
    99
	long	ru_msgrcv;		/* (n) messages received */
sl@0
   100
	long	ru_nsignals;		/* (c) signals received */
sl@0
   101
	long	ru_nvcsw;		/* (j) voluntary context switches */
sl@0
   102
	long	ru_nivcsw;		/* (j) involuntary " */
sl@0
   103
#define	ru_last		ru_nivcsw
sl@0
   104
};
sl@0
   105
sl@0
   106
/*
sl@0
   107
 * Resource limits
sl@0
   108
 */
sl@0
   109
#define	RLIMIT_CPU	0		/* cpu time in milliseconds */
sl@0
   110
#define	RLIMIT_FSIZE	1		/* maximum file size */
sl@0
   111
#define	RLIMIT_DATA	2		/* data size */
sl@0
   112
#define	RLIMIT_STACK	3		/* stack size */
sl@0
   113
#define	RLIMIT_CORE	4		/* core file size */
sl@0
   114
#define	RLIMIT_RSS	5		/* resident set size */
sl@0
   115
#define	RLIMIT_MEMLOCK	6		/* locked-in-memory address space */
sl@0
   116
#define	RLIMIT_NPROC	7		/* number of processes */
sl@0
   117
#define	RLIMIT_NOFILE	8		/* number of open files */
sl@0
   118
#define	RLIMIT_SBSIZE	9		/* maximum size of all socket buffers */
sl@0
   119
#define RLIMIT_VMEM	10		/* virtual process size (inclusive of mmap) */
sl@0
   120
#define	RLIMIT_AS	RLIMIT_VMEM	/* standard name for RLIMIT_VMEM */
sl@0
   121
sl@0
   122
#define	RLIM_NLIMITS	11		/* number of resource limits */
sl@0
   123
sl@0
   124
#define	RLIM_INFINITY	((rlim_t)(((uint64_t)1 << 63) - 1))
sl@0
   125
/* XXX Missing: RLIM_SAVED_MAX, RLIM_SAVED_CUR */
sl@0
   126
sl@0
   127
sl@0
   128
/*
sl@0
   129
 * Resource limit string identifiers
sl@0
   130
 */
sl@0
   131
sl@0
   132
#ifdef _RLIMIT_IDENT
sl@0
   133
static char *rlimit_ident[] = {
sl@0
   134
	"cpu",
sl@0
   135
	"fsize",
sl@0
   136
	"data",
sl@0
   137
	"stack",
sl@0
   138
	"core",
sl@0
   139
	"rss",
sl@0
   140
	"memlock",
sl@0
   141
	"nproc",
sl@0
   142
	"nofile",
sl@0
   143
	"sbsize",
sl@0
   144
	"vmem",
sl@0
   145
};
sl@0
   146
#endif
sl@0
   147
sl@0
   148
#ifndef _RLIM_T_DECLARED
sl@0
   149
typedef	__rlim_t	rlim_t;
sl@0
   150
#define	_RLIM_T_DECLARED
sl@0
   151
#endif
sl@0
   152
sl@0
   153
struct rlimit {
sl@0
   154
	rlim_t	rlim_cur;		/* current (soft) limit */
sl@0
   155
	rlim_t	rlim_max;		/* maximum value for rlim_cur */
sl@0
   156
};
sl@0
   157
sl@0
   158
#if __BSD_VISIBLE
sl@0
   159
sl@0
   160
struct orlimit {
sl@0
   161
	__int32_t	rlim_cur;	/* current (soft) limit */
sl@0
   162
	__int32_t	rlim_max;	/* maximum value for rlim_cur */
sl@0
   163
};
sl@0
   164
sl@0
   165
struct loadavg {
sl@0
   166
	__fixpt_t	ldavg[3];
sl@0
   167
	long		fscale;
sl@0
   168
};
sl@0
   169
sl@0
   170
#define	CP_USER		0
sl@0
   171
#define	CP_NICE		1
sl@0
   172
#define	CP_SYS		2
sl@0
   173
#define	CP_INTR		3
sl@0
   174
#define	CP_IDLE		4
sl@0
   175
#define	CPUSTATES	5
sl@0
   176
sl@0
   177
#endif	/* __BSD_VISIBLE */
sl@0
   178
sl@0
   179
#ifdef _KERNEL
sl@0
   180
sl@0
   181
extern struct loadavg averunnable;
sl@0
   182
extern long cp_time[CPUSTATES];
sl@0
   183
sl@0
   184
#else
sl@0
   185
sl@0
   186
__BEGIN_DECLS
sl@0
   187
/* XXX 2nd arg to [gs]etpriority() should be an id_t */
sl@0
   188
IMPORT_C int	getpriority(int, int);
sl@0
   189
IMPORT_C int	setpriority(int, int, int);
sl@0
   190
__END_DECLS
sl@0
   191
sl@0
   192
#endif	/* _KERNEL */
sl@0
   193
#endif	/* !_SYS_RESOURCE_H_ */