1 |
1254 |
phoenix |
#ifndef CYGONCE_ISO_UNISTD_H
|
2 |
|
|
#define CYGONCE_ISO_UNISTD_H
|
3 |
|
|
/*========================================================================
|
4 |
|
|
//
|
5 |
|
|
// unistd.h
|
6 |
|
|
//
|
7 |
|
|
// POSIX UNIX standard definitions
|
8 |
|
|
//
|
9 |
|
|
//========================================================================
|
10 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
18 |
|
|
//
|
19 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
20 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
21 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
22 |
|
|
// for more details.
|
23 |
|
|
//
|
24 |
|
|
// You should have received a copy of the GNU General Public License along
|
25 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
26 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
27 |
|
|
//
|
28 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
29 |
|
|
// or inline functions from this file, or you compile this file and link it
|
30 |
|
|
// with other works to produce a work based on this file, this file does not
|
31 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
32 |
|
|
// License. However the source code for this file must still be made available
|
33 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
36 |
|
|
// this file might be covered by the GNU General Public License.
|
37 |
|
|
//
|
38 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
39 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
//========================================================================
|
43 |
|
|
//#####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): nickg
|
46 |
|
|
// Contributors:
|
47 |
|
|
// Date: 2000-06-01
|
48 |
|
|
// Purpose: This file provides the macros, types and functions
|
49 |
|
|
// required by POSIX 1003.1.
|
50 |
|
|
// Description: Much of the real contents of this file get set from the
|
51 |
|
|
// configuration (set by the implementation)
|
52 |
|
|
// Usage: #include <unistd.h>
|
53 |
|
|
//
|
54 |
|
|
//####DESCRIPTIONEND####
|
55 |
|
|
//
|
56 |
|
|
//======================================================================
|
57 |
|
|
*/
|
58 |
|
|
|
59 |
|
|
/* CONFIGURATION */
|
60 |
|
|
|
61 |
|
|
#include <pkgconf/isoinfra.h> /* Configuration header */
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
/* INCLUDES */
|
65 |
|
|
|
66 |
|
|
#include <sys/types.h>
|
67 |
|
|
|
68 |
|
|
/* This is the "standard" way to get NULL and size_t from stddef.h,
|
69 |
|
|
* which is the canonical location of the definitions.
|
70 |
|
|
*/
|
71 |
|
|
#define __need_NULL
|
72 |
|
|
#define __need_size_t
|
73 |
|
|
#include <stddef.h>
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
#ifdef CYGINT_ISO_POSIX_TIMER_OPS
|
77 |
|
|
# ifdef CYGBLD_ISO_POSIX_TIMER_OPS_HEADER
|
78 |
|
|
# include CYGBLD_ISO_POSIX_TIMER_OPS_HEADER
|
79 |
|
|
# else
|
80 |
|
|
|
81 |
|
|
# ifdef __cplusplus
|
82 |
|
|
extern "C" {
|
83 |
|
|
# endif
|
84 |
|
|
|
85 |
|
|
extern unsigned int
|
86 |
|
|
alarm( unsigned int /* seconds */ );
|
87 |
|
|
|
88 |
|
|
extern int
|
89 |
|
|
pause( void );
|
90 |
|
|
|
91 |
|
|
# ifdef __cplusplus
|
92 |
|
|
} /* extern "C" */
|
93 |
|
|
# endif
|
94 |
|
|
|
95 |
|
|
# endif
|
96 |
|
|
#endif
|
97 |
|
|
|
98 |
|
|
#ifdef CYGINT_ISO_POSIX_SLEEP
|
99 |
|
|
# ifdef CYGBLD_ISO_POSIX_SLEEP_HEADER
|
100 |
|
|
# include CYGBLD_ISO_POSIX_SLEEP_HEADER
|
101 |
|
|
# else
|
102 |
|
|
# ifdef __cplusplus
|
103 |
|
|
extern "C" {
|
104 |
|
|
# endif
|
105 |
|
|
|
106 |
|
|
unsigned int
|
107 |
|
|
sleep( unsigned int /* seconds */ );
|
108 |
|
|
|
109 |
|
|
# ifdef __cplusplus
|
110 |
|
|
} /* extern "C" */
|
111 |
|
|
# endif
|
112 |
|
|
# endif
|
113 |
|
|
#endif
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
/* ------------------------------------------------------------------- */
|
117 |
|
|
|
118 |
|
|
/* FIXME: The below was copied in verbatim by Nick, but needs to be grouped
|
119 |
|
|
by functionality and linked with interfaces as with everything else
|
120 |
|
|
*/
|
121 |
|
|
|
122 |
|
|
/* CONSTANTS */
|
123 |
|
|
|
124 |
|
|
/* Configuration constants */
|
125 |
|
|
|
126 |
|
|
#define _POSIX_VERSION 199506L
|
127 |
|
|
|
128 |
|
|
/* constants for access() */
|
129 |
|
|
#define R_OK 1
|
130 |
|
|
#define W_OK 2
|
131 |
|
|
#define X_OK 4
|
132 |
|
|
#define F_OK 8
|
133 |
|
|
|
134 |
|
|
/* constants for lseek */
|
135 |
|
|
#ifndef SEEK_SET
|
136 |
|
|
#define SEEK_SET 0
|
137 |
|
|
#define SEEK_CUR 1
|
138 |
|
|
#define SEEK_END 2
|
139 |
|
|
#endif
|
140 |
|
|
|
141 |
|
|
#define STDIN_FILENO 0
|
142 |
|
|
#define STDOUT_FILENO 1
|
143 |
|
|
#define STDERR_FILENO 2
|
144 |
|
|
|
145 |
|
|
/* Variable names for sysconf() */
|
146 |
|
|
#define _SC_AIO_LISTIO_MAX 1
|
147 |
|
|
#define _SC_AIO_MAX 2
|
148 |
|
|
#define _SC_AIO_PRIO_DELTA_MAX 3
|
149 |
|
|
#define _SC_ARG_MAX 4
|
150 |
|
|
#define _SC_ASYNCHRONOUS_IO 5
|
151 |
|
|
#define _SC_CHILD_MAX 6
|
152 |
|
|
#define _SC_CLK_TCK 7
|
153 |
|
|
#define _SC_DELAYTIMER_MAX 8
|
154 |
|
|
#define _SC_FSYNC 9
|
155 |
|
|
#define _SC_GETGR_R_SIZE_MAX 10
|
156 |
|
|
#define _SC_GETPW_R_SIZE_MAX 11
|
157 |
|
|
#define _SC_JOB_CONTROL 12
|
158 |
|
|
#define _SC_LOGIN_NAME_MAX 13
|
159 |
|
|
#define _SC_MAPPED_FILES 14
|
160 |
|
|
#define _SC_MEMLOCK 15
|
161 |
|
|
#define _SC_MEMLOCK_RANGE 16
|
162 |
|
|
#define _SC_MEMORY_PROTECTION 17
|
163 |
|
|
#define _SC_MESSAGE_PASSING 18
|
164 |
|
|
#define _SC_MQ_OPEN_MAX 19
|
165 |
|
|
#define _SC_MQ_PRIO_MAX 20
|
166 |
|
|
#define _SC_NGROUPS_MAX 21
|
167 |
|
|
#define _SC_OPEN_MAX 22
|
168 |
|
|
#define _SC_PAGESIZE 23
|
169 |
|
|
#define _SC_PRIORITIZED_IO 24
|
170 |
|
|
#define _SC_PRIORITY_SCHEDULING 25
|
171 |
|
|
#define _SC_REALTIME_SIGNALS 26
|
172 |
|
|
#define _SC_RTSIG_MAX 27
|
173 |
|
|
#define _SC_SAVED_IDS 28
|
174 |
|
|
#define _SC_SEMAPHORES 29
|
175 |
|
|
#define _SC_SEM_NSEMS_MAX 30
|
176 |
|
|
#define _SC_SEM_VALUE_MAX 31
|
177 |
|
|
#define _SC_SHARED_MEMORY_OBJECTS 32
|
178 |
|
|
#define _SC_SIGQUEUE_MAX 33
|
179 |
|
|
#define _SC_STREAM_MAX 34
|
180 |
|
|
#define _SC_SYNCHRONIZED_IO 35
|
181 |
|
|
#define _SC_THREADS 36
|
182 |
|
|
#define _SC_THREAD_ATTR_STACKADDR 37
|
183 |
|
|
#define _SC_THREAD_ATTR_STACKSIZE 38
|
184 |
|
|
#define _SC_THREAD_DESTRUCTOR_ITERATIONS 39
|
185 |
|
|
#define _SC_THREAD_KEYS_MAX 40
|
186 |
|
|
#define _SC_THREAD_PRIO_INHERIT 41
|
187 |
|
|
#define _SC_THREAD_PRIO_PROTECT 42
|
188 |
|
|
#define _SC_THREAD_PRIORITY_SCHEDULING 43
|
189 |
|
|
#define _SC_THREAD_PROCESS_SHARED 44
|
190 |
|
|
#define _SC_THREAD_SAFE_FUNCTIONS 45
|
191 |
|
|
#define _SC_THREAD_STACK_MIN 46
|
192 |
|
|
#define _SC_THREAD_THREADS_MAX 47
|
193 |
|
|
#define _SC_TIMERS 48
|
194 |
|
|
#define _SC_TIMER_MAX 49
|
195 |
|
|
#define _SC_TTY_NAME_MAX 50
|
196 |
|
|
#define _SC_TZNAME_MAX 51
|
197 |
|
|
#define _SC_VERSION 52
|
198 |
|
|
|
199 |
|
|
/* Variable names for pathconf() */
|
200 |
|
|
#define _PC_ASYNC_IO 1
|
201 |
|
|
#define _PC_CHOWN_RESTRICTED 2
|
202 |
|
|
#define _PC_LINK_MAX 3
|
203 |
|
|
#define _PC_MAX_CANON 4
|
204 |
|
|
#define _PC_MAX_INPUT 5
|
205 |
|
|
#define _PC_NAME_MAX 6
|
206 |
|
|
#define _PC_NO_TRUNC 7
|
207 |
|
|
#define _PC_PATH_MAX 8
|
208 |
|
|
#define _PC_PIPE_BUF 9
|
209 |
|
|
#define _PC_PRIO_IO 10
|
210 |
|
|
#define _PC_SYNC_IO 11
|
211 |
|
|
#define _PC_VDISABLE 12
|
212 |
|
|
|
213 |
|
|
|
214 |
|
|
/* Standard function prototypes */
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
#ifdef __cplusplus
|
218 |
|
|
extern "C" {
|
219 |
|
|
#endif
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
extern int link(const char *path1, const char *path2);
|
223 |
|
|
extern int unlink(const char *path);
|
224 |
|
|
extern int rmdir(const char *path);
|
225 |
|
|
extern int rename(const char *old_name, const char *new_name);
|
226 |
|
|
extern int access(const char *path, int amode);
|
227 |
|
|
extern int chown(const char *path, uid_t owner, uid_t group);
|
228 |
|
|
extern long pathconf(const char *path, int name);
|
229 |
|
|
extern long fpathconf(int fd, int name);
|
230 |
|
|
extern int pipe(int fildes[2]);
|
231 |
|
|
extern int dup(int fd);
|
232 |
|
|
extern int dup2(int fd,int fd2);
|
233 |
|
|
extern int close(int fd);
|
234 |
|
|
extern ssize_t read(int fd, void *buf, size_t nbyte);
|
235 |
|
|
extern ssize_t write(int fd, const void *buf, size_t nbyte);
|
236 |
|
|
extern off_t lseek(int fd, off_t offset, int whence);
|
237 |
|
|
extern int fsync( int fd );
|
238 |
|
|
extern int ftruncate(int fd, off_t length);
|
239 |
|
|
|
240 |
|
|
extern int chdir(const char *path);
|
241 |
|
|
extern char *getcwd(char *buf, size_t size);
|
242 |
|
|
|
243 |
|
|
extern pid_t getpid(void);
|
244 |
|
|
extern pid_t getppid(void);
|
245 |
|
|
extern uid_t getuid(void);
|
246 |
|
|
extern uid_t geteuid(void);
|
247 |
|
|
extern uid_t getgid(void);
|
248 |
|
|
extern uid_t getegid(void);
|
249 |
|
|
extern int setuid(uid_t uid);
|
250 |
|
|
extern int setgid(uid_t uid);
|
251 |
|
|
extern int getgroups(int setsize, uid_t *list);
|
252 |
|
|
extern char *getlogin(void);
|
253 |
|
|
extern char *cuserid(char *s);
|
254 |
|
|
extern pid_t getpgrp(void);
|
255 |
|
|
extern pid_t setsid(void);
|
256 |
|
|
extern int setpgid(pid_t pid, pid_t pgid);
|
257 |
|
|
extern char *getenv(const char *name);
|
258 |
|
|
extern char *ctermid(char *s);
|
259 |
|
|
extern char *ttyname(int fd);
|
260 |
|
|
extern int isatty(int fd);
|
261 |
|
|
extern long sysconf(int name);
|
262 |
|
|
|
263 |
|
|
extern int vfork(void);
|
264 |
|
|
extern int execl(char *path,...);
|
265 |
|
|
extern int execv(char *path,char **argv);
|
266 |
|
|
extern int execle(char *path,...);
|
267 |
|
|
extern int execlp(char *file,...);
|
268 |
|
|
extern int execvp(char *file, char **argv);
|
269 |
|
|
extern int execve(char *name, char **argv, char **envv);
|
270 |
|
|
extern void _exit(int code);
|
271 |
|
|
|
272 |
|
|
#ifdef __cplusplus
|
273 |
|
|
} /* extern "C" */
|
274 |
|
|
#endif
|
275 |
|
|
|
276 |
|
|
#endif /* CYGONCE_ISO_UNISTD_H multiple inclusion protection */
|
277 |
|
|
|
278 |
|
|
/* EOF unistd.h */
|