Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / OS_NS_unistd.h
blob6d4f270d13214268ab6c7f927a94154460d8720c
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file OS_NS_unistd.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 * @author Jesper S. M|ller<stophph@diku.dk>
9 * @author and a cast of thousands...
11 //=============================================================================
13 #ifndef ACE_OS_NS_UNISTD_H
14 # define ACE_OS_NS_UNISTD_H
16 # include /**/ "ace/pre.h"
18 # include "ace/config-all.h"
20 # if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 # endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include /**/ "ace/ACE_export.h"
25 #include "ace/Time_Value.h"
26 #include "ace/Basic_Types.h"
27 #include "ace/os_include/os_unistd.h"
28 #include "ace/os_include/os_stdio.h"
30 #if defined (ACE_EXPORT_MACRO)
31 # undef ACE_EXPORT_MACRO
32 #endif
33 #define ACE_EXPORT_MACRO ACE_Export
35 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
37 namespace ACE_OS
39 ACE_NAMESPACE_INLINE_FUNCTION
40 int access (const char *path, int amode);
42 #if defined (ACE_HAS_WCHAR)
43 ACE_NAMESPACE_INLINE_FUNCTION
44 int access (const wchar_t *path, int amode);
45 #endif /* ACE_HAS_WCHAR */
47 ACE_NAMESPACE_INLINE_FUNCTION
48 unsigned int alarm (u_int secs);
50 ACE_NAMESPACE_INLINE_FUNCTION
51 long allocation_granularity ();
53 /// used by ARGV::argv_to_string() and ACE_OS::fork_exec()
54 extern ACE_Export
55 int argv_to_string (int argc,
56 ACE_TCHAR **argv,
57 ACE_TCHAR *&buf,
58 bool substitute_env_args = true,
59 bool quote_args = false);
61 extern ACE_Export
62 int argv_to_string (ACE_TCHAR **argv,
63 ACE_TCHAR *&buf,
64 bool substitute_env_args = true,
65 bool quote_args = false);
67 ACE_NAMESPACE_INLINE_FUNCTION
68 int chdir (const char *path);
70 #if defined (ACE_HAS_WCHAR)
71 ACE_NAMESPACE_INLINE_FUNCTION
72 int chdir (const wchar_t *path);
73 #endif /* ACE_HAS_WCHAR */
75 ACE_NAMESPACE_INLINE_FUNCTION
76 int rmdir (const char *path);
78 #if defined (ACE_HAS_WCHAR)
79 ACE_NAMESPACE_INLINE_FUNCTION
80 int rmdir (const wchar_t *path);
81 #endif /* ACE_HAS_WCHAR */
83 ACE_NAMESPACE_INLINE_FUNCTION
84 int close (ACE_HANDLE handle);
86 ACE_NAMESPACE_INLINE_FUNCTION
87 ACE_HANDLE dup (ACE_HANDLE handle);
89 ACE_NAMESPACE_INLINE_FUNCTION
90 ACE_HANDLE dup (ACE_HANDLE handle, pid_t pid);
92 ACE_NAMESPACE_INLINE_FUNCTION
93 int dup2 (ACE_HANDLE oldfd,
94 ACE_HANDLE newfd);
96 extern ACE_Export
97 int execl (const char *path,
98 const char *arg0, ...);
100 extern ACE_Export
101 int execle (const char *path,
102 const char *arg0, ...);
104 extern ACE_Export
105 int execlp (const char *file,
106 const char *arg0, ...);
108 ACE_NAMESPACE_INLINE_FUNCTION
109 int execv (const char *path,
110 char *const argv[]);
112 ACE_NAMESPACE_INLINE_FUNCTION
113 int execve (const char *path,
114 char *const argv[],
115 char *const envp[]);
117 ACE_NAMESPACE_INLINE_FUNCTION
118 int execvp (const char *file,
119 char *const argv[]);
121 //@{
122 /// Forks and exec's a process in a manner that works Windows.
123 /// argv[0] must be the full path name to the executable.
124 ACE_NAMESPACE_INLINE_FUNCTION
125 pid_t fork ();
127 // not in susv3
128 extern ACE_Export
129 pid_t fork (const ACE_TCHAR *program_name);
131 extern ACE_Export
132 pid_t fork_exec (ACE_TCHAR *argv[]);
133 //@}
135 ACE_NAMESPACE_INLINE_FUNCTION
136 int fsync (ACE_HANDLE handle);
138 ACE_NAMESPACE_INLINE_FUNCTION
139 int ftruncate (ACE_HANDLE handle, ACE_OFF_T offset);
141 ACE_NAMESPACE_INLINE_FUNCTION
142 char *getcwd (char *, size_t);
144 #if defined (ACE_HAS_WCHAR)
145 ACE_NAMESPACE_INLINE_FUNCTION
146 wchar_t *getcwd (wchar_t *, size_t);
147 #endif /* ACE_HAS_WCHAR */
149 ACE_NAMESPACE_INLINE_FUNCTION
150 gid_t getgid ();
152 ACE_NAMESPACE_INLINE_FUNCTION
153 gid_t getegid ();
155 ACE_NAMESPACE_INLINE_FUNCTION
156 int getopt (int argc,
157 char *const *argv,
158 const char *optstring);
160 ACE_NAMESPACE_INLINE_FUNCTION
161 long getpagesize ();
163 ACE_NAMESPACE_INLINE_FUNCTION
164 pid_t getpgid (pid_t pid);
166 ACE_NAMESPACE_INLINE_FUNCTION
167 pid_t getpid ();
169 ACE_NAMESPACE_INLINE_FUNCTION
170 pid_t getppid ();
172 ACE_NAMESPACE_INLINE_FUNCTION
173 uid_t getuid ();
175 ACE_NAMESPACE_INLINE_FUNCTION
176 uid_t geteuid ();
178 // should call gethostname()
179 ACE_NAMESPACE_INLINE_FUNCTION
180 int hostname (char name[],
181 size_t maxnamelen);
183 #if defined (ACE_HAS_WCHAR)
184 ACE_NAMESPACE_INLINE_FUNCTION
185 int hostname (wchar_t name[],
186 size_t maxnamelen);
187 #endif /* ACE_HAS_WCHAR */
189 ACE_NAMESPACE_INLINE_FUNCTION
190 int isatty (int handle);
192 #if defined (ACE_WIN32)
193 ACE_NAMESPACE_INLINE_FUNCTION
194 int isatty (ACE_HANDLE handle);
195 #endif /* ACE_WIN32 */
197 ACE_NAMESPACE_INLINE_FUNCTION
198 ACE_OFF_T lseek (ACE_HANDLE handle,
199 ACE_OFF_T offset,
200 int whence);
202 #if defined (ACE_HAS_LLSEEK) || defined (ACE_HAS_LSEEK64)
203 ACE_NAMESPACE_INLINE_FUNCTION
204 ACE_LOFF_T llseek (ACE_HANDLE handle,
205 ACE_LOFF_T offset,
206 int whence);
207 #endif /* ACE_HAS_LLSEEK */
209 /// Get the number of CPUs configured in the machine.
210 extern ACE_Export
211 long num_processors ();
213 /// Get the number of CPUs currently online.
214 extern ACE_Export
215 long num_processors_online ();
217 ACE_NAMESPACE_INLINE_FUNCTION
218 int pipe (ACE_HANDLE handles[]);
220 extern ACE_Export
221 ssize_t pread (ACE_HANDLE handle,
222 void *buf,
223 size_t nbyte,
224 ACE_OFF_T offset);
226 extern ACE_Export
227 ssize_t pwrite (ACE_HANDLE handle,
228 const void *buf,
229 size_t nbyte,
230 ACE_OFF_T offset);
232 ACE_NAMESPACE_INLINE_FUNCTION
233 ssize_t read (ACE_HANDLE handle,
234 void *buf,
235 size_t len);
237 ACE_NAMESPACE_INLINE_FUNCTION
238 ssize_t read (ACE_HANDLE handle,
239 void *buf,
240 size_t len,
241 ACE_OVERLAPPED *);
244 * Receive @a len bytes into @a buf from @a handle (uses the
245 * <ACE_OS::read> call, which uses the <read> system call on UNIX
246 * and the <ReadFile> call on Win32). If errors occur, -1 is
247 * returned. If EOF occurs, 0 is returned. Whatever data has been
248 * read will be returned to the caller through @a bytes_transferred.
251 extern ACE_Export
252 ssize_t read_n (ACE_HANDLE handle,
253 void *buf,
254 size_t len,
255 size_t *bytes_transferred = 0);
257 ACE_NAMESPACE_INLINE_FUNCTION
258 ssize_t readlink (const char *path,
259 char *buf,
260 size_t bufsiz);
262 ACE_NAMESPACE_INLINE_FUNCTION
263 void *sbrk (intptr_t brk);
265 ACE_NAMESPACE_INLINE_FUNCTION
266 int setgid (gid_t);
268 ACE_NAMESPACE_INLINE_FUNCTION
269 int setegid (gid_t);
271 ACE_NAMESPACE_INLINE_FUNCTION
272 int setpgid (pid_t pid, pid_t pgid);
274 ACE_NAMESPACE_INLINE_FUNCTION
275 int setregid (gid_t rgid, gid_t egid);
277 ACE_NAMESPACE_INLINE_FUNCTION
278 int setreuid (uid_t ruid, uid_t euid);
280 ACE_NAMESPACE_INLINE_FUNCTION
281 pid_t setsid ();
283 ACE_NAMESPACE_INLINE_FUNCTION
284 int setuid (uid_t);
286 ACE_NAMESPACE_INLINE_FUNCTION
287 int seteuid (uid_t);
289 ACE_NAMESPACE_INLINE_FUNCTION
290 int sleep (u_int seconds);
292 ACE_NAMESPACE_INLINE_FUNCTION
293 int sleep (const ACE_Time_Value &tv);
295 // used by ARGV::string_to_argv
296 extern ACE_Export
297 int string_to_argv (ACE_TCHAR *buf,
298 int &argc,
299 ACE_TCHAR **&argv,
300 bool substitute_env_args = true);
302 ACE_NAMESPACE_INLINE_FUNCTION
303 void swab (const void *src, void *dest, ssize_t n);
305 ACE_NAMESPACE_INLINE_FUNCTION
306 long sysconf (int);
308 // not in susv3
309 ACE_NAMESPACE_INLINE_FUNCTION
310 long sysinfo (int cmd,
311 char *buf,
312 long count);
314 ACE_NAMESPACE_INLINE_FUNCTION
315 int truncate (const ACE_TCHAR *filename, ACE_OFF_T length);
317 ACE_NAMESPACE_INLINE_FUNCTION
318 useconds_t ualarm (useconds_t usecs,
319 useconds_t interval = 0);
321 ACE_NAMESPACE_INLINE_FUNCTION
322 useconds_t ualarm (const ACE_Time_Value &tv,
323 const ACE_Time_Value &tv_interval = ACE_Time_Value::zero);
325 ACE_NAMESPACE_INLINE_FUNCTION
326 int unlink (const char *path);
328 #if defined (ACE_HAS_WCHAR)
329 ACE_NAMESPACE_INLINE_FUNCTION
330 int unlink (const wchar_t *path);
331 #endif /* ACE_HAS_WCHAR */
333 ACE_NAMESPACE_INLINE_FUNCTION
334 ssize_t write (ACE_HANDLE handle,
335 const void *buf,
336 size_t nbyte);
338 ACE_NAMESPACE_INLINE_FUNCTION
339 ssize_t write (ACE_HANDLE handle,
340 const void *buf,
341 size_t nbyte,
342 ACE_OVERLAPPED *);
345 * Send @a len bytes from @a buf to @a handle (uses the <ACE_OS::write>
346 * calls, which is uses the <write> system call on UNIX and the
347 * <WriteFile> call on Win32). If errors occur, -1 is returned. If
348 * EOF occurs, 0 is returned. Whatever data has been transmitted
349 * will be returned to the caller through @a bytes_transferred.
351 extern ACE_Export
352 ssize_t write_n (ACE_HANDLE handle,
353 const void *buf,
354 size_t len,
355 size_t *bytes_transferred = 0);
356 } /* namespace ACE_OS */
358 ACE_END_VERSIONED_NAMESPACE_DECL
360 # if defined (ACE_HAS_INLINED_OSCALLS)
361 # if defined (ACE_INLINE)
362 # undef ACE_INLINE
363 # endif /* ACE_INLINE */
364 # define ACE_INLINE inline
365 # include "ace/OS_NS_unistd.inl"
366 # endif /* ACE_HAS_INLINED_OSCALLS */
368 # include /**/ "ace/post.h"
369 #endif /* ACE_OS_NS_UNISTD_H */