resource.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#ifndef _SYS_RESOURCE_H
#define _SYS_RESOURCE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/feature_tests.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Process priority specifications
*/
#define PRIO_PROCESS 0
#define PRIO_PGRP 1
#define PRIO_USER 2
#define PRIO_GROUP 3
#define PRIO_SESSION 4
#define PRIO_LWP 5
#define PRIO_TASK 6
#define PRIO_PROJECT 7
#define PRIO_ZONE 8
#define PRIO_CONTRACT 9
/*
* Resource limits
*/
#define RLIMIT_CPU 0 /* cpu time in seconds */
#define RLIMIT_AS RLIMIT_VMEM
#if defined(_LP64)
typedef unsigned long rlim_t;
#define RLIM_INFINITY (-3l)
#define RLIM_SAVED_MAX (-2l)
#define RLIM_SAVED_CUR (-1l)
#else /* _LP64 */
/*
* The definitions of the following types and constants differ between the
* regular and large file compilation environments.
*/
#if _FILE_OFFSET_BITS == 32
typedef unsigned long rlim_t;
#define RLIM_INFINITY 0x7fffffff
#define RLIM_SAVED_MAX 0x7ffffffe
#define RLIM_SAVED_CUR 0x7ffffffd
#else /* _FILE_OFFSET_BITS == 32 */
typedef u_longlong_t rlim_t;
#endif /* _FILE_OFFSET_BITS == 32 */
#endif /* _LP64 */
#if defined(_SYSCALL32)
/* Kernel's view of user ILP32 rlimits */
#define RLIM32_INFINITY 0x7fffffff
#define RLIM32_SAVED_MAX 0x7ffffffe
#define RLIM32_SAVED_CUR 0x7ffffffd
struct rlimit32 {
};
#endif /* _SYSCALL32 */
struct rlimit {
};
/* transitional large file interface versions */
#ifdef _LARGEFILE64_SOURCE
typedef u_longlong_t rlim64_t;
struct rlimit64 {
};
#endif
/*
* Although the saved rlimits were initially introduced by the large file API,
* they are now available for all resource limits on the 64-bit kernel and for
* cpu time and file size limits on the 32-bit kernel.
*/
#if defined(_LP64)
#else /* _LP64 */
#endif /* _LP64 */
struct rusage {
long ru_maxrss; /* <unimp> */
long ru_ixrss; /* <unimp> */
long ru_idrss; /* <unimp> */
long ru_isrss; /* <unimp> */
long ru_minflt; /* any page faults not requiring I/O */
long ru_majflt; /* any page faults requiring I/O */
long ru_nswap; /* swaps */
long ru_inblock; /* block input operations */
long ru_oublock; /* block output operations */
long ru_msgsnd; /* streams messsages sent */
long ru_msgrcv; /* streams messages received */
long ru_nsignals; /* signals received */
long ru_nvcsw; /* voluntary context switches */
long ru_nivcsw; /* involuntary " */
};
#define _RUSAGESYS_GETRUSAGE 0 /* rusage process */
#if defined(_SYSCALL32)
struct rusage32 {
int ru_maxrss; /* <unimp> */
int ru_ixrss; /* <unimp> */
int ru_idrss; /* <unimp> */
int ru_isrss; /* <unimp> */
int ru_minflt; /* any page faults not requiring I/O */
int ru_majflt; /* any page faults requiring I/O */
int ru_nswap; /* swaps */
int ru_inblock; /* block input operations */
int ru_oublock; /* block output operations */
int ru_msgsnd; /* streams messages sent */
int ru_msgrcv; /* streams messages received */
int ru_nsignals; /* signals received */
int ru_nvcsw; /* voluntary context switches */
int ru_nivcsw; /* involuntary " */
};
#endif /* _SYSCALL32 */
#ifdef _KERNEL
struct proc;
#else
#define RUSAGE_SELF 0
#define RUSAGE_LWP 1
#define RUSAGE_CHILDREN -1
/*
* large file compilation environment setup
*/
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#define setrlimit setrlimit64
#define getrlimit getrlimit64
#endif
#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
#if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
/*
* In the LP64 compilation environment, map large file interfaces
* back to native versions where possible.
*/
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else
#define setrlimit64 setrlimit
#define getrlimit64 getrlimit
#endif
#endif /* _LP64 && _LARGEFILE64_SOURCE */
#if defined(__STDC__)
/* transitional large file interfaces */
!defined(__PRAGMA_REDEFINE_EXTNAME))
extern int setrlimit64(int, const struct rlimit64 *);
extern int getrlimit64(int, struct rlimit64 *);
#endif /* _LARGEFILE64_SOURCE... */
extern int getpriority(int, id_t);
extern int setpriority(int, id_t, int);
#else /* __STDC__ */
extern int getrlimit();
extern int setrlimit();
/* transitional large file interfaces */
!defined(__PRAGMA_REDEFINE_EXTNAME))
extern int setrlimit64();
extern int getrlimit64();
#endif /* _LARGEFILE64_SOURCE... */
extern int getpriority();
extern int setpriority();
extern int getrusage();
#endif /* __STDC__ */
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_RESOURCE_H */