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