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  *  os_resource.h,v 1.8 2004/08/25 16:05:41 shuston Exp
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_SYSINFO)
00035 #  include /**/ <sys/systeminfo.h>
00036 #endif /* ACE_HAS_SYS_INFO */
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)
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 #else /* !ACE_WIN32 */
00074 #   if defined (m88k)
00075 #     define RUSAGE_SELF 1
00076 #   endif  /*  m88k */
00077 #endif /* ACE_WIN32 */
00078 
00079 #if defined (ACE_LACKS_RLIMIT_PROTOTYPE)
00080   int getrlimit (int resource, struct rlimit *rlp);
00081   int setrlimit (int resource, const struct rlimit *rlp);
00082 #endif /* ACE_LACKS_RLIMIT_PROTOTYPE */
00083 
00084 #if defined (ACE_HAS_PRUSAGE_T)
00085    typedef prusage_t ACE_Rusage;
00086 #elif defined (ACE_HAS_GETRUSAGE)
00087    typedef rusage ACE_Rusage;
00088 #else
00089    typedef int ACE_Rusage;
00090 #endif /* ACE_HAS_PRUSAGE_T */
00091 
00092 #if !defined (ACE_WIN32)
00093 // These prototypes are chronically lacking from many versions of
00094 // UNIX.
00095 # if !defined (ACE_HAS_GETRUSAGE_PROTOTYPE)
00096   int getrusage (int who, struct rusage *rusage);
00097 # endif /* ! ACE_HAS_GETRUSAGE_PROTO */
00098 
00099 # if defined (ACE_LACKS_SYSCALL)
00100   int syscall (int, ACE_HANDLE, struct rusage *);
00101 # endif /* ACE_LACKS_SYSCALL */
00102 #endif /* !ACE_WIN32 */
00103 
00104 #ifdef __cplusplus
00105 }
00106 #endif /* __cplusplus */
00107 
00108 #include /**/ "ace/post.h"
00109 #endif /* ACE_OS_INCLUDE_SYS_OS_RESOURCE_H */

Generated on Thu Nov 9 09:41:58 2006 for ACE by doxygen 1.3.6