source: trunk/src/emx/include/unistd.h@ 661

Last change on this file since 661 was 659, checked in by bird, 22 years ago

Changed to doxygen for header status.

  • Property cvs2svn:cvs-rev set to 1.9
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 16.2 KB
Line 
1/*-
2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)unistd.h 8.12 (Berkeley) 4/27/95
34 * $FreeBSD: src/include/unistd.h,v 1.66 2002/12/29 01:07:55 mike Exp $
35 */
36
37/** @file
38 * EMX/FreeBSD 5.1
39 *
40 * @changed Commented out stuff which isn't implemented, TCPIP stuff at bottom.
41 * @todo Several man-years.. ;) Serious, complete the FreeBSD 5.1 merge and
42 * implement all the functions. Currently there is a bunch of POSIX
43 * #defines missing.
44 */
45
46#ifndef _UNISTD_H_
47#define _UNISTD_H_
48#define _UNISTD_H /* bird: emx */
49
50/** @todo remove old _POSIX_SOURCE define. */
51#if defined (_POSIX_C_SOURCE) && !defined (_POSIX_SOURCE)
52#define _POSIX_SOURCE
53#endif
54
55#include <sys/cdefs.h>
56#include <sys/types.h> /* XXX adds too much pollution. */
57/** @todo port FreeBSD sys/unistd.h: #include <sys/unistd.h> */
58#include <sys/_types.h>
59
60#if !defined(_GID_T_DECLARED) && !defined(_GID_T) /* bird: emx */
61typedef __gid_t gid_t; /* group id */
62#define _GID_T_DECLARED
63#define _GID_T /* bird: emx */
64#endif
65
66#if !defined(_OFF_T_DECLARED) && !defined(_OFF_T) /* bird:emx */
67typedef __off_t off_t; /* file offset */
68#define _OFF_T_DECLARED
69#define _OFF_T /* bird: emx */
70#endif
71
72#if !defined(_PID_T_DECLARED) && !defined(_PID_T) /* bird:emx */
73typedef __pid_t pid_t; /* process id */
74#define _PID_T_DECLARED
75#define _PID_T /* bird: emx */
76#endif
77
78#if !defined(_SIZE_T_DECLARED) && !defined(_SIZE_T) /* bird: emx */
79typedef __size_t size_t;
80#define _SIZE_T_DECLARED
81#define _SIZE_T /* bird: emx */
82#endif
83
84#if !defined(_SSIZE_T_DECLARED) && !defined(_SSIZE_T) /* bird: emx */
85typedef __ssize_t ssize_t;
86#define _SSIZE_T_DECLARED
87#define _SSIZE_T /* bird: emx */
88#endif
89
90#if !defined(_UID_T_DECLARED) && !defined(_UID_T) /* bird: emx */
91typedef __uid_t uid_t; /* user id */
92#define _UID_T_DECLARED
93#define _UID_T /* bird: emx */
94#endif
95
96#ifndef _USECONDS_T_DECLARED
97typedef __useconds_t useconds_t; /* microseconds (unsigned) */
98#define _USECONDS_T_DECLARED
99#endif
100
101#if !defined(STDIN_FILENO) /* bird: emx */
102#define STDIN_FILENO 0 /* standard input file descriptor */
103#define STDOUT_FILENO 1 /* standard output file descriptor */
104#define STDERR_FILENO 2 /* standard error file descriptor */
105#endif
106
107#ifndef NULL
108#define NULL 0 /* null pointer constant */
109#endif
110
111/** @todo: big todo to get in all the POSIX defines. */
112
113#if !defined (F_OK)
114#define F_OK 0
115#define X_OK 1
116#define W_OK 2
117#define R_OK 4
118#endif
119
120#if !defined (SEEK_SET)
121#define SEEK_SET 0
122#define SEEK_CUR 1
123#define SEEK_END 2
124#endif
125
126#if !defined (_PC_LINK_MAX)
127#define _PC_LINK_MAX 1
128#define _PC_MAX_CANON 2
129#define _PC_MAX_INPUT 3
130#define _PC_NAME_MAX 4
131#define _PC_PATH_MAX 5
132#define _PC_PIPE_BUF 6
133#define _PC_CHOWN_RESTRICTED 7
134#define _PC_NO_TRUNC 8
135#define _PC_VDISABLE 9
136#endif
137
138#if !defined (_SC_ARG_MAX)
139#define _SC_ARG_MAX 1
140#define _SC_CHILD_MAX 2
141#define _SC_CLK_TCK 3
142#define _SC_NGROUPS_MAX 4
143#define _SC_OPEN_MAX 5
144#define _SC_STREAM_MAX 6
145#define _SC_TZNAME_MAX 7
146#define _SC_JOB_CONTROL 8
147#define _SC_SAVED_IDS 9
148#define _SC_VERSION 10
149#endif
150
151#if !defined (_POSIX_VERSION)
152#define _POSIX_VERSION 199009L
153#endif
154
155
156__BEGIN_DECLS
157/* 1003.1-1990 */
158void _exit(int) __dead2;
159int access(const char *, int);
160unsigned int alarm(unsigned int);
161int chdir(const char *);
162/** @todo int chown(const char *, uid_t, gid_t); */
163int close(int);
164char * cuserid(char *); /* bird: emx/todo/obosolete? */
165int dup(int);
166int dup2(int, int);
167/** @todo int eaccess(const char *, int); */
168int execl(const char *, const char *, ...);
169int execle(const char *, const char *, ...);
170int execlp(const char *, const char *, ...);
171int execv(const char *, char * const *);
172int execve(const char *, char * const *, char * const *);
173int execvp(const char *, char * const *);
174pid_t fork(void);
175long fpathconf(int, int);
176char *getcwd(char *, size_t);
177gid_t getegid(void);
178uid_t geteuid(void);
179gid_t getgid(void);
180int getgroups(int, gid_t []);
181char *getlogin(void);
182pid_t getpgrp(void);
183pid_t getpid(void);
184pid_t getppid(void);
185uid_t getuid(void);
186int isatty(int);
187/** @todo int link(const char *, const char *);*/
188#ifndef _LSEEK_DECLARED
189#define _LSEEK_DECLARED
190off_t lseek(int, off_t, int);
191#endif
192long pathconf(const char *, int);
193int pause(void);
194int pipe(int *);
195ssize_t read(int, void *, size_t);
196int rmdir(const char *);
197int setgid(gid_t);
198/** @todo void setproctitle(const char *_fmt, ...) __printf0like(1, 2); */
199int setpgid(pid_t, pid_t);
200pid_t setsid(void);
201int setuid(uid_t);
202unsigned sleep(unsigned);
203long sysconf(int);
204pid_t tcgetpgrp(int);
205int tcsetpgrp(int, pid_t);
206char *ttyname(int);
207int unlink(const char *);
208int write(int, const void *, size_t);
209
210/* 1003.2-1992 */
211#if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE
212/** @todo size_t confstr(int, char *, size_t);*/
213int getopt(int, char * const [], const char *);
214
215extern char *optarg; /* getopt(3) external variables */
216extern int optind, opterr, optopt;
217#endif
218
219/* ISO/IEC 9945-1: 1996 */
220#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
221int fsync(int);
222
223/*
224 * ftruncate() was in the POSIX Realtime Extension (it's used for shared
225 * memory), but truncate() was not.
226 */
227#ifndef _FTRUNCATE_DECLARED
228#define _FTRUNCATE_DECLARED
229int ftruncate(int, off_t);
230#endif
231#endif
232
233#if __POSIX_VISIBLE >= 199506
234/** @todo int getlogin_r(char *, int); */
235#endif
236
237/* 1003.1-2001 */
238#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
239/** @todo int fchown(int, uid_t, gid_t); */
240/** @todo int readlink(const char *, char *, int); */
241#endif
242#if __POSIX_VISIBLE >= 200112
243/* tcpip: int gethostname(char *, int / * socklen_t * /); */
244/** @todo int setegid(gid_t); */
245/** @todo int seteuid(uid_t); */
246#endif
247
248/*
249 * symlink() was originally in POSIX.1a, which was withdrawn after
250 * being overtaken by events (1003.1-2001). It was in XPG4.2, and of
251 * course has been in BSD since 4.2.
252 */
253#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 || __BSD_VISIBLE
254/** @todo int symlink(const char * __restrict, const char * __restrict); */
255#endif
256
257/* X/Open System Interfaces */
258#if __XSI_VISIBLE
259/** @todo char *crypt(const char *, const char *); */
260/** @todo char *ctermid(char *); */ /* XXX ??? */
261/** @todo int encrypt(char *, int); */
262/** @todo int fchdir(int); */
263/* tcpip: long gethostid(void); */
264/** @todo int getpgid(pid_t _pid); */
265/** @todo int getsid(pid_t _pid); */
266char *getwd(char *); /* LEGACY: obsoleted by getcwd() */
267/** @todo int lchown(const char *, uid_t, gid_t); */
268/** @todo int lockf(int, int, off_t); */
269/** @todo int nice(int); */
270/** @todo ssize_t pread(int, void *, size_t, off_t); */
271/** @todo ssize_t pwrite(int, const void *, size_t, off_t); */
272/** @todo int setpgrp(pid_t _pid, pid_t _pgrp); */ /* obsoleted by setpgid() */
273/** @todo int setregid(gid_t, gid_t); */
274/** @todo int setreuid(uid_t, uid_t); */
275/* void swab(const void * __restrict, void * __restrict, ssize_t); */
276/** @todo void sync(void); */
277/** @todo useconds_t ualarm(useconds_t, useconds_t); */
278/** @todo int usleep(useconds_t); */
279/** @todo pid_t vfork(void); */
280
281/* See comment at ftruncate() above. */
282#ifndef _TRUNCATE_DECLARED
283#define _TRUNCATE_DECLARED
284int truncate(const char *, off_t);
285#endif
286#endif /* __XSI_VISIBLE */
287
288#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
289int brk(const void *);
290/** @todo int chroot(const char *); */
291/** @todo int getdtablesize(void); */
292int getpagesize(void) __pure2;
293char *getpass(const char *);
294char *_getpass1(const char *); /* bird: emx stuff */
295char *_getpass2(const char *, int); /* bird: emx stuff */
296void *sbrk(intptr_t);
297#endif
298
299#if __BSD_VISIBLE
300struct timeval; /* select(2) */
301/** @todo int acct(const char *); */
302/** @todo int async_daemon(void); */
303/** @todo int check_utility_compat(const char *); */
304/** @todo const char *
305 crypt_get_format(void); */
306/** @todo int crypt_set_format(const char *); */
307/** @todo int des_cipher(const char *, char *, long, int); */
308/** @todo int des_setkey(const char *key); */
309/** @todo void endusershell(void); */
310/** @todo int exect(const char *, char * const *, char * const *); */
311/** @todo char *fflagstostr(u_long); */
312/** @todo int getdomainname(char *, int); */
313/** @todo int getgrouplist(const char *, gid_t, gid_t *, int *); */
314/** @todo mode_t getmode(const void *, mode_t); */
315/** @todo int getpeereid(int, uid_t *, gid_t *); */
316/** @todo int getresgid(gid_t *, gid_t *, gid_t *); */
317/** @todo int getresuid(uid_t *, uid_t *, uid_t *); */
318/** @todo char *getusershell(void); */
319/** @todo int initgroups(const char *, gid_t); */
320/** @todo int iruserok(unsigned long, int, const char *, const char *); */
321/** @todo int iruserok_sa(const void *, int, int, const char *, const char *); */
322/** @todo int issetugid(void); */
323/** @todo char *mkdtemp(char *); */
324/** @todo int mknod(const char *, mode_t, dev_t); */
325#ifndef _MKSTEMP_DECLARED
326int mkstemp(char *);
327#define _MKSTEMP_DECLARED
328#endif
329/** @todo int mkstemps(char *, int); */
330#ifndef _MKTEMP_DECLARED
331char *mktemp(char *);
332#define _MKTEMP_DECLARED
333#endif
334/** @todo int nfsclnt(int, void *); */
335/** @todo int nfssvc(int, void *); */
336/** @todo int profil(char *, size_t, vm_offset_t, int); */
337/** @todo int rcmd(char **, int, const char *, const char *, const char *, int *); */
338/** @todo int rcmd_af(char **, int, const char *,
339 const char *, const char *, int *, int); */
340/** @todo int rcmdsh(char **, int, const char *,
341 const char *, const char *, const char *); */
342char *re_comp(const char *);
343int re_exec(const char *);
344/** @todo int reboot(int); */
345/** @todo int revoke(const char *); */
346/** @todo pid_t rfork(int); */
347/** @todo pid_t rfork_thread(int, void *, int (*)(void *), void *); */
348/** @todo int rresvport(int *); */
349/** @todo int rresvport_af(int *, int); */
350/** @todo int ruserok(const char *, int, const char *, const char *); */
351#if __BSD_VISIBLE
352#ifndef _SELECT_DECLARED
353#define _SELECT_DECLARED
354int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
355#endif
356#endif
357/** @todo int setdomainname(const char *, int); */
358/** @todo int setgroups(int, const gid_t *); */
359/** @todo void sethostid(long); */
360/** @todo int sethostname(const char *, int); */
361/** @todo #ifndef _SETKEY_DECLARED */
362/** @todo int setkey(const char *); */
363/** @todo #define _SETKEY_DECLARED */
364/** @todo #endif */
365/** @todo int setlogin(const char *); */
366/* crash with DOS: void *setmode(const char *); */
367/** @todo int setresgid(gid_t, gid_t, gid_t); */
368/** @todo int setresuid(uid_t, uid_t, uid_t); */
369/** @todo int setrgid(gid_t); */
370/** @todo int setruid(uid_t); */
371/** @todo void setusershell(void); */
372/** @todo int strtofflags(char **, u_long *, u_long *); */
373/** @todo int swapon(const char *); */
374/** @todo int swapoff(const char *); */
375/** @todo int syscall(int, ...); */
376/** @todo off_t __syscall(quad_t, ...); */
377/** @todo int ttyslot(void); */
378/** @todo int undelete(const char *); */
379/** @todo int unwhiteout(const char *); */
380/** @todo void *valloc(size_t); */ /* obsoleted by malloc() */
381
382/** @todo extern char *suboptarg; */ /* getsubopt(3) external variable */
383/** @todo #ifndef _GETSUBOPT_DECLARED */
384/** @todo int getsubopt(char **, char * const *, char **); */
385/** @todo #define _GETSUBOPT_DECLARED */
386/** @todo #endif */
387/** @todo extern int optreset; */ /* getopt(3) external variable */
388#endif /* __BSD_VISIBLE */
389/////
390
391#if !defined(_POSIX_SOURCE)
392
393
394#endif
395
396
397#if !defined(_POSIX_SOURCE) || defined(_WITH_UNDERSCORE)
398/** @todo update this section to match the one without underscores as far as needed! */
399void __exit(int) __dead2;
400int _access(const char *, int);
401unsigned int _alarm(unsigned int);
402int _chdir(const char *);
403/** @todo int _chown(const char *, uid_t, gid_t); */
404int _close(int);
405char *_cuserid(char *);
406int _dup(int);
407int _dup2(int, int);
408/** @todo int _eaccess(const char *, int); */
409int _execl(const char *, const char *, ...);
410int _execle(const char *, const char *, ...);
411int _execlp(const char *, const char *, ...);
412int _execv(const char *, char * const *);
413int _execve(const char *, char * const *, char * const *);
414int _execvp(const char *, char * const *);
415pid_t _fork(void);
416long _fpathconf(int, int);
417char *_getcwd(char *, size_t);
418gid_t _getegid(void);
419uid_t _geteuid(void);
420gid_t _getgid(void);
421int _getgroups(int, gid_t []);
422char *_getlogin(void);
423pid_t _getpgrp(void);
424pid_t _getpid(void);
425pid_t _getppid(void);
426uid_t _getuid(void);
427int _isatty(int);
428/** @todo int _link(const char *, const char *);*/
429#ifndef __LSEEK_DECLARED
430#define __LSEEK_DECLARED
431off_t _lseek(int, off_t, int);
432#endif
433long _pathconf(const char *, int);
434int _pause(void);
435int _pipe(int *);
436ssize_t _read(int, void *, size_t);
437int _rmdir(const char *);
438int _setgid(gid_t);
439/** @todo void _setproctitle(const char *_fmt, ...) __printf0like(1, 2); */
440int _setpgid(pid_t, pid_t);
441pid_t _setsid(void);
442int _setuid(uid_t);
443unsigned _sleep(unsigned);
444long _sysconf(int);
445pid_t _tcgetpgrp(int);
446pid_t _tcsetpgrp(int, int);
447char *_ttyname(int);
448int _unlink(const char *);
449int _write(int, const void *, size_t);
450
451int _brk(const void *);
452char *_getpass(const char *);
453char *_getpass1(const char *);
454char *_getpass2(const char *, int);
455int _mkstemp(char *);
456char *_mktemp(char *);
457void *_sbrk(intptr_t);
458/** @todo int _profil(void *, unsigned, unsigned, unsigned); */
459
460/* 1003.2-1992 */
461extern char *_optarg;
462extern int _optind;
463extern int _opterr;
464extern int _optopt;
465int _getopt(int, char **, const char *);
466
467#endif
468
469/* Toolkit compatibility */
470#ifndef TCPCALL
471#define TCPCALL _System
472#endif
473
474#include <sys/cdefs.h>
475#include <sys/types.h>
476int TCPCALL soclose(int);
477#ifndef _POSIX_SOURCE
478int TCPCALL gethostid(void);
479int TCPCALL gethostname(char *, int);
480#ifndef TCPV40HDRS
481int TCPCALL iruserok(unsigned long, int, const char *, const char *);
482int TCPCALL rcmd(char **, int, const char *, const char *, const char *, int *);
483int TCPCALL rresvport(int *);
484int TCPCALL ruserok(const char *, int, const char *, const char *);
485#include <sys/select.h>
486#endif /* !TCP40HDRS */
487#endif /* !_POSIX_SOURCE */
488
489__END_DECLS
490
491#endif /* not _UNISTD_H */
Note: See TracBrowser for help on using the repository browser.