unistd.h

Go to the documentation of this file.
00001 /* The <unistd.h> header contains a few miscellaneous manifest constants. */
00002 
00003 #ifndef _UNISTD_H
00004 #define _UNISTD_H
00005 
00006 #ifndef _TYPES_H
00007 #include <sys/types.h>
00008 #endif
00009 
00010 /* Values used by access().  POSIX Table 2-8. */
00011 #define F_OK               0    /* test if file exists */
00012 #define X_OK               1    /* test if file is executable */
00013 #define W_OK               2    /* test if file is writable */
00014 #define R_OK               4    /* test if file is readable */
00015 
00016 /* Values used for whence in lseek(fd, offset, whence).  POSIX Table 2-9. */
00017 #define SEEK_SET           0    /* offset is absolute  */
00018 #define SEEK_CUR           1    /* offset is relative to current position */
00019 #define SEEK_END           2    /* offset is relative to end of file */
00020 
00021 /* This value is required by POSIX Table 2-10. */
00022 #define _POSIX_VERSION 199009L  /* which standard is being conformed to */
00023 
00024 /* These three definitions are required by POSIX Sec. 8.2.1.2. */
00025 #define STDIN_FILENO       0    /* file descriptor for stdin */
00026 #define STDOUT_FILENO      1    /* file descriptor for stdout */
00027 #define STDERR_FILENO      2    /* file descriptor for stderr */
00028 
00029 #ifdef _MINIX
00030 /* How to exit the system or stop a server process. */
00031 #define RBT_HALT           0    /* shutdown and return to monitor */
00032 #define RBT_REBOOT         1    /* reboot the system through the monitor */
00033 #define RBT_PANIC          2    /* a server panics */
00034 #define RBT_MONITOR        3    /* let the monitor do this */
00035 #define RBT_RESET          4    /* hard reset the system */
00036 #define RBT_INVALID        5    /* first invalid reboot flag */
00037 
00038 #define _PM_SEG_FLAG (1L << 30) /* for read() and write() to FS by PM */
00039 #endif
00040 
00041 /* What system info to retrieve with sysgetinfo(). */
00042 #define SI_KINFO           0    /* get kernel info via PM */
00043 #define SI_PROC_ADDR       1    /* address of process table */
00044 #define SI_PROC_TAB        2    /* copy of entire process table */
00045 #define SI_DMAP_TAB        3    /* get device <-> driver mappings */
00046 #define SI_MEM_ALLOC       4    /* get memory allocation data */
00047 #define SI_DATA_STORE      5    /* get copy of data store */
00048 #define SI_LOADINFO        6    /* get copy of load average structure */
00049 #define SI_KPROC_TAB       7    /* copy of kernel process table */
00050 
00051 /* NULL must be defined in <unistd.h> according to POSIX Sec. 2.7.1. */
00052 #define NULL    ((void *)0)
00053 
00054 /* The following relate to configurable system variables. POSIX Table 4-2. */
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 /* The following relate to configurable pathname variables. POSIX Table 5-2. */
00070 #define _PC_LINK_MAX       1    /* link count */
00071 #define _PC_MAX_CANON      2    /* size of the canonical input queue */
00072 #define _PC_MAX_INPUT      3    /* type-ahead buffer size */
00073 #define _PC_NAME_MAX       4    /* file name size */
00074 #define _PC_PATH_MAX       5    /* pathname size */
00075 #define _PC_PIPE_BUF       6    /* pipe size */
00076 #define _PC_NO_TRUNC       7    /* treatment of long name components */
00077 #define _PC_VDISABLE       8    /* tty disable */
00078 #define _PC_CHOWN_RESTRICTED 9  /* chown restricted or not */
00079 
00080 /* POSIX defines several options that may be implemented or not, at the
00081  * implementer's whim.  This implementer has made the following choices:
00082  *
00083  * _POSIX_JOB_CONTROL       not defined:        no job control
00084  * _POSIX_SAVED_IDS         not defined:        no saved uid/gid
00085  * _POSIX_NO_TRUNC          defined as -1:      long path names are truncated
00086  * _POSIX_CHOWN_RESTRICTED  defined:            you can't give away files
00087  * _POSIX_VDISABLE          defined:            tty functions can be disabled
00088  */
00089 #define _POSIX_NO_TRUNC       (-1)
00090 #define _POSIX_CHOWN_RESTRICTED  1
00091 
00092 /* Function Prototypes. */
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 /* Open Group Base Specifications Issue 6 (not complete) */
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 /* For compatibility with other Unix systems */
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 /* _UNISTD_H */

Generated on Fri Apr 14 22:57:23 2006 for minix by  doxygen 1.4.6