home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / sys / resource.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  5.0 KB  |  146 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    resource.h,v $
  29.  * Revision 2.1  92/04/21  17:16:04  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. /*
  36.  * Copyright (c) 1982, 1986 The Regents of the University of California.
  37.  * All rights reserved.
  38.  *
  39.  * Redistribution and use in source and binary forms, with or without
  40.  * modification, are permitted provided that the following conditions
  41.  * are met:
  42.  * 1. Redistributions of source code must retain the above copyright
  43.  *    notice, this list of conditions and the following disclaimer.
  44.  * 2. Redistributions in binary form must reproduce the above copyright
  45.  *    notice, this list of conditions and the following disclaimer in the
  46.  *    documentation and/or other materials provided with the distribution.
  47.  * 3. All advertising materials mentioning features or use of this software
  48.  *    must display the following acknowledgement:
  49.  *    This product includes software developed by the University of
  50.  *    California, Berkeley and its contributors.
  51.  * 4. Neither the name of the University nor the names of its contributors
  52.  *    may be used to endorse or promote products derived from this software
  53.  *    without specific prior written permission.
  54.  *
  55.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  56.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  57.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  58.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  59.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  60.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  61.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  62.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  63.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  64.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  65.  * SUCH DAMAGE.
  66.  *
  67.  *    @(#)resource.h    7.5 (Berkeley) 3/17/91
  68.  */
  69.  
  70. #ifndef _RESOURCE_H_
  71. #define    _RESOURCE_H_
  72.  
  73. /*
  74.  * Process priority specifications to get/setpriority.
  75.  */
  76. #define    PRIO_MIN    -20
  77. #define    PRIO_MAX    20
  78.  
  79. #define    PRIO_PROCESS    0
  80. #define    PRIO_PGRP    1
  81. #define    PRIO_USER    2
  82.  
  83. /*
  84.  * Resource utilization information.
  85.  */
  86.  
  87. #define    RUSAGE_SELF    0
  88. #define    RUSAGE_CHILDREN    -1
  89.  
  90. struct    rusage {
  91.     struct timeval ru_utime;    /* user time used */
  92.     struct timeval ru_stime;    /* system time used */
  93.     long    ru_maxrss;        /* max resident set size */
  94. #define    ru_first    ru_ixrss
  95.     long    ru_ixrss;        /* integral shared memory size */
  96.     long    ru_idrss;        /* integral unshared data " */
  97.     long    ru_isrss;        /* integral unshared stack " */
  98.     long    ru_minflt;        /* page reclaims */
  99.     long    ru_majflt;        /* page faults */
  100.     long    ru_nswap;        /* swaps */
  101.     long    ru_inblock;        /* block input operations */
  102.     long    ru_oublock;        /* block output operations */
  103.     long    ru_msgsnd;        /* messages sent */
  104.     long    ru_msgrcv;        /* messages received */
  105.     long    ru_nsignals;        /* signals received */
  106.     long    ru_nvcsw;        /* voluntary context switches */
  107.     long    ru_nivcsw;        /* involuntary " */
  108. #define    ru_last        ru_nivcsw
  109. };
  110.  
  111. /*
  112.  * Resource limits
  113.  */
  114. #define    RLIMIT_CPU    0        /* cpu time in milliseconds */
  115. #define    RLIMIT_FSIZE    1        /* maximum file size */
  116. #define    RLIMIT_DATA    2        /* data size */
  117. #define    RLIMIT_STACK    3        /* stack size */
  118. #define    RLIMIT_CORE    4        /* core file size */
  119. #define    RLIMIT_RSS    5        /* resident set size */
  120. #define    RLIMIT_MEMLOCK    6        /* locked-in-memory address space */
  121. #define    RLIMIT_NPROC    7        /* number of processes */
  122. #define    RLIMIT_OFILE    8        /* number of open files */
  123.  
  124. #define    RLIM_NLIMITS    9        /* number of resource limits */
  125.  
  126. #define    RLIM_INFINITY    0x7fffffff
  127.  
  128. struct rlimit {
  129.     long    rlim_cur;        /* current (soft) limit */
  130.     long    rlim_max;        /* maximum value for rlim_cur */
  131. };
  132.  
  133. #ifndef KERNEL
  134. #include <sys/cdefs.h>
  135.  
  136. __BEGIN_DECLS
  137. int    getpriority __P((int, int));
  138. int    getrlimit __P((int, struct rlimit *));
  139. int    getrusage __P((int, struct rusage *));
  140. int    setpriority __P((int, int, int));
  141. int    setrlimit __P((int, const struct rlimit *));
  142. __END_DECLS
  143.  
  144. #endif    /* !KERNEL */
  145. #endif    /* !_RESOURCE_H_ */
  146.