OS_NS_unistd.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   OS_NS_unistd.h
00006  *
00007  *  OS_NS_unistd.h,v 1.19 2006/06/19 11:35:26 jwillemsen Exp
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00010  *  @author Jesper S. M|ller<stophph@diku.dk>
00011  *  @author and a cast of thousands...
00012  *
00013  *  Originally in OS.h.
00014  */
00015 //=============================================================================
00016 
00017 #ifndef ACE_OS_NS_UNISTD_H
00018 # define ACE_OS_NS_UNISTD_H
00019 
00020 # include /**/ "ace/pre.h"
00021 
00022 # include "ace/config-all.h"
00023 
00024 # if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 #  pragma once
00026 # endif /* ACE_LACKS_PRAGMA_ONCE */
00027 
00028 #include "ace/os_include/os_unistd.h"
00029 #include "ace/Time_Value.h"
00030 #include "ace/os_include/os_stdio.h"
00031 #include "ace/ACE_export.h"
00032 
00033 #if defined (ACE_EXPORT_MACRO)
00034 #  undef ACE_EXPORT_MACRO
00035 #endif
00036 #define ACE_EXPORT_MACRO ACE_Export
00037 
00038 // This should go in os_unistd.h, but since we don't yet implement any code
00039 // at that level, we put it here.  It used to be in OS.i.
00040 #if defined (ACE_NEEDS_FTRUNCATE)
00041 extern "C" ACE_Export int ftruncate (ACE_HANDLE handle, long len);
00042 #endif /* ACE_NEEDS_FTRUNCATE */
00043 
00044 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00045 
00046 namespace ACE_OS
00047 {
00048 
00049   ACE_NAMESPACE_INLINE_FUNCTION
00050   int access (const char *path, int amode);
00051 
00052 #if defined (ACE_HAS_WCHAR)
00053   ACE_NAMESPACE_INLINE_FUNCTION
00054   int access (const wchar_t *path, int amode);
00055 #endif /* ACE_HAS_WCHAR */
00056 
00057   ACE_NAMESPACE_INLINE_FUNCTION
00058   unsigned int alarm (u_int secs);
00059 
00060   ACE_NAMESPACE_INLINE_FUNCTION
00061   long allocation_granularity (void);
00062 
00063   // used by ARGV::argv_to_string() and ACE_OS::fork_exec()
00064   extern ACE_Export
00065   int argv_to_string (ACE_TCHAR **argv,
00066                       ACE_TCHAR *&buf,
00067                       bool substitute_env_args = true);
00068 
00069 #if !defined (ACE_LACKS_CHDIR)
00070   ACE_NAMESPACE_INLINE_FUNCTION
00071   int chdir (const char *path);
00072 
00073 #if defined (ACE_HAS_WCHAR)
00074   ACE_NAMESPACE_INLINE_FUNCTION
00075   int chdir (const wchar_t *path);
00076 #endif /* ACE_HAS_WCHAR */
00077 #endif /* ACE_LACKS_CHDIR */
00078 
00079   ACE_NAMESPACE_INLINE_FUNCTION
00080   int rmdir (const char *path);
00081 
00082 #if defined (ACE_HAS_WCHAR)
00083   ACE_NAMESPACE_INLINE_FUNCTION
00084   int rmdir (const wchar_t *path);
00085 #endif /* ACE_HAS_WCHAR */
00086 
00087   ACE_NAMESPACE_INLINE_FUNCTION
00088   int close (ACE_HANDLE handle);
00089 
00090   ACE_NAMESPACE_INLINE_FUNCTION
00091   ACE_HANDLE dup (ACE_HANDLE handle);
00092 
00093   ACE_NAMESPACE_INLINE_FUNCTION
00094   int dup2 (ACE_HANDLE oldfd,
00095             ACE_HANDLE newfd);
00096 
00097   extern ACE_Export
00098   int execl (const char *path,
00099              const char *arg0, ...);
00100 
00101   extern ACE_Export
00102   int execle (const char *path,
00103               const char *arg0, ...);
00104 
00105   extern ACE_Export
00106   int execlp (const char *file,
00107               const char *arg0, ...);
00108 
00109   ACE_NAMESPACE_INLINE_FUNCTION
00110   int execv (const char *path,
00111              char *const argv[]);
00112 
00113   ACE_NAMESPACE_INLINE_FUNCTION
00114   int execve (const char *path,
00115               char *const argv[],
00116               char *const envp[]);
00117 
00118   ACE_NAMESPACE_INLINE_FUNCTION
00119   int execvp (const char *file,
00120               char *const argv[]);
00121 
00122   //@{
00123   /// Forks and exec's a process in a manner that works on Solaris and
00124   /// NT.  argv[0] must be the full path name to the executable.
00125   ACE_NAMESPACE_INLINE_FUNCTION
00126   pid_t fork (void);
00127 
00128   // not in susv3
00129   extern ACE_Export
00130   pid_t fork (const ACE_TCHAR *program_name);
00131 
00132   extern ACE_Export
00133   pid_t fork_exec (ACE_TCHAR *argv[]);
00134 
00135   //@}
00136 
00137   ACE_NAMESPACE_INLINE_FUNCTION
00138   int fsync (ACE_HANDLE handle);
00139 
00140   ACE_NAMESPACE_INLINE_FUNCTION
00141   int ftruncate (ACE_HANDLE,
00142                  ACE_LOFF_T);
00143 
00144   ACE_NAMESPACE_INLINE_FUNCTION
00145   char *getcwd (char *, size_t);
00146 
00147 #if defined (ACE_HAS_WCHAR)
00148   ACE_NAMESPACE_INLINE_FUNCTION
00149   wchar_t *getcwd (wchar_t *, size_t);
00150 #endif /* ACE_HAS_WCHAR */
00151 
00152   ACE_NAMESPACE_INLINE_FUNCTION
00153   gid_t getgid (void);
00154 
00155   ACE_NAMESPACE_INLINE_FUNCTION
00156   gid_t getegid (void);
00157 
00158   ACE_NAMESPACE_INLINE_FUNCTION
00159   int getopt (int argc,
00160               char *const *argv,
00161               const char *optstring);
00162 
00163   ACE_NAMESPACE_INLINE_FUNCTION
00164   long getpagesize (void);
00165 
00166   ACE_NAMESPACE_INLINE_FUNCTION
00167   pid_t getpgid (pid_t pid);
00168 
00169   ACE_NAMESPACE_INLINE_FUNCTION
00170   pid_t getpid (void);
00171 
00172   ACE_NAMESPACE_INLINE_FUNCTION
00173   pid_t getppid (void);
00174 
00175   ACE_NAMESPACE_INLINE_FUNCTION
00176   uid_t getuid (void);
00177 
00178   ACE_NAMESPACE_INLINE_FUNCTION
00179   uid_t geteuid (void);
00180 
00181   // should call gethostname()
00182   ACE_NAMESPACE_INLINE_FUNCTION
00183   int hostname (char *name,
00184                 size_t maxnamelen);
00185 
00186 #if defined (ACE_HAS_WCHAR)
00187   ACE_NAMESPACE_INLINE_FUNCTION
00188   int hostname (wchar_t *name,
00189                 size_t maxnamelen);
00190 #endif /* ACE_HAS_WCHAR */
00191 
00192   ACE_NAMESPACE_INLINE_FUNCTION
00193   int isatty (int handle);
00194 
00195 #if defined (ACE_WIN32)
00196   ACE_NAMESPACE_INLINE_FUNCTION
00197   int isatty (ACE_HANDLE handle);
00198 #endif /* ACE_WIN32 */
00199 
00200   ACE_NAMESPACE_INLINE_FUNCTION
00201   off_t lseek (ACE_HANDLE handle,
00202                off_t offset,
00203                int whence);
00204 
00205 #if defined (ACE_HAS_LLSEEK) || defined (ACE_HAS_LSEEK64)
00206   ACE_NAMESPACE_INLINE_FUNCTION
00207   ACE_LOFF_T llseek (ACE_HANDLE handle, ACE_LOFF_T offset, int whence);
00208 #endif /* ACE_HAS_LLSEEK */
00209 
00210   /// Get the number of CPUs configured in the machine.
00211   extern ACE_Export
00212   long num_processors (void);
00213 
00214   /// Get the number of CPUs currently online.
00215   extern ACE_Export
00216   long num_processors_online (void);
00217 
00218   ACE_NAMESPACE_INLINE_FUNCTION
00219   int pipe (ACE_HANDLE handles[]);
00220 
00221   extern ACE_Export
00222   ssize_t pread (ACE_HANDLE handle,
00223                  void *buf,
00224                  size_t nbyte,
00225                  off_t offset);
00226 
00227   extern ACE_Export
00228   ssize_t pwrite (ACE_HANDLE handle,
00229                   const void *buf,
00230                   size_t nbyte,
00231                   ACE_LOFF_T offset);
00232 
00233   ACE_NAMESPACE_INLINE_FUNCTION
00234   ssize_t read (ACE_HANDLE handle,
00235                 void *buf,
00236                 size_t len);
00237 
00238   ACE_NAMESPACE_INLINE_FUNCTION
00239   ssize_t read (ACE_HANDLE handle,
00240                 void *buf,
00241                 size_t len,
00242                 ACE_OVERLAPPED *);
00243 
00244   /**
00245    * Receive <len> bytes into <buf> from <handle> (uses the
00246    * <ACE_OS::read> call, which uses the <read> system call on UNIX
00247    * and the <ReadFile> call on Win32). If errors occur, -1 is
00248    * returned.  If EOF occurs, 0 is returned.  Whatever data has been
00249    * read will be returned to the caller through<bytes_transferred>.
00250    *
00251    */
00252   extern ACE_Export
00253   ssize_t read_n (ACE_HANDLE handle,
00254                   void *buf,
00255                   size_t len,
00256                   size_t *bytes_transferred = 0);
00257 
00258   ACE_NAMESPACE_INLINE_FUNCTION
00259   ssize_t readlink (const char *path,
00260                     char *buf,
00261                     size_t bufsiz);
00262 
00263   ACE_NAMESPACE_INLINE_FUNCTION
00264   void *sbrk (ptrdiff_t brk);
00265 
00266   ACE_NAMESPACE_INLINE_FUNCTION
00267   int setgid (gid_t);
00268 
00269   ACE_NAMESPACE_INLINE_FUNCTION
00270   int setegid (gid_t);
00271 
00272   ACE_NAMESPACE_INLINE_FUNCTION
00273   int setpgid (pid_t pid, pid_t pgid);
00274 
00275   ACE_NAMESPACE_INLINE_FUNCTION
00276   int setregid (gid_t rgid, gid_t egid);
00277 
00278   ACE_NAMESPACE_INLINE_FUNCTION
00279   int setreuid (uid_t ruid, uid_t euid);
00280 
00281   ACE_NAMESPACE_INLINE_FUNCTION
00282   pid_t setsid (void);
00283 
00284   ACE_NAMESPACE_INLINE_FUNCTION
00285   int setuid (uid_t);
00286 
00287   ACE_NAMESPACE_INLINE_FUNCTION
00288   int seteuid (uid_t);
00289 
00290   ACE_NAMESPACE_INLINE_FUNCTION
00291   int sleep (u_int seconds);
00292 
00293   ACE_NAMESPACE_INLINE_FUNCTION
00294   int sleep (const ACE_Time_Value &tv);
00295 
00296   // used by ARGV::string_to_argv
00297   extern ACE_Export
00298   int string_to_argv (ACE_TCHAR *buf,
00299                       int &argc,
00300                       ACE_TCHAR **&argv,
00301                       bool substitute_env_args = true);
00302 
00303   ACE_NAMESPACE_INLINE_FUNCTION
00304   void swab (const void *src, void *dest, ssize_t n);
00305 
00306   ACE_NAMESPACE_INLINE_FUNCTION
00307   long sysconf (int);
00308 
00309   // not in susv3
00310   ACE_NAMESPACE_INLINE_FUNCTION
00311   long sysinfo (int cmd,
00312                 char *buf,
00313                 long count);
00314 
00315   ACE_NAMESPACE_INLINE_FUNCTION
00316   int truncate (const ACE_TCHAR *filename, ACE_LOFF_T length);
00317 
00318   ACE_NAMESPACE_INLINE_FUNCTION
00319   u_long ualarm (u_long usecs,
00320                  u_long interval = 0);
00321 
00322   ACE_NAMESPACE_INLINE_FUNCTION
00323   u_long ualarm (const ACE_Time_Value &tv,
00324                  const ACE_Time_Value &tv_interval = ACE_Time_Value::zero);
00325 
00326   ACE_NAMESPACE_INLINE_FUNCTION
00327   int unlink (const char *path);
00328 
00329 #if defined (ACE_HAS_WCHAR)
00330   ACE_NAMESPACE_INLINE_FUNCTION
00331   int unlink (const wchar_t *path);
00332 #endif /* ACE_HAS_WCHAR */
00333 
00334   ACE_NAMESPACE_INLINE_FUNCTION
00335   ssize_t write (ACE_HANDLE handle,
00336                  const void *buf,
00337                  size_t nbyte);
00338 
00339   ACE_NAMESPACE_INLINE_FUNCTION
00340   ssize_t write (ACE_HANDLE handle,
00341                  const void *buf,
00342                  size_t nbyte,
00343                  ACE_OVERLAPPED *);
00344 
00345   /**
00346    * Send <len> bytes from <buf> to <handle> (uses the <ACE_OS::write>
00347    * calls, which is uses the <write> system call on UNIX and the
00348    * <WriteFile> call on Win32).  If errors occur, -1 is returned.  If
00349    * EOF occurs, 0 is returned.  Whatever data has been transmitted
00350    * will be returned to the caller through <bytes_transferred>.
00351    */
00352   extern ACE_Export
00353   ssize_t write_n (ACE_HANDLE handle,
00354                    const void *buf,
00355                    size_t len,
00356                    size_t *bytes_transferred = 0);
00357 
00358 } /* namespace ACE_OS */
00359 
00360 ACE_END_VERSIONED_NAMESPACE_DECL
00361 
00362 # if defined (ACE_HAS_INLINED_OSCALLS)
00363 #   if defined (ACE_INLINE)
00364 #     undef ACE_INLINE
00365 #   endif /* ACE_INLINE */
00366 #   define ACE_INLINE inline
00367 #   include "ace/OS_NS_unistd.inl"
00368 # endif /* ACE_HAS_INLINED_OSCALLS */
00369 
00370 # include /**/ "ace/post.h"
00371 #endif /* ACE_OS_NS_UNISTD_H */

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