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