os_resource.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    os_resource.h
00006  *
00007  *  definitions for XSI resource operations
00008  *
00009  *  $Id: os_resource.h 81697 2008-05-14 18:33:11Z johnnyw $
00010  *
00011  *  @author Don Hinton <dhinton@dresystems.com>
00012  *  @author This code was originally in various places including ace/OS.h.
00013  */
00014 //=============================================================================
00015 
00016 #ifndef ACE_OS_INCLUDE_SYS_OS_RESOURCE_H
00017 #define ACE_OS_INCLUDE_SYS_OS_RESOURCE_H
00018 
00019 #include /**/ "ace/pre.h"
00020 
00021 #include "ace/config-lite.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 #include "ace/os_include/sys/os_time.h"
00028 #include "ace/os_include/sys/os_types.h"
00029 
00030 #if !defined (ACE_LACKS_SYS_RESOURCE_H)
00031 #  include /**/ <sys/resource.h>
00032 #endif /* !ACE_LACKS_SYS_RESOURCE_H */
00033 
00034 #if defined (ACE_HAS_SYS_SYSTEMINFO_H)
00035 #  include /**/ <sys/systeminfo.h>
00036 #endif /* ACE_HAS_SYS_SYSTEMINFO_H */
00037 
00038 #if defined (ACE_HAS_SYS_SYSCALL_H)
00039 #  include /**/ <sys/syscall.h>
00040 #endif /* ACE_HAS_SYS_SYSCALL_H */
00041 
00042 // prusage_t is defined in <sys/procfs.h>
00043 #if defined (ACE_HAS_PROC_FS)
00044 #  include /**/ <sys/procfs.h>
00045 #endif  /* ACE_HAS_PROC_FS */
00046 
00047 // Place all additions (especially function declarations) within extern "C" {}
00048 #ifdef __cplusplus
00049 extern "C"
00050 {
00051 #endif /* __cplusplus */
00052 
00053 // There must be a better way to do this...
00054 #if !defined (RLIMIT_NOFILE) && !defined (ACE_LACKS_RLIMIT_NOFILE)
00055 #  if defined (linux) || defined (AIX) || defined (SCO)
00056 #    if defined (RLIMIT_OFILE)
00057 #      define RLIMIT_NOFILE RLIMIT_OFILE
00058 #    else
00059 #      define RLIMIT_NOFILE 200
00060 #    endif /* RLIMIT_OFILE */
00061 #  endif /* defined (linux) || defined (AIX) || defined (SCO) */
00062 #endif /* RLIMIT_NOFILE */
00063 
00064 #if defined (ACE_WIN32)
00065 #  define RUSAGE_SELF 1
00066    /// Fake the UNIX rusage structure.  Perhaps we can add more to this
00067    /// later on?
00068    struct rusage
00069    {
00070      FILETIME ru_utime;
00071      FILETIME ru_stime;
00072    };
00073 #endif /* ACE_WIN32 */
00074 
00075 #if defined (ACE_LACKS_RLIMIT_PROTOTYPE)
00076   int getrlimit (int resource, struct rlimit *rlp);
00077   int setrlimit (int resource, const struct rlimit *rlp);
00078 #endif /* ACE_LACKS_RLIMIT_PROTOTYPE */
00079 
00080 #if defined (ACE_HAS_PRUSAGE_T)
00081    typedef prusage_t ACE_Rusage;
00082 #elif defined (ACE_HAS_GETRUSAGE)
00083    typedef rusage ACE_Rusage;
00084 #else
00085    typedef int ACE_Rusage;
00086 #endif /* ACE_HAS_PRUSAGE_T */
00087 
00088 #if !defined (ACE_WIN32)
00089 // These prototypes are chronically lacking from many versions of UNIX.
00090 # if !defined (ACE_HAS_GETRUSAGE_PROTOTYPE)
00091   int getrusage (int who, struct rusage *rusage);
00092 # endif /* ! ACE_HAS_GETRUSAGE_PROTOTYPE */
00093 
00094 # if defined (ACE_LACKS_SYSCALL)
00095   int syscall (int, ACE_HANDLE, struct rusage *);
00096 # endif /* ACE_LACKS_SYSCALL */
00097 #endif /* !ACE_WIN32 */
00098 
00099 #ifdef __cplusplus
00100 }
00101 #endif /* __cplusplus */
00102 
00103 #include /**/ "ace/post.h"
00104 #endif /* ACE_OS_INCLUDE_SYS_OS_RESOURCE_H */

Generated on Tue Feb 2 17:18:41 2010 for ACE by  doxygen 1.4.7