00001
00002
00003 #ifndef _UNISTD_H
00004 #define _UNISTD_H
00005
00006 #ifndef _TYPES_H
00007 #include <sys/types.h>
00008 #endif
00009
00010
00011 #define F_OK 0
00012 #define X_OK 1
00013 #define W_OK 2
00014 #define R_OK 4
00015
00016
00017 #define SEEK_SET 0
00018 #define SEEK_CUR 1
00019 #define SEEK_END 2
00020
00021
00022 #define _POSIX_VERSION 199009L
00023
00024
00025 #define STDIN_FILENO 0
00026 #define STDOUT_FILENO 1
00027 #define STDERR_FILENO 2
00028
00029 #ifdef _MINIX
00030
00031 #define RBT_HALT 0
00032 #define RBT_REBOOT 1
00033 #define RBT_PANIC 2
00034 #define RBT_MONITOR 3
00035 #define RBT_RESET 4
00036 #define RBT_INVALID 5
00037
00038 #define _PM_SEG_FLAG (1L << 30)
00039 #endif
00040
00041
00042 #define SI_KINFO 0
00043 #define SI_PROC_ADDR 1
00044 #define SI_PROC_TAB 2
00045 #define SI_DMAP_TAB 3
00046 #define SI_MEM_ALLOC 4
00047 #define SI_DATA_STORE 5
00048 #define SI_LOADINFO 6
00049 #define SI_KPROC_TAB 7
00050
00051
00052 #define NULL ((void *)0)
00053
00054
00055 #define _SC_ARG_MAX 1
00056 #define _SC_CHILD_MAX 2
00057 #define _SC_CLOCKS_PER_SEC 3
00058 #define _SC_CLK_TCK 3
00059 #define _SC_NGROUPS_MAX 4
00060 #define _SC_OPEN_MAX 5
00061 #define _SC_JOB_CONTROL 6
00062 #define _SC_SAVED_IDS 7
00063 #define _SC_VERSION 8
00064 #define _SC_STREAM_MAX 9
00065 #define _SC_TZNAME_MAX 10
00066 #define _SC_PAGESIZE 11
00067 #define _SC_PAGE_SIZE _SC_PAGESIZE
00068
00069
00070 #define _PC_LINK_MAX 1
00071 #define _PC_MAX_CANON 2
00072 #define _PC_MAX_INPUT 3
00073 #define _PC_NAME_MAX 4
00074 #define _PC_PATH_MAX 5
00075 #define _PC_PIPE_BUF 6
00076 #define _PC_NO_TRUNC 7
00077 #define _PC_VDISABLE 8
00078 #define _PC_CHOWN_RESTRICTED 9
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 #define _POSIX_NO_TRUNC (-1)
00090 #define _POSIX_CHOWN_RESTRICTED 1
00091
00092
00093 _PROTOTYPE( void _exit, (int _status) );
00094 _PROTOTYPE( int access, (const char *_path, int _amode) );
00095 _PROTOTYPE( unsigned int alarm, (unsigned int _seconds) );
00096 _PROTOTYPE( int chdir, (const char *_path) );
00097 _PROTOTYPE( int fchdir, (int fd) );
00098 _PROTOTYPE( int chown, (const char *_path, _mnx_Uid_t _owner, _mnx_Gid_t _group) );
00099 _PROTOTYPE( int close, (int _fd) );
00100 _PROTOTYPE( char *ctermid, (char *_s) );
00101 _PROTOTYPE( char *cuserid, (char *_s) );
00102 _PROTOTYPE( int dup, (int _fd) );
00103 _PROTOTYPE( int dup2, (int _fd, int _fd2) );
00104 _PROTOTYPE( int execl, (const char *_path, const char *_arg, ...) );
00105 _PROTOTYPE( int execle, (const char *_path, const char *_arg, ...) );
00106 _PROTOTYPE( int execlp, (const char *_file, const char *arg, ...) );
00107 _PROTOTYPE( int execv, (const char *_path, char *const _argv[]) );
00108 _PROTOTYPE( int execve, (const char *_path, char *const _argv[],
00109 char *const _envp[]) );
00110 _PROTOTYPE( int execvp, (const char *_file, char *const _argv[]) );
00111 _PROTOTYPE( pid_t fork, (void) );
00112 _PROTOTYPE( long fpathconf, (int _fd, int _name) );
00113 _PROTOTYPE( char *getcwd, (char *_buf, size_t _size) );
00114 _PROTOTYPE( gid_t getegid, (void) );
00115 _PROTOTYPE( uid_t geteuid, (void) );
00116 _PROTOTYPE( gid_t getgid, (void) );
00117 _PROTOTYPE( int getgroups, (int _gidsetsize, gid_t _grouplist[]) );
00118 _PROTOTYPE( char *getlogin, (void) );
00119 _PROTOTYPE( pid_t getpgrp, (void) );
00120 _PROTOTYPE( pid_t getpid, (void) );
00121 _PROTOTYPE( pid_t getnpid, (int proc_nr) );
00122 _PROTOTYPE( pid_t getppid, (void) );
00123 _PROTOTYPE( uid_t getuid, (void) );
00124 _PROTOTYPE( int isatty, (int _fd) );
00125 _PROTOTYPE( int link, (const char *_existing, const char *_new) );
00126 _PROTOTYPE( off_t lseek, (int _fd, off_t _offset, int _whence) );
00127 _PROTOTYPE( long pathconf, (const char *_path, int _name) );
00128 _PROTOTYPE( int pause, (void) );
00129 _PROTOTYPE( int pipe, (int _fildes[2]) );
00130 _PROTOTYPE( ssize_t read, (int _fd, void *_buf, size_t _n) );
00131 _PROTOTYPE( int rmdir, (const char *_path) );
00132 _PROTOTYPE( int setgid, (_mnx_Gid_t _gid) );
00133 _PROTOTYPE( int setegid, (_mnx_Gid_t _gid) );
00134 _PROTOTYPE( int setpgid, (pid_t _pid, pid_t _pgid) );
00135 _PROTOTYPE( pid_t setsid, (void) );
00136 _PROTOTYPE( int setuid, (_mnx_Uid_t _uid) );
00137 _PROTOTYPE( int seteuid, (_mnx_Uid_t _uid) );
00138 _PROTOTYPE( unsigned int sleep, (unsigned int _seconds) );
00139 _PROTOTYPE( long sysconf, (int _name) );
00140 _PROTOTYPE( pid_t tcgetpgrp, (int _fd) );
00141 _PROTOTYPE( int tcsetpgrp, (int _fd, pid_t _pgrp_id) );
00142 _PROTOTYPE( char *ttyname, (int _fd) );
00143 _PROTOTYPE( int unlink, (const char *_path) );
00144 _PROTOTYPE( ssize_t write, (int _fd, const void *_buf, size_t _n) );
00145 _PROTOTYPE( int truncate, (const char *_path, off_t _length) );
00146 _PROTOTYPE( int ftruncate, (int _fd, off_t _length) );
00147
00148
00149 _PROTOTYPE( int symlink, (const char *path1, const char *path2) );
00150 _PROTOTYPE( int readlink, (const char *, char *, size_t) );
00151 _PROTOTYPE( int getopt, (int _argc, char * const _argv[], char const *_opts) );
00152 extern char *optarg;
00153 extern int optind, opterr, optopt;
00154 _PROTOTYPE( int usleep, (useconds_t _useconds) );
00155
00156 #ifdef _MINIX
00157 #ifndef _TYPE_H
00158 #include <minix/type.h>
00159 #endif
00160 _PROTOTYPE( int brk, (char *_addr) );
00161 _PROTOTYPE( int chroot, (const char *_name) );
00162 _PROTOTYPE( int mknod, (const char *_name, _mnx_Mode_t _mode, Dev_t _addr) );
00163 _PROTOTYPE( int mknod4, (const char *_name, _mnx_Mode_t _mode, Dev_t _addr,
00164 long _size) );
00165 _PROTOTYPE( char *mktemp, (char *_template) );
00166 _PROTOTYPE( int mount, (char *_spec, char *_name, int _flag) );
00167 _PROTOTYPE( long ptrace, (int _req, pid_t _pid, long _addr, long _data) );
00168 _PROTOTYPE( char *sbrk, (int _incr) );
00169 _PROTOTYPE( int sync, (void) );
00170 _PROTOTYPE( int fsync, (int fd) );
00171 _PROTOTYPE( int umount, (const char *_name) );
00172 _PROTOTYPE( int reboot, (int _how, ...) );
00173 _PROTOTYPE( int gethostname, (char *_hostname, size_t _len) );
00174 _PROTOTYPE( int getdomainname, (char *_domain, size_t _len) );
00175 _PROTOTYPE( int ttyslot, (void) );
00176 _PROTOTYPE( int fttyslot, (int _fd) );
00177 _PROTOTYPE( char *crypt, (const char *_key, const char *_salt) );
00178 _PROTOTYPE( int getsysinfo, (int who, int what, void *where) );
00179 _PROTOTYPE( int getsigset, (sigset_t *sigset) );
00180 _PROTOTYPE( int getprocnr, (void) );
00181 _PROTOTYPE( int getnprocnr, (pid_t pid) );
00182 _PROTOTYPE( int getpprocnr, (void) );
00183 _PROTOTYPE( int _pm_findproc, (char *proc_name, int *proc_nr) );
00184 _PROTOTYPE( int allocmem, (phys_bytes size, phys_bytes *base) );
00185 _PROTOTYPE( int freemem, (phys_bytes size, phys_bytes base) );
00186 #define DEV_MAP 1
00187 #define DEV_UNMAP 2
00188 #define mapdriver(driver, device, style) devctl(DEV_MAP, driver, device, style)
00189 #define unmapdriver(device) devctl(DEV_UNMAP, 0, device, 0)
00190 _PROTOTYPE( int devctl, (int ctl_req, int driver, int device, int style));
00191
00192
00193 _PROTOTYPE( int getpagesize, (void) );
00194 _PROTOTYPE( int setgroups, (int ngroups, const gid_t *gidset) );
00195 _PROTOTYPE( int initgroups, (const char *name, gid_t basegid) );
00196
00197 #endif
00198
00199 #endif