os_unistd.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    os_unistd.h
00006  *
00007  *  standard symbolic constants and types
00008  *
00009  *  $Id: os_unistd.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_OS_UNISTD_H
00017 #define ACE_OS_INCLUDE_OS_UNISTD_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_types.h"
00028 #include "ace/os_include/os_inttypes.h"
00029 
00030 #if defined (__BORLANDC__)
00031 #  include "ace/os_include/os_fcntl.h"
00032 #endif /* __BORLANDC */
00033 
00034 #if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
00035 #  include /**/ <process.h>
00036 #  include /**/ <io.h>
00037 #endif /* ACE_WIN32 && !ACE_HAS_WINCE */
00038 
00039 #if defined (ACE_HAS_SYS_SYSTEMINFO_H)
00040 #  include /**/ <sys/systeminfo.h>
00041 #endif /* ACE_HAS_SYS_SYSTEMINFO_H */
00042 
00043 #if !defined (ACE_LACKS_UNISTD_H)
00044 #  include /**/ <unistd.h>
00045 #endif /* !ACE_LACKS_UNISTD_H */
00046 
00047 #if defined (ACE_VXWORKS)
00048 #  if !defined (__RTP__)
00049     // for unlink(), close(), read(), write(), lseek(), chdir(), getcwd(),
00050    // getwd(), and isatty()
00051    #  include /**/ <ioLib.h>
00052 #  endif
00053 // for gethostname()
00054 #  include /**/ <hostLib.h>
00055 #endif /* ACE_VXWORKS */
00056 
00057 // Place all additions (especially function declarations) within extern "C" {}
00058 #ifdef __cplusplus
00059 extern "C"
00060 {
00061 #endif /* __cplusplus */
00062 
00063 #if defined (ACE_WIN32)
00064 // The following are #defines and #includes that are specific to
00065 // WIN32.
00066 #  if defined (ACE_HAS_WINCE)
00067 #    define ACE_STDIN  _fileno (stdin)
00068 #    define ACE_STDOUT _fileno (stdout)
00069 #    define ACE_STDERR _fileno (stderr)
00070 #  else
00071 #    define ACE_STDIN GetStdHandle (STD_INPUT_HANDLE)
00072 #    define ACE_STDOUT GetStdHandle (STD_OUTPUT_HANDLE)
00073 #    define ACE_STDERR GetStdHandle (STD_ERROR_HANDLE)
00074 #  endif  // ACE_HAS_WINCE
00075 // The following are #defines and #includes that are specific to UNIX.
00076 #else /* !ACE_WIN32 */
00077 #  if defined (STDIN_FILENO)
00078 #    define ACE_STDIN STDIN_FILENO
00079 #  else
00080 #    define ACE_STDIN 0
00081 #  endif
00082 #  if defined (STDOUT_FILENO)
00083 #    define ACE_STDOUT STDOUT_FILENO
00084 #  else
00085 #    define ACE_STDOUT 1
00086 #  endif
00087 #  if defined (STDERR_FILENO)
00088 #    define ACE_STDERR STDERR_FILENO
00089 #  else
00090 #    define ACE_STDERR 2
00091 #  endif
00092 #endif /* ACE_WIN32 */
00093 
00094 #if (!defined (_BSD_SOURCE) && \
00095     !defined (_XOPEN_SOURCE) && !defined (_XOPEN_SOURCE_EXTENDED)) \
00096     || (defined (_XOPEN_SOURCE) && defined (__GNUC__))
00097 
00098 # if defined (ACE_LACKS_SETREUID_PROTOTYPE)
00099   extern int setreuid (uid_t ruid, uid_t euid);
00100 # endif /* ACE_LACKS_SETREUID_PROTOTYPE */
00101 
00102 # if defined (ACE_LACKS_SETREGID_PROTOTYPE)
00103   extern int setregid (gid_t rgid, gid_t egid);
00104 # endif /* ACE_LACKS_SETREGID_PROTOTYPE */
00105 #endif  /* !_BSD_SOURCE && !_XOPEN_SOURCE && !_XOPEN_SOURCE_EXTENDED
00106            || _XOPEN_SOURCE && __GNUC__ */
00107 
00108   // for use by access()
00109 # if !defined (R_OK)
00110 #   define R_OK    04      /* Test for Read permission. */
00111 # endif /* R_OK */
00112 
00113 # if !defined (W_OK)
00114 #   define W_OK    02      /* Test for Write permission. */
00115 # endif /* W_OK */
00116 
00117 # if !defined (X_OK)
00118 #   if defined (ACE_WIN32)
00119       /* Windows has no test for X_OK - use R_OK instead */
00120 #     define X_OK    R_OK      /* Test for eXecute permission. */
00121 #   else  /* ACE_WIN32 */
00122 #     define X_OK    01      /* Test for eXecute permission. */
00123 #   endif /* ACE_WIN32 */
00124 # endif /* X_OK */
00125 
00126 # if !defined (F_OK)
00127 #   define F_OK    0       /* Test for existence of File. */
00128 # endif /* F_OK */
00129 
00130 #if defined (ACE_LACKS_UALARM_PROTOTYPE)
00131    u_int ualarm (u_int usecs, u_int interval);
00132 #endif /* ACE_LACKS_UALARM_PROTOTYPE */
00133 
00134 #if defined (ACE_LACKS_PREAD_PROTOTYPE) && (_XOPEN_SOURCE - 0) < 500
00135    // _XOPEN_SOURCE == 500    Single Unix conformance
00136    // It seems that _XOPEN_SOURCE == 500 means that the prototypes are
00137    // already defined in the system headers.
00138    ssize_t pread (int fd,
00139                   void *buf,
00140                   size_t nbytes,
00141                   ACE_OFF_T offset);
00142 
00143    ssize_t pwrite (int fd,
00144                    const void *buf,
00145                    size_t n,
00146                    ACE_OFF_T offset);
00147 #endif  /* ACE_LACKS_PREAD_PROTOTYPE && (_XOPEN_SOURCE - 0) < 500 */
00148 
00149 #if defined (ACE_LACKS_GETPGID_PROTOTYPE) && \
00150     !defined (_XOPEN_SOURCE) && !defined (_XOPEN_SOURCE_EXTENDED)
00151    pid_t getpgid (pid_t pid);
00152 #endif  /* ACE_LACKS_GETPGID_PROTOTYPE &&
00153            !_XOPEN_SOURCE && !_XOPEN_SOURCE_EXTENDED */
00154 
00155 #if !defined (_LARGEFILE64_SOURCE)
00156 #  if defined (ACE_LACKS_LSEEK64_PROTOTYPE) && \
00157       defined (ACE_LACKS_LLSEEK_PROTOTYPE)
00158 #    error Define either ACE_LACKS_LSEEK64_PROTOTYPE or ACE_LACKS_LLSEEK_PROTOTYPE, not both!
00159 #  elif defined (ACE_LACKS_LSEEK64_PROTOTYPE)
00160      ACE_LOFF_T lseek64 (int fd, ACE_LOFF_T offset, int whence);
00161 #  elif defined (ACE_LACKS_LLSEEK_PROTOTYPE)
00162      ACE_LOFF_T llseek (int fd, ACE_LOFF_T offset, int whence);
00163 #  endif
00164 #endif  /* _LARGEFILE64_SOURCE */
00165 
00166 #if defined (__BORLANDC__)
00167 #  if (__BORLANDC__ <= 0x540)
00168 #    define _getcwd getcwd
00169 #    define _chdir chdir
00170 #    undef _access
00171 #    define _access access
00172 #  endif
00173 #  define _isatty isatty
00174 #endif /* __BORLANDC__ */
00175 
00176 # if defined (ACE_LACKS_TIMEDWAIT_PROTOTYPES)
00177 
00178   ssize_t read_timedwait (ACE_HANDLE handle,
00179                           char *buf,
00180                           size_t n,
00181                           struct timespec *timeout);
00182 
00183   ssize_t write_timedwait (ACE_HANDLE handle,
00184                            const void *buf,
00185                            size_t n,
00186                            struct timespec *timeout);
00187 
00188 # endif /* ACE_LACKS_TIMEDWAIT_PROTOTYPES */
00189 
00190 #if defined (ACE_LACKS_SWAB_PROTOTYPE)
00191   void swab(const void *, void *, ssize_t);
00192 #endif /* ACE_LACKS_SWAB_PROTOTYPE */
00193 
00194 #if defined (ACE_LACKS_GETOPT_PROTOTYPE)
00195   int getopt(int, char * const [], const char *);
00196 #endif /* ACE_LACKS_GETOPT_PROTOTYPE */
00197 
00198 #ifdef __cplusplus
00199 }
00200 #endif /* __cplusplus */
00201 
00202 #include /**/ "ace/post.h"
00203 #endif /* ACE_OS_INCLUDE_OS_UNISTD_H */

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