w_rusage.h

00001 /*<std-header orig-src='shore' incl-file-exclusion='W_RUSAGE_H'>
00002 
00003  $Id: w_rusage.h,v 1.13 2010/05/26 01:20:25 nhall Exp $
00004 
00005 SHORE -- Scalable Heterogeneous Object REpository
00006 
00007 Copyright (c) 1994-99 Computer Sciences Department, University of
00008                       Wisconsin -- Madison
00009 All Rights Reserved.
00010 
00011 Permission to use, copy, modify and distribute this software and its
00012 documentation is hereby granted, provided that both the copyright
00013 notice and this permission notice appear in all copies of the
00014 software, derivative works or modified versions, and any portions
00015 thereof, and that both notices appear in supporting documentation.
00016 
00017 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY
00018 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS
00019 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND
00020 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
00021 
00022 This software was developed with support by the Advanced Research
00023 Project Agency, ARPA order number 018 (formerly 8230), monitored by
00024 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518.
00025 Further funding for this work was provided by DARPA through
00026 Rome Research Laboratory Contract No. F30602-97-2-0247.
00027 
00028 */
00029 
00030 #ifndef W_RUSAGE_H
00031 #define W_RUSAGE_H
00032 
00033 #include "w_defines.h"
00034 
00035 /*  -- do not edit anything above this line --   </std-header>*/
00036 
00037 #include <sys/time.h>
00038 
00039 #ifdef Linux
00040     extern "C" {
00041 #endif
00042 #include <sys/resource.h>
00043 #ifdef Linux
00044     }
00045 #endif
00046 
00047 /**\cond skip */
00048 /* XXX
00049  * 
00050  * This needs to be fixed.  The system should not be dependent
00051  * upon unix rusage facilities.  It should adapt to whatever is 
00052  * available (if anything)  on the host system.
00053  */
00054 
00055 /* XXX using kernel include file to do this is bogus.   It would be better
00056    to say "enough of the actual defines are defined", rather than determining
00057    whether the kernel include file has been sucked in.  Heck, we might
00058    not be including the right file! */
00059 
00060 /* _SYS_RESOURCE_H_ for *BSD unix boxes */
00061 /* _SYS_RESOURCE_INCLUDED for HPUX */
00062 #if !defined(_SYS_RESOURCE_H) && !defined(_SYS_RESOURCE_H_) && !defined(_SYS_RESOURCE_INCLUDED)
00063 #define    _SYS_RESOURCE_H
00064 
00065 /*
00066  * Process priority specifications
00067  */
00068 
00069 #define    PRIO_PROCESS    0
00070 #define    PRIO_PGRP    1
00071 #define    PRIO_USER    2
00072 
00073 
00074 /*
00075  * Resource limits
00076  */
00077 
00078 #define    RLIMIT_CPU    0        /* cpu time in milliseconds */
00079 #define    RLIMIT_FSIZE    1        /* maximum file size */
00080 #define    RLIMIT_DATA    2        /* data size */
00081 #define    RLIMIT_STACK    3        /* stack size */
00082 #define    RLIMIT_CORE    4        /* core file size */
00083 #define    RLIMIT_NOFILE    5        /* file descriptors */
00084 #define    RLIMIT_VMEM    6        /* maximum mapped memory */
00085 #define    RLIMIT_AS    RLIMIT_VMEM
00086 
00087 #define    RLIM_NLIMITS    7        /* number of resource limits */
00088 
00089 #define    RLIM_INFINITY    0x7fffffff
00090 
00091 typedef unsigned long rlim_t;
00092 
00093 struct rlimit {
00094     rlim_t    rlim_cur;        /* current limit */
00095     rlim_t    rlim_max;        /* maximum value for rlim_cur */
00096 };
00097 
00098 #define    RUSAGE_SELF    0
00099 #define    RUSAGE_CHILDREN    -1
00100 
00101 struct    rusage {
00102     struct timeval ru_utime;    /* user time used */
00103     struct timeval ru_stime;    /* system time used */
00104     long    ru_maxrss;        /* XXX: 0 */
00105     long    ru_ixrss;        /* XXX: 0 */
00106     long    ru_idrss;        /* XXX: sum of rm_asrss */
00107     long    ru_isrss;        /* XXX: 0 */
00108     long    ru_minflt;        /* any page faults not requiring I/O */
00109     long    ru_majflt;        /* any page faults requiring I/O */
00110     long    ru_nswap;        /* swaps */
00111     long    ru_inblock;        /* block input operations */
00112     long    ru_oublock;        /* block output operations */
00113     long    ru_msgsnd;        /* messages sent */
00114     long    ru_msgrcv;        /* messages received */
00115     long    ru_nsignals;        /* signals received */
00116     long    ru_nvcsw;        /* voluntary context switches */
00117     long    ru_nivcsw;        /* involuntary " */
00118 };
00119 #endif    /* _SYS_RESOURCE_H */
00120 
00121 #ifndef Linux
00122 #ifndef getrusage
00123     extern "C" int getrusage(int x , struct rusage* use);
00124 #endif /* getrusage */
00125 #endif /* Linux  */
00126 
00127 
00128 /**\endcond skip */
00129 
00130 /*<std-footer incl-file-exclusion='W_RUSAGE_H'>  -- do not edit anything below this line -- */
00131 
00132 #endif          /*</std-footer>*/

Generated on Wed Jul 7 17:22:32 2010 for Shore Storage Manager by  doxygen 1.4.7