CMS 3D CMS Logo

ResourceInfo.h

Go to the documentation of this file.
00001 #ifndef CLASSLIB_SYSAPI_RESOURCE_INFO_H
00002 # define CLASSLIB_SYSAPI_RESOURCE_INFO_H
00003 
00004 //<<<<<< INCLUDES                                                       >>>>>>
00005 
00006 # include "classlib/sysapi/system.h"
00007 # ifdef _WIN32
00008 #  include <windows.h>
00009 # else
00010 #  include <sys/param.h>
00011 #  if HAVE_SYS_RESOURCE_H
00012 #   include <sys/time.h>
00013 #   include <sys/resource.h>
00014 #   include <unistd.h>
00015 #  endif
00016 #  if HAVE_PROCFS_H
00017 #   include <procfs.h>
00018 #  endif
00019 # endif
00020 # include <stdio.h>
00021 # include <limits.h>
00022 # include <cerrno>
00023 
00024 //<<<<<< PUBLIC DEFINES                                                 >>>>>>
00025 
00026 # if !defined RLIMIT_NOFILE && defined RLIMIT_OFILE
00027 #  define RLIMIT_NOFILE RLIMIT_OFILE
00028 # endif
00029 # if !defined RLIMIT_AS && defined RLIMIT_VMEM
00030 #  define RLIMIT_AS RLIMIT_VMEM
00031 # endif
00032 
00033 # if HAVE_GETRLIMIT
00034 #  define GETRLIMIT(lim)                                        \
00035      do { rlimit l;                                             \
00036          if (::getrlimit (lim, &l) < 0)                         \
00037              throw SystemError (errno);                         \
00038          if (l.rlim_cur != RLIM_INFINITY)                       \
00039              soft = l.rlim_cur;                                 \
00040          if (l.rlim_max != RLIM_INFINITY)                       \
00041              hard = l.rlim_max;                                 \
00042      } while (0)
00043 #  define SETRLIMIT(lim)                                        \
00044      do { rlimit l;                                             \
00045          l.rlim_cur = (soft == LIM_INFINITE ? RLIM_INFINITY : soft);\
00046          l.rlim_max = (hard == LIM_INFINITE ? RLIM_INFINITY : hard);\
00047          if (::setrlimit (lim, &l) < 0)                         \
00048             throw SystemError (errno);                          \
00049      } while (0)
00050 # endif
00051 
00052 # ifdef HAVE_ULIMIT
00053 #  define GETULIMIT(t,scale)                                    \
00054      do { long val = ulimit (t);                                \
00055           if (val < 0) throw SystemError (errno);               \
00056           soft = hard = val * scale;                            \
00057      } while (0)
00058 # endif
00059 
00060 //<<<<<< PUBLIC CONSTANTS                                               >>>>>>
00061 //<<<<<< PUBLIC TYPES                                                   >>>>>>
00062 //<<<<<< PUBLIC VARIABLES                                               >>>>>>
00063 
00064 #if HAVE_SYM_BSS_START
00065 extern "C" char __bss_start [];
00066 #endif
00067 #if HAVE_SYM_DATA_START
00068 extern "C" char __data_start [];
00069 #endif
00070 #if HAVE_SYM_EDATA
00071 extern "C" char _edata [];
00072 #endif
00073 #if HAVE_SYM_ETEXT
00074 extern "C" char _etext [];
00075 #endif
00076 #if HAVE_SYM_END
00077 extern "C" char _end [];
00078 #endif
00079 
00080 //<<<<<< PUBLIC FUNCTIONS                                               >>>>>>
00081 //<<<<<< CLASS DECLARATIONS                                             >>>>>>
00082 //<<<<<< INLINE PUBLIC FUNCTIONS                                        >>>>>>
00083 //<<<<<< INLINE MEMBER FUNCTIONS                                        >>>>>>
00084 
00085 #endif // CLASSLIB_SYSAPI_RESOURCE_INFO_H

Generated on Tue Jun 9 17:38:52 2009 for CMSSW by  doxygen 1.5.4