MINIX 2.0.0 includes@ 1/45 - Universidad de Sevilla · 00201 * occur during program execution. ......

45
MINIX 2.0.0 1/45 Aincludes@ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/ansi.h ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00000 /* The <ansi.h> header attempts to decide whether the compiler has enough 00001 * conformance to Standard C for Minix to take advantage of. If so, the 00002 * symbol _ANSI is defined (as 31415). Otherwise _ANSI is not defined 00003 * here, but it may be defined by applications that want to bend the rules. 00004 * The magic number in the definition is to inhibit unnecessary bending 00005 * of the rules. (For consistency with the new '#ifdef _ANSI" tests in 00006 * the headers, _ANSI should really be defined as nothing, but that would 00007 * break many library routines that use "#if _ANSI".) 00008 00009 * If _ANSI ends up being defined, a macro 00010 * 00011 * _PROTOTYPE(function, params) 00012 * 00013 * is defined. This macro expands in different ways, generating either 00014 * ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie) 00015 * prototypes, as needed. Finally, some programs use _CONST, _VOIDSTAR etc 00016 * in such a way that they are portable over both ANSI and K&R compilers. 00017 * The appropriate macros are defined here. 00018 */ 00019 00020 #ifndef _ANSI_H 00021 #define _ANSI_H 00022 00023 #if __STDC__ == 1 00024 #define _ANSI 31459 /* compiler claims full ANSI conformance */ 00025 #endif 00026 00027 #ifdef __GNUC__ 00028 #define _ANSI 31459 /* gcc conforms enough even in non-ANSI mode */ 00029 #endif 00030 00031 #ifdef _ANSI 00032 00033 /* Keep everything for ANSI prototypes. */ 00034 #define _PROTOTYPE(function, params) function params 00035 #define _ARGS(params) params 00036 00037 #define _VOIDSTAR void * 00038 #define _VOID void 00039 #define _CONST const 00040 #define _VOLATILE volatile 00041 #define _SIZET size_t 00042 00043 #else 00044 00045 /* Throw away the parameters for K&R prototypes. */ 00046 #define _PROTOTYPE(function, params) function() 00047 #define _ARGS(params) () 00048 00049 #define _VOIDSTAR void * 00050 #define _VOID void 00051 #define _CONST 00052 #define _VOLATILE 00053 #define _SIZET int 00054 00055 #endif /* _ANSI */ 00056 00057 #endif /* ANSI_H */

Transcript of MINIX 2.0.0 includes@ 1/45 - Universidad de Sevilla · 00201 * occur during program execution. ......

MINIX 2.0.0 1/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/ansi.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00000 /* The <ansi.h> header attempts to decide whether the compiler has enough00001 * conformance to Standard C for Minix to take advantage of. If so, the00002 * symbol _ANSI is defined (as 31415). Otherwise _ANSI is not defined00003 * here, but it may be defined by applications that want to bend the rules.00004 * The magic number in the definition is to inhibit unnecessary bending00005 * of the rules. (For consistency with the new '#ifdef _ANSI" tests in00006 * the headers, _ANSI should really be defined as nothing, but that would00007 * break many library routines that use "#if _ANSI".)0000800009 * If _ANSI ends up being defined, a macro00010 *00011 * _PROTOTYPE(function, params)00012 *00013 * is defined. This macro expands in different ways, generating either00014 * ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie)00015 * prototypes, as needed. Finally, some programs use _CONST, _VOIDSTAR etc00016 * in such a way that they are portable over both ANSI and K&R compilers.00017 * The appropriate macros are defined here.00018 */0001900020 #ifndef _ANSI_H00021 #define _ANSI_H0002200023 #if __STDC__ == 100024 #define _ANSI 31459 /* compiler claims full ANSI conformance */00025 #endif0002600027 #ifdef __GNUC__00028 #define _ANSI 31459 /* gcc conforms enough even in non-ANSI mode */00029 #endif0003000031 #ifdef _ANSI0003200033 /* Keep everything for ANSI prototypes. */00034 #define _PROTOTYPE(function, params) function params00035 #define _ARGS(params) params0003600037 #define _VOIDSTAR void *00038 #define _VOID void00039 #define _CONST const00040 #define _VOLATILE volatile00041 #define _SIZET size_t0004200043 #else0004400045 /* Throw away the parameters for K&R prototypes. */00046 #define _PROTOTYPE(function, params) function()00047 #define _ARGS(params) ()0004800049 #define _VOIDSTAR void *00050 #define _VOID void00051 #define _CONST00052 #define _VOLATILE00053 #define _SIZET int0005400055 #endif /* _ANSI */0005600057 #endif /* ANSI_H */

MINIX 2.0.0 2/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/limits.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00100 /* The <limits.h> header defines some basic sizes, both of the language types 00101 * (e.g., the number of bits in an integer), and of the operating system (e.g.00102 * the number of characters in a file name.00103 */0010400105 #ifndef _LIMITS_H00106 #define _LIMITS_H0010700108 /* Definitions about chars (8 bits in MINIX, and signed). */00109 #define CHAR_BIT 8 /* # bits in a char */00110 #define CHAR_MIN -128 /* minimum value of a char */00111 #define CHAR_MAX 127 /* maximum value of a char */00112 #define SCHAR_MIN -128 /* minimum value of a signed char */00113 #define SCHAR_MAX 127 /* maximum value of a signed char */00114 #define UCHAR_MAX 255 /* maximum value of an unsigned char */00115 #define MB_LEN_MAX 1 /* maximum length of a multibyte char */0011600117 /* Definitions about shorts (16 bits in MINIX). */00118 #define SHRT_MIN (-32767-1) /* minimum value of a short */00119 #define SHRT_MAX 32767 /* maximum value of a short */00120 #define USHRT_MAX 0xFFFF /* maximum value of unsigned short */0012100122 /* _EM_WSIZE is a compiler-generated symbol giving the word size in bytes. */00123 #if _EM_WSIZE == 200124 #define INT_MIN (-32767-1) /* minimum value of a 16-bit int */00125 #define INT_MAX 32767 /* maximum value of a 16-bit int */00126 #define UINT_MAX 0xFFFF /* maximum value of an unsigned 16-bit int */00127 #endif0012800129 #if _EM_WSIZE == 400130 #define INT_MIN (-2147483647-1) /* minimum value of a 32-bit int */00131 #define INT_MAX 2147483647 /* maximum value of a 32-bit int */00132 #define UINT_MAX 0xFFFFFFFF /* maximum value of an unsigned 32-bit int */00133 #endif0013400135 /*Definitions about longs (32 bits in MINIX). */00136 #define LONG_MIN (-2147483647L-1)/* minimum value of a long */00137 #define LONG_MAX 2147483647L /* maximum value of a long */00138 #define ULONG_MAX 0xFFFFFFFFL /* maximum value of an unsigned long */0013900140 /* Minimum sizes required by the POSIX P1003.1 standard (Table 2-3). */00141 #ifdef _POSIX_SOURCE /* these are only visible for POSIX */00142 #define _POSIX_ARG_MAX 4096 /* exec() may have 4K worth of args */00143 #define _POSIX_CHILD_MAX 6 /* a process may have 6 children */00144 #define _POSIX_LINK_MAX 8 /* a file may have 8 links */00145 #define _POSIX_MAX_CANON 255 /* size of the canonical input queue */00146 #define _POSIX_MAX_INPUT 255 /* you can type 255 chars ahead */00147 #define _POSIX_NAME_MAX 14 /* a file name may have 14 chars */00148 #define _POSIX_NGROUPS_MAX 0 /* supplementary group IDs are optional */00149 #define _POSIX_OPEN_MAX 16 /* a process may have 16 files open */00150 #define _POSIX_PATH_MAX 255 /* a pathname may contain 255 chars */00151 #define _POSIX_PIPE_BUF 512 /* pipes writes of 512 bytes must be atomic */00152 #define _POSIX_STREAM_MAX 8 /* at least 8 FILEs can be open at once */00153 #define _POSIX_TZNAME_MAX 3 /* time zone names can be at least 3 chars */00154 #define _POSIX_SSIZE_MAX 32767 /* read() must support 32767 byte reads */0015500156 /* Values actually implemented by MINIX (Tables 2-4, 2-5, 2-6, and 2-7). */00157 /* Some of these old names had better be defined when not POSIX. */00158 #define _NO_LIMIT 100 /* arbitrary number; limit not enforced */0015900160 #define NGROUPS_MAX 0 /* supplemental group IDs not available */00161 #if _EM_WSIZE > 200162 #define ARG_MAX 16384 /* # bytes of args + environ for exec() */00163 #else00164 #define ARG_MAX 4096 /* args + environ on small machines */00165 #endif00166 #define CHILD_MAX _NO_LIMIT /* MINIX does not limit children */00167 #define OPEN_MAX 20 /* # open files a process may have */00168 #define LINK_MAX 127 /* # links a file may have */00169 #define MAX_CANON 255 /* size of the canonical input queue */00170 #define MAX_INPUT 255 /* size of the type-ahead buffer */00171 #define NAME_MAX 14 /* # chars in a file name */00172 #define PATH_MAX 255 /* # chars in a path name */00173 #define PIPE_BUF 7168 /* # bytes in atomic write to a pipe */

MINIX 2.0.0 3/45 Aincludes@

00174 #define STREAM_MAX 20 /* must be the same as FOPEN_MAX in stdio.h */00175 #define TZNAME_MAX 3 /* maximum bytes in a time zone name is 3 */00176 #define SSIZE_MAX 32767 /* max defined byte count for read() */0017700178 #endif /* _POSIX_SOURCE */0017900180 #endif /* _LIMITS_H */

MINIX 2.0.0 4/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/errno.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00200 /* The <errno.h> header defines the numbers of the various errors that can00201 * occur during program execution. They are visible to user programs and 00202 * should be small positive integers. However, they are also used within 00203 * MINIX, where they must be negative. For example, the READ system call is 00204 * executed internally by calling do_read(). This function returns either a 00205 * (negative) error number or a (positive) number of bytes actually read.00206 *00207 * To solve the problem of having the error numbers be negative inside the00208 * the system and positive outside, the following mechanism is used. All the00209 * definitions are are the form:00210 *00211 * #define EPERM (_SIGN 1)00212 *00213 * If the macro _SYSTEM is defined, then _SIGN is set to "-", otherwise it is00214 * set to "". Thus when compiling the operating system, the macro _SYSTEM00215 * will be defined, setting EPERM to (- 1), whereas when when this00216 * file is included in an ordinary user program, EPERM has the value ( 1).00217 */0021800219 #ifndef _ERRNO_H /* check if <errno.h> is already included */00220 #define _ERRNO_H /* it is not included; note that fact */0022100222 /* Now define _SIGN as "" or "-" depending on _SYSTEM. */00223 #ifdef _SYSTEM00224 # define _SIGN -00225 # define OK 000226 #else00227 # define _SIGN 00228 #endif0022900230 extern int errno; /* place where the error numbers go */0023100232 /* Here are the numerical values of the error numbers. */00233 #define _NERROR 70 /* number of errors */ 0023400235 #define EGENERIC (_SIGN 99) /* generic error */00236 #define EPERM (_SIGN 1) /* operation not permitted */00237 #define ENOENT (_SIGN 2) /* no such file or directory */00238 #define ESRCH (_SIGN 3) /* no such process */00239 #define EINTR (_SIGN 4) /* interrupted function call */00240 #define EIO (_SIGN 5) /* input/output error */00241 #define ENXIO (_SIGN 6) /* no such device or address */00242 #define E2BIG (_SIGN 7) /* arg list too long */00243 #define ENOEXEC (_SIGN 8) /* exec format error */00244 #define EBADF (_SIGN 9) /* bad file descriptor */00245 #define ECHILD (_SIGN 10) /* no child process */00246 #define EAGAIN (_SIGN 11) /* resource temporarily unavailable */00247 #define ENOMEM (_SIGN 12) /* not enough space */00248 #define EACCES (_SIGN 13) /* permission denied */00249 #define EFAULT (_SIGN 14) /* bad address */00250 #define ENOTBLK (_SIGN 15) /* Extension: not a block special file */00251 #define EBUSY (_SIGN 16) /* resource busy */00252 #define EEXIST (_SIGN 17) /* file exists */00253 #define EXDEV (_SIGN 18) /* improper link */00254 #define ENODEV (_SIGN 19) /* no such device */00255 #define ENOTDIR (_SIGN 20) /* not a directory */00256 #define EISDIR (_SIGN 21) /* is a directory */00257 #define EINVAL (_SIGN 22) /* invalid argument */00258 #define ENFILE (_SIGN 23) /* too many open files in system */00259 #define EMFILE (_SIGN 24) /* too many open files */00260 #define ENOTTY (_SIGN 25) /* inappropriate I/O control operation */00261 #define ETXTBSY (_SIGN 26) /* no longer used */00262 #define EFBIG (_SIGN 27) /* file too large */00263 #define ENOSPC (_SIGN 28) /* no space left on device */00264 #define ESPIPE (_SIGN 29) /* invalid seek */00265 #define EROFS (_SIGN 30) /* read-only file system */00266 #define EMLINK (_SIGN 31) /* too many links */00267 #define EPIPE (_SIGN 32) /* broken pipe */00268 #define EDOM (_SIGN 33) /* domain error (from ANSI C std) */00269 #define ERANGE (_SIGN 34) /* result too large (from ANSI C std) */00270 #define EDEADLK (_SIGN 35) /* resource deadlock avoided */00271 #define ENAMETOOLONG (_SIGN 36) /* file name too long */00272 #define ENOLCK (_SIGN 37) /* no locks available */00273 #define ENOSYS (_SIGN 38) /* function not implemented */

MINIX 2.0.0 5/45 Aincludes@

00274 #define ENOTEMPTY (_SIGN 39) /* directory not empty */0027500276 /* The following errors relate to networking. */00277 #define EPACKSIZE (_SIGN 50) /* invalid packet size for some protocol */00278 #define EOUTOFBUFS (_SIGN 51) /* not enough buffers left */00279 #define EBADIOCTL (_SIGN 52) /* illegal ioctl for device */00280 #define EBADMODE (_SIGN 53) /* badmode in ioctl */00281 #define EWOULDBLOCK (_SIGN 54)00282 #define EBADDEST (_SIGN 55) /* not a valid destination address */00283 #define EDSTNOTRCH (_SIGN 56) /* destination not reachable */00284 #define EISCONN (_SIGN 57) /* all ready connected */00285 #define EADDRINUSE (_SIGN 58) /* address in use */00286 #define ECONNREFUSED (_SIGN 59) /* connection refused */00287 #define ECONNRESET (_SIGN 60) /* connection reset */00288 #define ETIMEDOUT (_SIGN 61) /* connection timed out */00289 #define EURG (_SIGN 62) /* urgent data present */00290 #define ENOURG (_SIGN 63) /* no urgent data present */00291 #define ENOTCONN (_SIGN 64) /* no connection (yet or anymore) */00292 #define ESHUTDOWN (_SIGN 65) /* a write call to a shutdown connection */00293 #define ENOCONN (_SIGN 66) /* no such connection */0029400295 /* The following are not POSIX errors, but they can still happen. */00296 #define ELOCKED (_SIGN 101) /* can't send message */00297 #define EBADCALL (_SIGN 102) /* error on send/receive */0029800299 /* The following error codes are generated by the kernel itself. */00300 #ifdef _SYSTEM00301 #define E_BAD_DEST -1001 /* destination address illegal */00302 #define E_BAD_SRC -1002 /* source address illegal */00303 #define E_TRY_AGAIN -1003 /* can't send-- tables full */00304 #define E_OVERRUN -1004 /* interrupt for task that is not waiting */00305 #define E_BAD_BUF -1005 /* message buf outside caller's addr space */00306 #define E_TASK -1006 /* can't send to task */00307 #define E_NO_MESSAGE -1007 /* RECEIVE failed: no message present */00308 #define E_NO_PERM -1008 /* ordinary users can't send to tasks */00309 #define E_BAD_FCN -1009 /* only valid fcns are SEND, RECEIVE, BOTH */00310 #define E_BAD_ADDR -1010 /* bad address given to utility routine */00311 #define E_BAD_PROC -1011 /* bad proc number given to utility */00312 #endif /* _SYSTEM */0031300314 #endif /* _ERRNO_H */

MINIX 2.0.0 6/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/unistd.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00400 /* The <unistd.h> header contains a few miscellaneous manifest constants. */0040100402 #ifndef _UNISTD_H00403 #define _UNISTD_H0040400405 /* POSIX requires size_t and ssize_t in <unistd.h> and elsewhere. */00406 #ifndef _SIZE_T00407 #define _SIZE_T00408 typedef unsigned int size_t;00409 #endif0041000411 #ifndef _SSIZE_T00412 #define _SSIZE_T00413 typedef int ssize_t;00414 #endif0041500416 /* Values used by access(). POSIX Table 2-8. */00417 #define F_OK 0 /* test if file exists */00418 #define X_OK 1 /* test if file is executable */00419 #define W_OK 2 /* test if file is writable */00420 #define R_OK 4 /* test if file is readable */0042100422 /* Values used for whence in lseek(fd, offset, whence). POSIX Table 2-9. */00423 #define SEEK_SET 0 /* offset is absolute */00424 #define SEEK_CUR 1 /* offset is relative to current position */00425 #define SEEK_END 2 /* offset is relative to end of file */0042600427 /* This value is required by POSIX Table 2-10. */00428 #define _POSIX_VERSION 199009L /* which standard is being conformed to */0042900430 /* These three definitions are required by POSIX Sec. 8.2.1.2. */00431 #define STDIN_FILENO 0 /* file descriptor for stdin */00432 #define STDOUT_FILENO 1 /* file descriptor for stdout */00433 #define STDERR_FILENO 2 /* file descriptor for stderr */0043400435 #ifdef _MINIX00436 /* How to exit the system. */00437 #define RBT_HALT 000438 #define RBT_REBOOT 100439 #define RBT_PANIC 2 /* for servers */00440 #define RBT_MONITOR 3 /* let the monitor do this */00441 #define RBT_RESET 4 /* hard reset the system */00442 #endif0044300444 /* NULL must be defined in <unistd.h> according to POSIX Sec. 2.7.1. */00445 #define NULL ((void *)0)0044600447 /* The following relate to configurable system variables. POSIX Table 4-2. */00448 #define _SC_ARG_MAX 100449 #define _SC_CHILD_MAX 200450 #define _SC_CLOCKS_PER_SEC 300451 #define _SC_CLK_TCK 300452 #define _SC_NGROUPS_MAX 400453 #define _SC_OPEN_MAX 500454 #define _SC_JOB_CONTROL 600455 #define _SC_SAVED_IDS 700456 #define _SC_VERSION 800457 #define _SC_STREAM_MAX 900458 #define _SC_TZNAME_MAX 100045900460 /* The following relate to configurable pathname variables. POSIX Table 5-2. */00461 #define _PC_LINK_MAX 1 /* link count */00462 #define _PC_MAX_CANON 2 /* size of the canonical input queue */00463 #define _PC_MAX_INPUT 3 /* type-ahead buffer size */00464 #define _PC_NAME_MAX 4 /* file name size */00465 #define _PC_PATH_MAX 5 /* pathname size */00466 #define _PC_PIPE_BUF 6 /* pipe size */00467 #define _PC_NO_TRUNC 7 /* treatment of long name components */00468 #define _PC_VDISABLE 8 /* tty disable */00469 #define _PC_CHOWN_RESTRICTED 9 /* chown restricted or not */0047000471 /* POSIX defines several options that may be implemented or not, at the00472 * implementer's whim. This implementer has made the following choices:00473 *

MINIX 2.0.0 7/45 Aincludes@

00474 * _POSIX_JOB_CONTROL not defined: no job control00475 * _POSIX_SAVED_IDS not defined: no saved uid/gid00476 * _POSIX_NO_TRUNC defined as -1: long path names are truncated00477 * _POSIX_CHOWN_RESTRICTED defined: you can't give away files00478 * _POSIX_VDISABLE defined: tty functions can be disabled00479 */00480 #define _POSIX_NO_TRUNC (-1)00481 #define _POSIX_CHOWN_RESTRICTED 10048200483 /* Function Prototypes. */00484 #ifndef _ANSI_H00485 #include <ansi.h>00486 #endif0048700488 _PROTOTYPE( void _exit, (int _status) );00489 _PROTOTYPE( int access, (const char *_path, int _amode) );00490 _PROTOTYPE( unsigned int alarm, (unsigned int _seconds) );00491 _PROTOTYPE( int chdir, (const char *_path) );00492 _PROTOTYPE( int chown, (const char *_path, Uid_t _owner, Gid_t _group) );00493 _PROTOTYPE( int close, (int _fd) );00494 _PROTOTYPE( char *ctermid, (char *_s) );00495 _PROTOTYPE( char *cuserid, (char *_s) );00496 _PROTOTYPE( int dup, (int _fd) );00497 _PROTOTYPE( int dup2, (int _fd, int _fd2) );00498 _PROTOTYPE( int execl, (const char *_path, const char *_arg, ...) );00499 _PROTOTYPE( int execle, (const char *_path, const char *_arg, ...) );00500 _PROTOTYPE( int execlp, (const char *_file, const char *arg, ...) );00501 _PROTOTYPE( int execv, (const char *_path, char *const _argv[]) );00502 _PROTOTYPE( int execve, (const char *_path, char *const _argv[], 00503 char *const _envp[]) );00504 _PROTOTYPE( int execvp, (const char *_file, char *const _argv[]) );00505 _PROTOTYPE( pid_t fork, (void) );00506 _PROTOTYPE( long fpathconf, (int _fd, int _name) );00507 _PROTOTYPE( char *getcwd, (char *_buf, size_t _size) );00508 _PROTOTYPE( gid_t getegid, (void) );00509 _PROTOTYPE( uid_t geteuid, (void) );00510 _PROTOTYPE( gid_t getgid, (void) );00511 _PROTOTYPE( int getgroups, (int _gidsetsize, gid_t _grouplist[]) );00512 _PROTOTYPE( char *getlogin, (void) );00513 _PROTOTYPE( pid_t getpgrp, (void) );00514 _PROTOTYPE( pid_t getpid, (void) );00515 _PROTOTYPE( pid_t getppid, (void) );00516 _PROTOTYPE( uid_t getuid, (void) );00517 _PROTOTYPE( int isatty, (int _fd) );00518 _PROTOTYPE( int link, (const char *_existing, const char *_new) );00519 _PROTOTYPE( off_t lseek, (int _fd, off_t _offset, int _whence) );00520 _PROTOTYPE( long pathconf, (const char *_path, int _name) );00521 _PROTOTYPE( int pause, (void) );00522 _PROTOTYPE( int pipe, (int _fildes[2]) );00523 _PROTOTYPE( ssize_t read, (int _fd, void *_buf, size_t _n) );00524 _PROTOTYPE( int rmdir, (const char *_path) );00525 _PROTOTYPE( int setgid, (Gid_t _gid) );00526 _PROTOTYPE( int setpgid, (pid_t _pid, pid_t _pgid) );00527 _PROTOTYPE( pid_t setsid, (void) );00528 _PROTOTYPE( int setuid, (Uid_t _uid) );00529 _PROTOTYPE( unsigned int sleep, (unsigned int _seconds) );00530 _PROTOTYPE( long sysconf, (int _name) );00531 _PROTOTYPE( pid_t tcgetpgrp, (int _fd) );00532 _PROTOTYPE( int tcsetpgrp, (int _fd, pid_t _pgrp_id) );00533 _PROTOTYPE( char *ttyname, (int _fd) );00534 _PROTOTYPE( int unlink, (const char *_path) );00535 _PROTOTYPE( ssize_t write, (int _fd, const void *_buf, size_t _n) );0053600537 #ifdef _MINIX00538 _PROTOTYPE( int brk, (char *_addr) );00539 _PROTOTYPE( int chroot, (const char *_name) );00540 _PROTOTYPE( int mknod, (const char *_name, Mode_t _mode, Dev_t _addr) );00541 _PROTOTYPE( int mknod4, (const char *_name, Mode_t _mode, Dev_t _addr,00542 long _size) );00543 _PROTOTYPE( char *mktemp, (char *_template) );00544 _PROTOTYPE( int mount, (char *_spec, char *_name, int _flag) );00545 _PROTOTYPE( long ptrace, (int _req, pid_t _pid, long _addr, long _data) );00546 _PROTOTYPE( char *sbrk, (int _incr) );00547 _PROTOTYPE( int sync, (void) );00548 _PROTOTYPE( int umount, (const char *_name) );00549 _PROTOTYPE( int reboot, (int _how, ...) );00550 _PROTOTYPE( int gethostname, (char *_hostname, size_t _len) );00551 _PROTOTYPE( int getdomainname, (char *_domain, size_t _len) );

MINIX 2.0.0 8/45 Aincludes@

00552 _PROTOTYPE( int ttyslot, (void) );00553 _PROTOTYPE( int fttyslot, (int _fd) );00554 _PROTOTYPE( char *crypt, (const char *_key, const char *_salt) );00555 #endif0055600557 #endif /* _UNISTD_H */

MINIX 2.0.0 9/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/string.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00600 /* The <string.h> header contains prototypes for the string handling 00601 * functions.00602 */0060300604 #ifndef _STRING_H00605 #define _STRING_H0060600607 #define NULL ((void *)0)0060800609 #ifndef _SIZE_T00610 #define _SIZE_T00611 typedef unsigned int size_t; /* type returned by sizeof */00612 #endif /*_SIZE_T */0061300614 /* Function Prototypes. */00615 #ifndef _ANSI_H00616 #include <ansi.h>00617 #endif0061800619 _PROTOTYPE( void *memchr, (const void *_s, int _c, size_t _n) );00620 _PROTOTYPE( int memcmp, (const void *_s1, const void *_s2, size_t _n) );00621 _PROTOTYPE( void *memcpy, (void *_s1, const void *_s2, size_t _n) );00622 _PROTOTYPE( void *memmove, (void *_s1, const void *_s2, size_t _n) );00623 _PROTOTYPE( void *memset, (void *_s, int _c, size_t _n) );00624 _PROTOTYPE( char *strcat, (char *_s1, const char *_s2) );00625 _PROTOTYPE( char *strchr, (const char *_s, int _c) );00626 _PROTOTYPE( int strncmp, (const char *_s1, const char *_s2, size_t _n) );00627 _PROTOTYPE( int strcmp, (const char *_s1, const char *_s2) );00628 _PROTOTYPE( int strcoll, (const char *_s1, const char *_s2) );00629 _PROTOTYPE( char *strcpy, (char *_s1, const char *_s2) );00630 _PROTOTYPE( size_t strcspn, (const char *_s1, const char *_s2) );00631 _PROTOTYPE( char *strerror, (int _errnum) );00632 _PROTOTYPE( size_t strlen, (const char *_s) );00633 _PROTOTYPE( char *strncat, (char *_s1, const char *_s2, size_t _n) );00634 _PROTOTYPE( char *strncpy, (char *_s1, const char *_s2, size_t _n) );00635 _PROTOTYPE( char *strpbrk, (const char *_s1, const char *_s2) );00636 _PROTOTYPE( char *strrchr, (const char *_s, int _c) );00637 _PROTOTYPE( size_t strspn, (const char *_s1, const char *_s2) );00638 _PROTOTYPE( char *strstr, (const char *_s1, const char *_s2) );00639 _PROTOTYPE( char *strtok, (char *_s1, const char *_s2) );00640 _PROTOTYPE( size_t strxfrm, (char *_s1, const char *_s2, size_t _n) );0064100642 #ifdef _MINIX00643 /* For backward compatibility. */00644 _PROTOTYPE( char *index, (const char *_s, int _charwanted) );00645 _PROTOTYPE( char *rindex, (const char *_s, int _charwanted) );00646 _PROTOTYPE( void bcopy, (const void *_src, void *_dst, size_t _length) );00647 _PROTOTYPE( int bcmp, (const void *_s1, const void *_s2, size_t _length));00648 _PROTOTYPE( void bzero, (void *_dst, size_t _length) );00649 _PROTOTYPE( void *memccpy, (char *_dst, const char *_src, int _ucharstop,00650 size_t _size) );00651 /* BSD functions */00652 _PROTOTYPE( int strcasecmp, (const char *_s1, const char *_s2) );00653 #endif0065400655 #endif /* _STRING_H */

MINIX 2.0.0 10/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/signal.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00700 /* The <signal.h> header defines all the ANSI and POSIX signals.00701 * MINIX supports all the signals required by POSIX. They are defined below.00702 * Some additional signals are also supported.00703 */0070400705 #ifndef _SIGNAL_H00706 #define _SIGNAL_H0070700708 #ifndef _ANSI_H00709 #include <ansi.h>00710 #endif0071100712 /* Here are types that are closely associated with signal handling. */00713 typedef int sig_atomic_t;0071400715 #ifdef _POSIX_SOURCE00716 #ifndef _SIGSET_T00717 #define _SIGSET_T00718 typedef unsigned long sigset_t;00719 #endif00720 #endif0072100722 #define _NSIG 16 /* number of signals used */0072300724 #define SIGHUP 1 /* hangup */00725 #define SIGINT 2 /* interrupt (DEL) */00726 #define SIGQUIT 3 /* quit (ASCII FS) */00727 #define SIGILL 4 /* illegal instruction */00728 #define SIGTRAP 5 /* trace trap (not reset when caught) */00729 #define SIGABRT 6 /* IOT instruction */00730 #define SIGIOT 6 /* SIGABRT for people who speak PDP-11 */00731 #define SIGUNUSED 7 /* spare code */00732 #define SIGFPE 8 /* floating point exception */00733 #define SIGKILL 9 /* kill (cannot be caught or ignored) */00734 #define SIGUSR1 10 /* user defined signal # 1 */00735 #define SIGSEGV 11 /* segmentation violation */00736 #define SIGUSR2 12 /* user defined signal # 2 */00737 #define SIGPIPE 13 /* write on a pipe with no one to read it */00738 #define SIGALRM 14 /* alarm clock */00739 #define SIGTERM 15 /* software termination signal from kill */0074000741 #define SIGEMT 7 /* obsolete */00742 #define SIGBUS 10 /* obsolete */0074300744 /* POSIX requires the following signals to be defined, even if they are00745 * not supported. Here are the definitions, but they are not supported.00746 */00747 #define SIGCHLD 17 /* child process terminated or stopped */00748 #define SIGCONT 18 /* continue if stopped */00749 #define SIGSTOP 19 /* stop signal */00750 #define SIGTSTP 20 /* interactive stop signal */00751 #define SIGTTIN 21 /* background process wants to read */00752 #define SIGTTOU 22 /* background process wants to write */0075300754 /* The sighandler_t type is not allowed unless _POSIX_SOURCE is defined. */00755 #ifdef _POSIX_SOURCE00756 #define __sighandler_t sighandler_t00757 #else00758 typedef void (*__sighandler_t) (int);00759 #endif0076000761 /* Macros used as function pointers. */00762 #define SIG_ERR ((__sighandler_t) -1) /* error return */00763 #define SIG_DFL ((__sighandler_t) 0) /* default signal handling */00764 #define SIG_IGN ((__sighandler_t) 1) /* ignore signal */00765 #define SIG_HOLD ((__sighandler_t) 2) /* block signal */00766 #define SIG_CATCH ((__sighandler_t) 3) /* catch signal */0076700768 #ifdef _POSIX_SOURCE00769 struct sigaction {00770 __sighandler_t sa_handler; /* SIG_DFL, SIG_IGN, or pointer to function */00771 sigset_t sa_mask; /* signals to be blocked during handler */00772 int sa_flags; /* special flags */00773 };

MINIX 2.0.0 11/45 Aincludes@

0077400775 /* Fields for sa_flags. */00776 #define SA_ONSTACK 0x0001 /* deliver signal on alternate stack */00777 #define SA_RESETHAND 0x0002 /* reset signal handler when signal caught */00778 #define SA_NODEFER 0x0004 /* don't block signal while catching it */00779 #define SA_RESTART 0x0008 /* automatic system call restart */00780 #define SA_SIGINFO 0x0010 /* extended signal handling */00781 #define SA_NOCLDWAIT 0x0020 /* don't create zombies */00782 #define SA_NOCLDSTOP 0x0040 /* don't receive SIGCHLD when child stops */0078300784 /* POSIX requires these values for use with sigprocmask(2). */00785 #define SIG_BLOCK 0 /* for blocking signals */00786 #define SIG_UNBLOCK 1 /* for unblocking signals */00787 #define SIG_SETMASK 2 /* for setting the signal mask */00788 #define SIG_INQUIRE 4 /* for internal use only */00789 #endif /* _POSIX_SOURCE */0079000791 /* POSIX and ANSI function prototypes. */00792 _PROTOTYPE( int raise, (int _sig) );00793 _PROTOTYPE( __sighandler_t signal, (int _sig, __sighandler_t _func) );0079400795 #ifdef _POSIX_SOURCE00796 _PROTOTYPE( int kill, (pid_t _pid, int _sig) );00797 _PROTOTYPE( int sigaction,00798 (int _sig, const struct sigaction *_act, struct sigaction *_oact) );00799 _PROTOTYPE( int sigaddset, (sigset_t *_set, int _sig) );00800 _PROTOTYPE( int sigdelset, (sigset_t *_set, int _sig) );00801 _PROTOTYPE( int sigemptyset, (sigset_t *_set) );00802 _PROTOTYPE( int sigfillset, (sigset_t *_set) );00803 _PROTOTYPE( int sigismember, (sigset_t *_set, int _sig) );00804 _PROTOTYPE( int sigpending, (sigset_t *_set) );00805 _PROTOTYPE( int sigprocmask,00806 (int _how, const sigset_t *_set, sigset_t *_oset) );00807 _PROTOTYPE( int sigsuspend, (const sigset_t *_sigmask) );00808 #endif0080900810 #endif /* _SIGNAL_H */

MINIX 2.0.0 12/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/fcntl.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

00900 /* The <fcntl.h> header is needed by the open() and fcntl() system calls,00901 * which have a variety of parameters and flags. They are described here. 00902 * The formats of the calls to each of these are:00903 *00904 * open(path, oflag [,mode]) open a file00905 * fcntl(fd, cmd [,arg]) get or set file attributes00906 * 00907 */0090800909 #ifndef _FCNTL_H00910 #define _FCNTL_H0091100912 /* These values are used for cmd in fcntl(). POSIX Table 6-1. */00913 #define F_DUPFD 0 /* duplicate file descriptor */00914 #define F_GETFD 1 /* get file descriptor flags */00915 #define F_SETFD 2 /* set file descriptor flags */00916 #define F_GETFL 3 /* get file status flags */00917 #define F_SETFL 4 /* set file status flags */00918 #define F_GETLK 5 /* get record locking information */00919 #define F_SETLK 6 /* set record locking information */00920 #define F_SETLKW 7 /* set record locking info; wait if blocked */0092100922 /* File descriptor flags used for fcntl(). POSIX Table 6-2. */00923 #define FD_CLOEXEC 1 /* close on exec flag for third arg of fcntl */0092400925 /* L_type values for record locking with fcntl(). POSIX Table 6-3. */00926 #define F_RDLCK 1 /* shared or read lock */00927 #define F_WRLCK 2 /* exclusive or write lock */00928 #define F_UNLCK 3 /* unlock */0092900930 /* Oflag values for open(). POSIX Table 6-4. */00931 #define O_CREAT 00100 /* creat file if it doesn't exist */00932 #define O_EXCL 00200 /* exclusive use flag */00933 #define O_NOCTTY 00400 /* do not assign a controlling terminal */00934 #define O_TRUNC 01000 /* truncate flag */0093500936 /* File status flags for open() and fcntl(). POSIX Table 6-5. */00937 #define O_APPEND 02000 /* set append mode */00938 #define O_NONBLOCK 04000 /* no delay */0093900940 /* File access modes for open() and fcntl(). POSIX Table 6-6. */00941 #define O_RDONLY 0 /* open(name, O_RDONLY) opens read only */00942 #define O_WRONLY 1 /* open(name, O_WRONLY) opens write only */00943 #define O_RDWR 2 /* open(name, O_RDWR) opens read/write */0094400945 /* Mask for use with file access modes. POSIX Table 6-7. */00946 #define O_ACCMODE 03 /* mask for file access modes */0094700948 /* Struct used for locking. POSIX Table 6-8. */00949 struct flock {00950 short l_type; /* type: F_RDLCK, F_WRLCK, or F_UNLCK */00951 short l_whence; /* flag for starting offset */00952 off_t l_start; /* relative offset in bytes */00953 off_t l_len; /* size; if 0, then until EOF */00954 pid_t l_pid; /* process id of the locks' owner */00955 };009560095700958 /* Function Prototypes. */00959 #ifndef _ANSI_H00960 #include <ansi.h>00961 #endif0096200963 _PROTOTYPE( int creat, (const char *_path, Mode_t _mode) );00964 _PROTOTYPE( int fcntl, (int _filedes, int _cmd, ...) );00965 _PROTOTYPE( int open, (const char *_path, int _oflag, ...) );0096600967 #endif /* _FCNTL_H */

MINIX 2.0.0 13/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/stdlib.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

01000 /* The <stdlib.h> header defines certain common macros, types, and functions.*/0100101002 #ifndef _STDLIB_H01003 #define _STDLIB_H0100401005 /* The macros are NULL, EXIT_FAILURE, EXIT_SUCCESS, RAND_MAX, and MB_CUR_MAX.*/01006 #define NULL ((void *)0)0100701008 #define EXIT_FAILURE 1 /* standard error return using exit() */01009 #define EXIT_SUCCESS 0 /* successful return using exit() */01010 #define RAND_MAX 32767 /* largest value generated by rand() */01011 #define MB_CUR_MAX 1 /* max value of multibyte character in MINIX */0101201013 typedef struct { int quot, rem; } div_t;01014 typedef struct { long quot, rem; } ldiv_t;0101501016 /* The types are size_t, wchar_t, div_t, and ldiv_t. */01017 #ifndef _SIZE_T01018 #define _SIZE_T01019 typedef unsigned int size_t; /* type returned by sizeof */01020 #endif0102101022 #ifndef _WCHAR_T01023 #define _WCHAR_T01024 typedef char wchar_t; /* type expanded character set */01025 #endif0102601027 /* Function Prototypes. */01028 #ifndef _ANSI_H01029 #include <ansi.h>01030 #endif0103101032 _PROTOTYPE( void abort, (void) );01033 _PROTOTYPE( int abs, (int _j) );01034 _PROTOTYPE( int atexit, (void (*_func)(void)) );01035 _PROTOTYPE( double atof, (const char *_nptr) );01036 _PROTOTYPE( int atoi, (const char *_nptr) );01037 _PROTOTYPE( long atol, (const char *_nptr) );01038 _PROTOTYPE( void *calloc, (size_t _nmemb, size_t _size) );01039 _PROTOTYPE( div_t div, (int _numer, int _denom) );01040 _PROTOTYPE( void exit, (int _status) );01041 _PROTOTYPE( void free, (void *_ptr) );01042 _PROTOTYPE( char *getenv, (const char *_name) );01043 _PROTOTYPE( long labs, (long _j) );01044 _PROTOTYPE( ldiv_t ldiv, (long _numer, long _denom) );01045 _PROTOTYPE( void *malloc, (size_t _size) );01046 _PROTOTYPE( int mblen, (const char *_s, size_t _n) );01047 _PROTOTYPE( size_t mbstowcs, (wchar_t *_pwcs, const char *_s, size_t _n));01048 _PROTOTYPE( int mbtowc, (wchar_t *_pwc, const char *_s, size_t _n) );01049 _PROTOTYPE( int rand, (void) );01050 _PROTOTYPE( void *realloc, (void *_ptr, size_t _size) );01051 _PROTOTYPE( void srand, (unsigned int _seed) );01052 _PROTOTYPE( double strtod, (const char *_nptr, char **_endptr) );01053 _PROTOTYPE( long strtol, (const char *_nptr, char **_endptr, int _base) );01054 _PROTOTYPE( int system, (const char *_string) );01055 _PROTOTYPE( size_t wcstombs, (char *_s, const wchar_t *_pwcs, size_t _n));01056 _PROTOTYPE( int wctomb, (char *_s, wchar_t _wchar) );01057 _PROTOTYPE( void *bsearch, (const void *_key, const void *_base, 01058 size_t _nmemb, size_t _size, 01059 int (*compar) (const void *, const void *)) );01060 _PROTOTYPE( void qsort, (void *_base, size_t _nmemb, size_t _size,01061 int (*compar) (const void *, const void *)) );01062 _PROTOTYPE( unsigned long int strtoul,01063 (const char *_nptr, char **_endptr, int _base) );0106401065 #ifdef _MINIX01066 _PROTOTYPE( int putenv, (const char *_name) );01067 _PROTOTYPE(int getopt, (int _argc, char **_argv, char *_opts));01068 extern char *optarg;01069 extern int optind, opterr, optopt;01070 #endif /* _MINIX */0107101072 #endif /* STDLIB_H */

MINIX 2.0.0 14/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/termios.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

01100 /* The <termios.h> header is used for controlling tty modes. */0110101102 #ifndef _TERMIOS_H01103 #define _TERMIOS_H0110401105 typedef unsigned short tcflag_t;01106 typedef unsigned char cc_t;01107 typedef unsigned int speed_t;0110801109 #define NCCS 20 /* size of cc_c array, some extra space01110 * for extensions. */0111101112 /* Primary terminal control structure. POSIX Table 7-1. */01113 struct termios {01114 tcflag_t c_iflag; /* input modes */01115 tcflag_t c_oflag; /* output modes */01116 tcflag_t c_cflag; /* control modes */01117 tcflag_t c_lflag; /* local modes */01118 speed_t c_ispeed; /* input speed */01119 speed_t c_ospeed; /* output speed */01120 cc_t c_cc[NCCS]; /* control characters */01121 };0112201123 /* Values for termios c_iflag bit map. POSIX Table 7-2. */01124 #define BRKINT 0x0001 /* signal interrupt on break */01125 #define ICRNL 0x0002 /* map CR to NL on input */01126 #define IGNBRK 0x0004 /* ignore break */01127 #define IGNCR 0x0008 /* ignore CR */01128 #define IGNPAR 0x0010 /* ignore characters with parity errors */01129 #define INLCR 0x0020 /* map NL to CR on input */01130 #define INPCK 0x0040 /* enable input parity check */01131 #define ISTRIP 0x0080 /* mask off 8th bit */01132 #define IXOFF 0x0100 /* enable start/stop input control */01133 #define IXON 0x0200 /* enable start/stop output control */01134 #define PARMRK 0x0400 /* mark parity errors in the input queue */0113501136 /* Values for termios c_oflag bit map. POSIX Sec. 7.1.2.3. */01137 #define OPOST 0x0001 /* perform output processing */0113801139 /* Values for termios c_cflag bit map. POSIX Table 7-3. */01140 #define CLOCAL 0x0001 /* ignore modem status lines */01141 #define CREAD 0x0002 /* enable receiver */01142 #define CSIZE 0x000C /* number of bits per character */01143 #define CS5 0x0000 /* if CSIZE is CS5, characters are 5 bits */01144 #define CS6 0x0004 /* if CSIZE is CS6, characters are 6 bits */01145 #define CS7 0x0008 /* if CSIZE is CS7, characters are 7 bits */01146 #define CS8 0x000C /* if CSIZE is CS8, characters are 8 bits */01147 #define CSTOPB 0x0010 /* send 2 stop bits if set, else 1 */01148 #define HUPCL 0x0020 /* hang up on last close */01149 #define PARENB 0x0040 /* enable parity on output */01150 #define PARODD 0x0080 /* use odd parity if set, else even */0115101152 /* Values for termios c_lflag bit map. POSIX Table 7-4. */01153 #define ECHO 0x0001 /* enable echoing of input characters */01154 #define ECHOE 0x0002 /* echo ERASE as backspace */01155 #define ECHOK 0x0004 /* echo KILL */01156 #define ECHONL 0x0008 /* echo NL */01157 #define ICANON 0x0010 /* canonical input (erase and kill enabled) */01158 #define IEXTEN 0x0020 /* enable extended functions */01159 #define ISIG 0x0040 /* enable signals */01160 #define NOFLSH 0x0080 /* disable flush after interrupt or quit */01161 #define TOSTOP 0x0100 /* send SIGTTOU (job control, not implemented*/0116201163 /* Indices into c_cc array. Default values in parentheses. POSIX Table 7-5. */01164 #define VEOF 0 /* cc_c[VEOF] = EOF char (^D) */01165 #define VEOL 1 /* cc_c[VEOL] = EOL char (undef) */01166 #define VERASE 2 /* cc_c[VERASE] = ERASE char (^H) */01167 #define VINTR 3 /* cc_c[VINTR] = INTR char (DEL) */01168 #define VKILL 4 /* cc_c[VKILL] = KILL char (^U) */01169 #define VMIN 5 /* cc_c[VMIN] = MIN value for timer */01170 #define VQUIT 6 /* cc_c[VQUIT] = QUIT char (^\) */01171 #define VTIME 7 /* cc_c[VTIME] = TIME value for timer */01172 #define VSUSP 8 /* cc_c[VSUSP] = SUSP (^Z, ignored) */01173 #define VSTART 9 /* cc_c[VSTART] = START char (^S) */

MINIX 2.0.0 15/45 Aincludes@

01174 #define VSTOP 10 /* cc_c[VSTOP] = STOP char (^Q) */0117501176 #define _POSIX_VDISABLE (cc_t)0xFF /* You can't even generate this 01177 * character with 'normal' keyboards.01178 * But some language specific keyboards01179 * can generate 0xFF. It seems that all01180 * 256 are used, so cc_t should be a01181 * short...01182 */0118301184 /* Values for the baud rate settings. POSIX Table 7-6. */01185 #define B0 0x0000 /* hang up the line */01186 #define B50 0x1000 /* 50 baud */01187 #define B75 0x2000 /* 75 baud */01188 #define B110 0x3000 /* 110 baud */01189 #define B134 0x4000 /* 134.5 baud */01190 #define B150 0x5000 /* 150 baud */01191 #define B200 0x6000 /* 200 baud */01192 #define B300 0x7000 /* 300 baud */01193 #define B600 0x8000 /* 600 baud */01194 #define B1200 0x9000 /* 1200 baud */01195 #define B1800 0xA000 /* 1800 baud */01196 #define B2400 0xB000 /* 2400 baud */01197 #define B4800 0xC000 /* 4800 baud */01198 #define B9600 0xD000 /* 9600 baud */01199 #define B19200 0xE000 /* 19200 baud */01200 #define B38400 0xF000 /* 38400 baud */0120101202 /* Optional actions for tcsetattr(). POSIX Sec. 7.2.1.2. */01203 #define TCSANOW 1 /* changes take effect immediately */01204 #define TCSADRAIN 2 /* changes take effect after output is done */01205 #define TCSAFLUSH 3 /* wait for output to finish and flush input */0120601207 /* Queue_selector values for tcflush(). POSIX Sec. 7.2.2.2. */01208 #define TCIFLUSH 1 /* flush accumulated input data */01209 #define TCOFLUSH 2 /* flush accumulated output data */01210 #define TCIOFLUSH 3 /* flush accumulated input and output data */0121101212 /* Action values for tcflow(). POSIX Sec. 7.2.2.2. */01213 #define TCOOFF 1 /* suspend output */01214 #define TCOON 2 /* restart suspended output */01215 #define TCIOFF 3 /* transmit a STOP character on the line */01216 #define TCION 4 /* transmit a START character on the line */012170121801219 /* Function Prototypes. */01220 #ifndef _ANSI_H01221 #include <ansi.h>01222 #endif0122301224 _PROTOTYPE( int tcsendbreak, (int _fildes, int _duration) );01225 _PROTOTYPE( int tcdrain, (int _filedes) );01226 _PROTOTYPE( int tcflush, (int _filedes, int _queue_selector) );01227 _PROTOTYPE( int tcflow, (int _filedes, int _action) );01228 _PROTOTYPE( speed_t cfgetispeed, (const struct termios *_termios_p) );01229 _PROTOTYPE( speed_t cfgetospeed, (const struct termios *_termios_p) );01230 _PROTOTYPE( int cfsetispeed, (struct termios *_termios_p, speed_t _speed) );01231 _PROTOTYPE( int cfsetospeed, (struct termios *_termios_p, speed_t _speed) );01232 _PROTOTYPE( int tcgetattr, (int _filedes, struct termios *_termios_p) );01233 _PROTOTYPE( int tcsetattr, \01234 (int _filedes, int _opt_actions, const struct termios *_termios_p) );0123501236 #define cfgetispeed(termios_p) ((termios_p)->c_ispeed)01237 #define cfgetospeed(termios_p) ((termios_p)->c_ospeed)01238 #define cfsetispeed(termios_p, speed) ((termios_p)->c_ispeed = (speed), 0)01239 #define cfsetospeed(termios_p, speed) ((termios_p)->c_ospeed = (speed), 0)0124001241 #ifdef _MINIX01242 /* Here are the local extensions to the POSIX standard for Minix. Posix01243 * conforming programs are not able to access these, and therefore they are01244 * only defined when a Minix program is compiled.01245 */0124601247 /* Extensions to the termios c_iflag bit map. */01248 #define IXANY 0x0800 /* allow any key to continue ouptut */0124901250 /* Extensions to the termios c_oflag bit map. They are only active iff01251 * OPOST is enabled. */

MINIX 2.0.0 16/45 Aincludes@

01252 #define ONLCR 0x0002 /* Map NL to CR-NL on output */01253 #define XTABS 0x0004 /* Expand tabs to spaces */01254 #define ONOEOT 0x0008 /* discard EOT's (^D) on output) */0125501256 /* Extensions to the termios c_lflag bit map. */01257 #define LFLUSHO 0x0200 /* Flush output. */0125801259 /* Extensions to the c_cc array. */01260 #define VREPRINT 11 /* cc_c[VREPRINT] (^R) */01261 #define VLNEXT 12 /* cc_c[VLNEXT] (^V) */01262 #define VDISCARD 13 /* cc_c[VDISCARD] (^O) */0126301264 /* Extensions to baud rate settings. */01265 #define B57600 0x0100 /* 57600 baud */01266 #define B115200 0x0200 /* 115200 baud */0126701268 /* These are the default settings used by the kernel and by 'stty sane' */0126901270 #define TCTRL_DEF (CREAD | CS8 | HUPCL)01271 #define TINPUT_DEF (BRKINT | ICRNL | IXON | IXANY)01272 #define TOUTPUT_DEF (OPOST | ONLCR)01273 #define TLOCAL_DEF (ISIG | IEXTEN | ICANON | ECHO | ECHOE)01274 #define TSPEED_DEF B96000127501276 #define TEOF_DEF '\4' /* ^D */01277 #define TEOL_DEF _POSIX_VDISABLE01278 #define TERASE_DEF '\10' /* ^H */01279 #define TINTR_DEF '\177' /* ^? */01280 #define TKILL_DEF '\25' /* ^U */01281 #define TMIN_DEF 101282 #define TQUIT_DEF '\34' /* ^\ */01283 #define TSTART_DEF '\21' /* ^Q */01284 #define TSTOP_DEF '\23' /* ^S */01285 #define TSUSP_DEF '\32' /* ^Z */01286 #define TTIME_DEF 001287 #define TREPRINT_DEF '\22' /* ^R */01288 #define TLNEXT_DEF '\26' /* ^V */01289 #define TDISCARD_DEF '\17' /* ^O */0129001291 /* Window size. This information is stored in the TTY driver but not used.01292 * This can be used for screen based applications in a window environment. 01293 * The ioctls TIOCGWINSZ and TIOCSWINSZ can be used to get and set this 01294 * information.01295 */0129601297 struct winsize01298 {01299 unsigned short ws_row; /* rows, in characters */01300 unsigned short ws_col; /* columns, in characters */01301 unsigned short ws_xpixel; /* horizontal size, pixels */01302 unsigned short ws_ypixel; /* vertical size, pixels */01303 };01304 #endif /* _MINIX */0130501306 #endif /* _TERMIOS_H */

MINIX 2.0.0 17/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/a.out.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

01400 /* The <a.out> header file describes the format of executable files. */0140101402 #ifndef _AOUT_H01403 #define _AOUT_H0140401405 struct exec { /* a.out header */01406 unsigned char a_magic[2]; /* magic number */01407 unsigned char a_flags; /* flags, see below */01408 unsigned char a_cpu; /* cpu id */01409 unsigned char a_hdrlen; /* length of header */01410 unsigned char a_unused; /* reserved for future use */01411 unsigned short a_version; /* version stamp (not used at present) */01412 long a_text; /* size of text segement in bytes */01413 long a_data; /* size of data segment in bytes */01414 long a_bss; /* size of bss segment in bytes */01415 long a_entry; /* entry point */01416 long a_total; /* total memory allocated */01417 long a_syms; /* size of symbol table */0141801419 /* SHORT FORM ENDS HERE */01420 long a_trsize; /* text relocation size */01421 long a_drsize; /* data relocation size */01422 long a_tbase; /* text relocation base */01423 long a_dbase; /* data relocation base */01424 };0142501426 #define A_MAGIC0 (unsigned char) 0x0101427 #define A_MAGIC1 (unsigned char) 0x0301428 #define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 ||(X).a_magic[1] != A_MAGIC1)0142901430 /* CPU Id of TARGET machine (byte order coded in low order two bits) */01431 #define A_NONE 0x00 /* unknown */01432 #define A_I8086 0x04 /* intel i8086/8088 */01433 #define A_M68K 0x0B /* motorola m68000 */01434 #define A_NS16K 0x0C /* national semiconductor 16032 */01435 #define A_I80386 0x10 /* intel i80386 */01436 #define A_SPARC 0x17 /* Sun SPARC */0143701438 #define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */01439 #define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */0144001441 /* Flags. */01442 #define A_UZP 0x01 /* unmapped zero page (pages) */01443 #define A_PAL 0x02 /* page aligned executable */01444 #define A_NSYM 0x04 /* new style symbol table */01445 #define A_EXEC 0x10 /* executable */01446 #define A_SEP 0x20 /* separate I/D */01447 #define A_PURE 0x40 /* pure text */ /* not used */01448 #define A_TOVLY 0x80 /* text overlay */ /* not used */0144901450 /* Offsets of various things. */01451 #define A_MINHDR 3201452 #define A_TEXTPOS(X) ((long)(X).a_hdrlen)01453 #define A_DATAPOS(X) (A_TEXTPOS(X) + (X).a_text)01454 #define A_HASRELS(X) ((X).a_hdrlen > (unsigned char) A_MINHDR)01455 #define A_HASEXT(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 8))01456 #define A_HASLNS(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 16))01457 #define A_HASTOFF(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 24))01458 #define A_TRELPOS(X) (A_DATAPOS(X) + (X).a_data)01459 #define A_DRELPOS(X) (A_TRELPOS(X) + (X).a_trsize)01460 #define A_SYMPOS(X) (A_TRELPOS(X) + (A_HASRELS(X) ? \01461 ((X).a_trsize + (X).a_drsize) : 0))0146201463 struct reloc {01464 long r_vaddr; /* virtual address of reference */01465 unsigned short r_symndx; /* internal segnum or extern symbol num */01466 unsigned short r_type; /* relocation type */01467 };0146801469 /* r_tyep values: */01470 #define R_ABBS 001471 #define R_RELLBYTE 201472 #define R_PCRBYTE 301473 #define R_RELWORD 4

MINIX 2.0.0 18/45 Aincludes@

01474 #define R_PCRWORD 501475 #define R_RELLONG 601476 #define R_PCRLONG 701477 #define R_REL3BYTE 801478 #define R_KBRANCHE 90147901480 /* r_symndx for internal segments */01481 #define S_ABS ((unsigned short)-1)01482 #define S_TEXT ((unsigned short)-2)01483 #define S_DATA ((unsigned short)-3)01484 #define S_BSS ((unsigned short)-4)0148501486 struct nlist { /* symbol table entry */01487 char n_name[8]; /* symbol name */01488 long n_value; /* value */01489 unsigned char n_sclass; /* storage class */01490 unsigned char n_numaux; /* number of auxiliary entries (not used) */01491 unsigned short n_type; /* language base and derived type (not used) */01492 };0149301494 /* Low bits of storage class (section). */01495 #define N_SECT 07 /* section mask */01496 #define N_UNDF 00 /* undefined */01497 #define N_ABS 01 /* absolute */01498 #define N_TEXT 02 /* text */01499 #define N_DATA 03 /* data */01500 #define N_BSS 04 /* bss */01501 #define N_COMM 05 /* (common) */0150201503 /* High bits of storage class. */01504 #define N_CLASS 0370 /* storage class mask */01505 #define C_NULL01506 #define C_EXT 0020 /* external symbol */01507 #define C_STAT 0030 /* static */0150801509 /* Function prototypes. */01510 #ifndef _ANSI_H01511 #include <ansi.h>01512 #endif0151301514 _PROTOTYPE( int nlist, (char *_file, struct nlist *_nl) );0151501516 #endif /* _AOUT_H */

MINIX 2.0.0 19/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/sys/types.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

01600 /* The <sys/types.h> header contains important data type definitions.01601 * It is considered good programming practice to use these definitions, 01602 * instead of the underlying base type. By convention, all type names end 01603 * with _t.01604 */0160501606 #ifndef _TYPES_H01607 #define _TYPES_H0160801609 /* _ANSI is somehow used to determine whether or not the compiler is a01610 * 16 bit compiler01611 */01612 #ifndef _ANSI01613 #include <ansi.h>01614 #endif0161501616 /* The type size_t holds all results of the sizeof operator. At first glance,01617 * it seems obvious that it should be an unsigned int, but this is not always 01618 * the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit01619 * integers. When one asks for the size of a 70K struct or array, the result 01620 * requires 17 bits to express, so size_t must be a long type. The type 01621 * ssize_t is the signed version of size_t.01622 */01623 #ifndef _SIZE_T01624 #define _SIZE_T01625 typedef unsigned int size_t;01626 #endif0162701628 #ifndef _SSIZE_T01629 #define _SSIZE_T01630 typedef int ssize_t;01631 #endif0163201633 #ifndef _TIME_T01634 #define _TIME_T01635 typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */01636 #endif0163701638 #ifndef _CLOCK_T01639 #define _CLOCK_T01640 typedef long clock_t; /* unit for system accounting */01641 #endif0164201643 #ifndef _SIGSET_T01644 #define _SIGSET_T01645 typedef unsigned long sigset_t;01646 #endif0164701648 /* Types used in disk, inode, etc. data structures. */01649 typedef short dev_t; /* holds (major|minor) device pair */01650 typedef char gid_t; /* group id */01651 typedef unsigned short ino_t; /* i-node number */01652 typedef unsigned short mode_t; /* file type and permissions bits */01653 typedef char nlink_t; /* number of links to a file */01654 typedef unsigned long off_t; /* offset within a file */01655 typedef int pid_t; /* process id (must be signed) */01656 typedef short uid_t; /* user id */01657 typedef unsigned long zone_t; /* zone number */01658 typedef unsigned long block_t; /* block number */01659 typedef unsigned long bit_t; /* bit number in a bit map */01660 typedef unsigned short zone1_t; /* zone number for V1 file systems */01661 typedef unsigned short bitchunk_t; /* collection of bits in a bitmap */0166201663 typedef unsigned char u8_t; /* 8 bit type */01664 typedef unsigned short u16_t; /* 16 bit type */01665 typedef unsigned long u32_t; /* 32 bit type */0166601667 typedef char i8_t; /* 8 bit signed type */01668 typedef short i16_t; /* 16 bit signed type */01669 typedef long i32_t; /* 32 bit signed type */0167001671 /* The following types are needed because MINIX uses K&R style function01672 * definitions (for maximum portability). When a short, such as dev_t, is01673 * passed to a function with a K&R definition, the compiler automatically

MINIX 2.0.0 20/45 Aincludes@

01674 * promotes it to an int. The prototype must contain an int as the parameter,01675 * not a short, because an int is what an old-style function definition01676 * expects. Thus using dev_t in a prototype would be incorrect. It would be01677 * sufficient to just use int instead of dev_t in the prototypes, but Dev_t01678 * is clearer.01679 */01680 typedef int Dev_t;01681 typedef int Gid_t;01682 typedef int Nlink_t;01683 typedef int Uid_t;01684 typedef int U8_t;01685 typedef unsigned long U32_t;01686 typedef int I8_t;01687 typedef int I16_t;01688 typedef long I32_t;0168901690 /* ANSI C makes writing down the promotion of unsigned types very messy. When01691 * sizeof(short) == sizeof(int), there is no promotion, so the type stays01692 * unsigned. When the compiler is not ANSI, there is usually no loss of01693 * unsignedness, and there are usually no prototypes so the promoted type01694 * doesn't matter. The use of types like Ino_t is an attempt to use ints01695 * (which are not promoted) while providing information to the reader.01696 */0169701698 #ifndef _ANSI_H01699 #include <ansi.h>01700 #endif0170101702 #if _EM_WSIZE == 2 || !defined(_ANSI)01703 typedef unsigned int Ino_t;01704 typedef unsigned int Zone1_t;01705 typedef unsigned int Bitchunk_t;01706 typedef unsigned int U16_t;01707 typedef unsigned int Mode_t;0170801709 #else /* _EM_WSIZE == 4, or _EM_WSIZE undefined, or _ANSI defined */01710 typedef int Ino_t;01711 typedef int Zone1_t;01712 typedef int Bitchunk_t;01713 typedef int U16_t;01714 typedef int Mode_t;0171501716 #endif /* _EM_WSIZE == 2, etc */01717 01718 /* Signal handler type, e.g. SIG_IGN */01719 #if defined(_ANSI)01720 typedef void (*sighandler_t) (int);01721 #else01722 typedef void (*sighandler_t)();01723 #endif0172401725 #endif /* _TYPES_H */

MINIX 2.0.0 21/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/sys/ioctl.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

01800 /* The ioctl.h header declares device controlling operations. */0180101802 #ifndef _IOCTL_H01803 #define _IOCTL_H0180401805 #if _EM_WSIZE >= 401806 /* Ioctls have the command encoded in the low-order word, and the size01807 * of the parameter in the high-order word. The 3 high bits of the high-01808 * order word are used to encode the in/out/void status of the parameter.01809 */0181001811 #define _IOCPARM_MASK 0x1FFF01812 #define _IOC_VOID 0x2000000001813 #define _IOCTYPE_MASK 0xFFFF01814 #define _IOC_IN 0x4000000001815 #define _IOC_OUT 0x8000000001816 #define _IOC_INOUT (_IOC_IN | _IOC_OUT)0181701818 #define _IO(x,y) ((x << 8) | y | _IOC_VOID)01819 #define _IOR(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\01820 _IOC_OUT)01821 #define _IOW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\01822 _IOC_IN)01823 #define _IORW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\01824 _IOC_INOUT)01825 #else01826 /* No fancy encoding on a 16-bit machine. */0182701828 #define _IO(x,y) ((x << 8) | y)01829 #define _IOR(x,y,t) _IO(x,y)01830 #define _IOW(x,y,t) _IO(x,y)01831 #define _IORW(x,y,t) _IO(x,y)01832 #endif018330183401835 /* Terminal ioctls. */01836 #define TCGETS _IOR('T', 8, struct termios) /* tcgetattr */01837 #define TCSETS _IOW('T', 9, struct termios) /* tcsetattr, TCSANOW */01838 #define TCSETSW _IOW('T', 10, struct termios) /* tcsetattr, TCSADRAIN*/01839 #define TCSETSF _IOW('T', 11, struct termios) /* tcsetattr, TCSAFLUSH*/01840 #define TCSBRK _IOW('T', 12, int) /* tcsendbreak */01841 #define TCDRAIN _IO ('T', 13) /* tcdrain */01842 #define TCFLOW _IOW('T', 14, int) /* tcflow */01843 #define TCFLSH _IOW('T', 15, int) /* tcflush */01844 #define TIOCGWINSZ _IOR('T', 16, struct winsize)01845 #define TIOCSWINSZ _IOW('T', 17, struct winsize)01846 #define TIOCGPGRP _IOW('T', 18, int)01847 #define TIOCSPGRP _IOW('T', 19, int)01848 #define TIOCSFON _IOW('T', 20, u8_t [8192])0184901850 #define TIOCGETP _IOR('t', 1, struct sgttyb)01851 #define TIOCSETP _IOW('t', 2, struct sgttyb)01852 #define TIOCGETC _IOR('t', 3, struct tchars)01853 #define TIOCSETC _IOW('t', 4, struct tchars)018540185501856 /* Network ioctls. */01857 #define NWIOSETHOPT _IOW('n', 16, struct nwio_ethopt)01858 #define NWIOGETHOPT _IOR('n', 17, struct nwio_ethopt)01859 #define NWIOGETHSTAT _IOR('n', 18, struct nwio_ethstat)0186001861 #define NWIOSIPCONF _IOW('n', 32, struct nwio_ipconf)01862 #define NWIOGIPCONF _IOR('n', 33, struct nwio_ipconf)01863 #define NWIOSIPOPT _IOW('n', 34, struct nwio_ipopt)01864 #define NWIOGIPOPT _IOR('n', 35, struct nwio_ipopt)0186501866 #define NWIOIPGROUTE _IORW('n', 40, struct nwio_route)01867 #define NWIOIPSROUTE _IOW ('n', 41, struct nwio_route)01868 #define NWIOIPDROUTE _IOW ('n', 42, struct nwio_route)0186901870 #define NWIOSTCPCONF _IOW('n', 48, struct nwio_tcpconf)01871 #define NWIOGTCPCONF _IOR('n', 49, struct nwio_tcpconf)

MINIX 2.0.0 22/45 Aincludes@

01872 #define NWIOTCPCONN _IOW('n', 50, struct nwio_tcpcl)01873 #define NWIOTCPLISTEN _IOW('n', 51, struct nwio_tcpcl)01874 #define NWIOTCPATTACH _IOW('n', 52, struct nwio_tcpatt)01875 #define NWIOTCPSHUTDOWN _IO ('n', 53)01876 #define NWIOSTCPOPT _IOW('n', 54, struct nwio_tcpopt)01877 #define NWIOGTCPOPT _IOR('n', 55, struct nwio_tcpopt)0187801879 #define NWIOSUDPOPT _IOW('n', 64, struct nwio_udpopt)01880 #define NWIOGUDPOPT _IOR('n', 65, struct nwio_udpopt)0188101882 /* Disk ioctls. */01883 #define DIOCEJECT _IO ('d', 5)01884 #define DIOCSETP _IOW('d', 6, struct partition)01885 #define DIOCGETP _IOR('d', 7, struct partition)0188601887 /* Keyboard ioctls. */01888 #define KIOCSMAP _IOW('k', 3, keymap_t)0188901890 /* Memory ioctls. */01891 #define MIOCRAMSIZE _IOW('m', 3, u32_t) /* Size of the ramdisk */01892 #define MIOCSPSINFO _IOW('m', 4, void *)01893 #define MIOCGPSINFO _IOR('m', 5, struct psinfo)0189401895 /* Magnetic tape ioctls. */01896 #define MTIOCTOP _IOW('M', 1, struct mtop)01897 #define MTIOCGET _IOR('M', 2, struct mtget)0189801899 /* SCSI command. */01900 #define SCIOCCMD _IOW('S', 1, struct scsicmd)0190101902 /* CD-ROM ioctls. */01903 #define CDIOPLAYTI _IOR('c', 1, struct cd_play_track)01904 #define CDIOPLAYMSS _IOR('c', 2, struct cd_play_mss)01905 #define CDIOREADTOCHDR _IOW('c', 3, struct cd_toc_entry)01906 #define CDIOREADTOC _IOW('c', 4, struct cd_toc_entry)01907 #define CDIOREADSUBCH _IOW('c', 5, struct cd_toc_entry)01908 #define CDIOSTOP _IO ('c', 10)01909 #define CDIOPAUSE _IO ('c', 11)01910 #define CDIORESUME _IO ('c', 12)01911 #define CDIOEJECT DIOCEJECT0191201913 /* Soundcard DSP ioctls. */01914 #define DSPIORATE _IOR('s', 1, unsigned int)01915 #define DSPIOSTEREO _IOR('s', 2, unsigned int)01916 #define DSPIOSIZE _IOR('s', 3, unsigned int)01917 #define DSPIOBITS _IOR('s', 4, unsigned int)01918 #define DSPIOSIGN _IOR('s', 5, unsigned int)01919 #define DSPIOMAX _IOW('s', 6, unsigned int)01920 #define DSPIORESET _IO ('s', 7)0192101922 /* Soundcard mixer ioctls. */01923 #define MIXIOGETVOLUME _IORW('s', 10, struct volume_level)01924 #define MIXIOGETINPUTLEFT _IORW('s', 11, struct inout_ctrl)01925 #define MIXIOGETINPUTRIGHT _IORW('s', 12, struct inout_ctrl)01926 #define MIXIOGETOUTPUT _IORW('s', 13, struct inout_ctrl)01927 #define MIXIOSETVOLUME _IORW('s', 20, struct volume_level)01928 #define MIXIOSETINPUTLEFT _IORW('s', 21, struct inout_ctrl)01929 #define MIXIOSETINPUTRIGHT _IORW('s', 22, struct inout_ctrl)01930 #define MIXIOSETOUTPUT _IORW('s', 23, struct inout_ctrl)0193101932 #ifndef _ANSI01933 #include <ansi.h>01934 #endif0193501936 _PROTOTYPE( int ioctl, (int _fd, int _request, void *_data) );0193701938 #endif /* _IOCTL_H */

MINIX 2.0.0 23/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/sys/sigcontext.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

02000 #ifndef _SIGCONTEXT_H02001 #define _SIGCONTEXT_H0200202003 /* The sigcontext structure is used by the sigreturn(2) system call.02004 * sigreturn() is seldom called by user programs, but it is used internally02005 * by the signal catching mechanism.02006 */0200702008 #ifndef _ANSI_H02009 #include <ansi.h>02010 #endif0201102012 #ifndef _CONFIG_H02013 #include <minix/config.h>02014 #endif0201502016 #if !defined(CHIP)02017 #include "error, configuration is not known"02018 #endif0201902020 /* The following structure should match the stackframe_s structure used02021 * by the kernel's context switching code. Floating point registers should02022 * be added in a different struct.02023 */02024 #if (CHIP == INTEL)02025 struct sigregs { 02026 #if _WORD_SIZE == 402027 short sr_gs;02028 short sr_fs;02029 #endif /* _WORD_SIZE == 4 */02030 short sr_es;02031 short sr_ds;02032 int sr_di;02033 int sr_si;02034 int sr_bp;02035 int sr_st; /* stack top -- used in kernel */02036 int sr_bx;02037 int sr_dx;02038 int sr_cx;02039 int sr_retreg;02040 int sr_retadr; /* return address to caller of save -- used02041 * in kernel */02042 int sr_pc;02043 int sr_cs;02044 int sr_psw;02045 int sr_sp;02046 int sr_ss;02047 };0204802049 struct sigframe { /* stack frame created for signalled process */02050 _PROTOTYPE( void (*sf_retadr), (void) );02051 int sf_signo;02052 int sf_code;02053 struct sigcontext *sf_scp;02054 int sf_fp;02055 _PROTOTYPE( void (*sf_retadr2), (void) );02056 struct sigcontext *sf_scpcopy;02057 };0205802059 #else02060 #if (CHIP == M68000)02061 struct sigregs { 02062 long sr_retreg; /* d0 */02063 long sr_d1;02064 long sr_d2;02065 long sr_d3;02066 long sr_d4;02067 long sr_d5;02068 long sr_d6;02069 long sr_d7;02070 long sr_a0;02071 long sr_a1;02072 long sr_a2;02073 long sr_a3;

MINIX 2.0.0 24/45 Aincludes@

02074 long sr_a4;02075 long sr_a5;02076 long sr_a6;02077 long sr_sp; /* also known as a7 */02078 long sr_pc;02079 short sr_psw;02080 short sr_dummy; /* make size multiple of 4 for system.c */02081 };02082 #else02083 #include "error, CHIP is not supported"02084 #endif02085 #endif /* CHIP == INTEL */0208602087 struct sigcontext {02088 int sc_flags; /* sigstack state to restore */02089 long sc_mask; /* signal mask to restore */02090 struct sigregs sc_regs; /* register set to restore */02091 };0209202093 #if (CHIP == INTEL)02094 #if _WORD_SIZE == 402095 #define sc_gs sc_regs.sr_gs02096 #define sc_fs sc_regs.sr_fs02097 #endif /* _WORD_SIZE == 4 */02098 #define sc_es sc_regs.sr_es02099 #define sc_ds sc_regs.sr_ds02100 #define sc_di sc_regs.sr_di02101 #define sc_si sc_regs.sr_si 02102 #define sc_fp sc_regs.sr_bp02103 #define sc_st sc_regs.sr_st /* stack top -- used in kernel */02104 #define sc_bx sc_regs.sr_bx02105 #define sc_dx sc_regs.sr_dx02106 #define sc_cx sc_regs.sr_cx02107 #define sc_retreg sc_regs.sr_retreg02108 #define sc_retadr sc_regs.sr_retadr /* return address to caller of 02109 save -- used in kernel */02110 #define sc_pc sc_regs.sr_pc02111 #define sc_cs sc_regs.sr_cs02112 #define sc_psw sc_regs.sr_psw02113 #define sc_sp sc_regs.sr_sp02114 #define sc_ss sc_regs.sr_ss02115 #endif /* CHIP == INTEL */0211602117 #if (CHIP == M68000)02118 #define sc_retreg sc_regs.sr_retreg02119 #define sc_d1 sc_regs.sr_d102120 #define sc_d2 sc_regs.sr_d202121 #define sc_d3 sc_regs.sr_d302122 #define sc_d4 sc_regs.sr_d402123 #define sc_d5 sc_regs.sr_d502124 #define sc_d6 sc_regs.sr_d602125 #define sc_d7 sc_regs.sr_d702126 #define sc_a0 sc_regs.sr_a002127 #define sc_a1 sc_regs.sr_a102128 #define sc_a2 sc_regs.sr_a202129 #define sc_a3 sc_regs.sr_a302130 #define sc_a4 sc_regs.sr_a402131 #define sc_a5 sc_regs.sr_a502132 #define sc_fp sc_regs.sr_a602133 #define sc_sp sc_regs.sr_sp02134 #define sc_pc sc_regs.sr_pc02135 #define sc_psw sc_regs.sr_psw02136 #endif /* CHIP == M68000 */0213702138 /* Values for sc_flags. Must agree with <minix/jmp_buf.h>. */02139 #define SC_SIGCONTEXT 2 /* nonzero when signal context is included */02140 #define SC_NOREGLOCALS 4 /* nonzero when registers are not to be02141 saved and restored */0214202143 _PROTOTYPE( int sigreturn, (struct sigcontext *_scp) );0214402145 #endif /* _SIGCONTEXT_H */

MINIX 2.0.0 25/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/sys/ptrace.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

02200 /* <sys/ptrace.h>02201 * definitions for ptrace(2) 02202 */0220302204 #ifndef _PTRACE_H02205 #define _PTRACE_H0220602207 #define T_STOP -1 /* stop the process */02208 #define T_OK 0 /* enable tracing by parent for this process */02209 #define T_GETINS 1 /* return value from instruction space */02210 #define T_GETDATA 2 /* return value from data space */02211 #define T_GETUSER 3 /* return value from user process table */02212 #define T_SETINS 4 /* set value from instruction space */02213 #define T_SETDATA 5 /* set value from data space */02214 #define T_SETUSER 6 /* set value in user process table */02215 #define T_RESUME 7 /* resume execution */02216 #define T_EXIT 8 /* exit */02217 #define T_STEP 9 /* set trace bit */0221802219 /* Function Prototypes. */02220 #ifndef _ANSI_H02221 #include <ansi.h>02222 #endif0222302224 _PROTOTYPE( long ptrace, (int _req, pid_t _pid, long _addr, long _data) );0222502226 #endif /* _PTRACE_H */

MINIX 2.0.0 26/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/sys/stat.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

02300 /* The <sys/stat.h> header defines a struct that is used in the stat() and02301 * fstat functions. The information in this struct comes from the i-node of02302 * some file. These calls are the only approved way to inspect i-nodes.02303 */0230402305 #ifndef _STAT_H02306 #define _STAT_H0230702308 struct stat {02309 dev_t st_dev; /* major/minor device number */02310 ino_t st_ino; /* i-node number */02311 mode_t st_mode; /* file mode, protection bits, etc. */02312 short int st_nlink; /* # links; TEMPORARY HACK: should be nlink_t*/02313 uid_t st_uid; /* uid of the file's owner */02314 short int st_gid; /* gid; TEMPORARY HACK: should be gid_t */02315 dev_t st_rdev;02316 off_t st_size; /* file size */02317 time_t st_atime; /* time of last access */02318 time_t st_mtime; /* time of last data modification */02319 time_t st_ctime; /* time of last file status change */02320 };0232102322 /* Traditional mask definitions for st_mode. */02323 /* The ugly casts on only some of the definitions are to avoid suprising sign02324 * extensions such as S_IFREG != (mode_t) S_IFREG when ints are 32 bits.02325 */02326 #define S_IFMT ((mode_t) 0170000) /* type of file */02327 #define S_IFREG ((mode_t) 0100000) /* regular */02328 #define S_IFBLK 0060000 /* block special */02329 #define S_IFDIR 0040000 /* directory */02330 #define S_IFCHR 0020000 /* character special */02331 #define S_IFIFO 0010000 /* this is a FIFO */02332 #define S_ISUID 0004000 /* set user id on execution */02333 #define S_ISGID 0002000 /* set group id on execution */02334 /* next is reserved for future use */02335 #define S_ISVTX 01000 /* save swapped text even after use */0233602337 /* POSIX masks for st_mode. */02338 #define S_IRWXU 00700 /* owner: rwx------ */02339 #define S_IRUSR 00400 /* owner: r-------- */02340 #define S_IWUSR 00200 /* owner: -w------- */02341 #define S_IXUSR 00100 /* owner: --x------ */0234202343 #define S_IRWXG 00070 /* group: ---rwx--- */02344 #define S_IRGRP 00040 /* group: ---r----- */02345 #define S_IWGRP 00020 /* group: ----w---- */02346 #define S_IXGRP 00010 /* group: -----x--- */0234702348 #define S_IRWXO 00007 /* others: ------rwx */02349 #define S_IROTH 00004 /* others: ------r-- */ 02350 #define S_IWOTH 00002 /* others: -------w- */02351 #define S_IXOTH 00001 /* others: --------x */0235202353 /* The following macros test st_mode (from POSIX Sec. 5.6.1.1). */02354 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* is a reg file */02355 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* is a directory */02356 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* is a char spec */02357 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* is a block spec */02358 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* is a pipe/FIFO */023590236002361 /* Function Prototypes. */02362 #ifndef _ANSI_H02363 #include <ansi.h>02364 #endif0236502366 _PROTOTYPE( int chmod, (const char *_path, Mode_t _mode) );02367 _PROTOTYPE( int fstat, (int _fildes, struct stat *_buf) );02368 _PROTOTYPE( int mkdir, (const char *_path, Mode_t _mode) );02369 _PROTOTYPE( int mkfifo, (const char *_path, Mode_t _mode) );02370 _PROTOTYPE( int stat, (const char *_path, struct stat *_buf) );02371 _PROTOTYPE( mode_t umask, (Mode_t _cmask) );0237202373 #endif /* _STAT_H */

MINIX 2.0.0 27/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/sys/dir.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

02400 /* The <dir.h> header gives the layout of a directory. */0240102402 #ifndef _DIR_H02403 #define _DIR_H0240402405 #define DIRBLKSIZ 512 /* size of directory block */0240602407 #ifndef DIRSIZ02408 #define DIRSIZ 1402409 #endif0241002411 struct direct {02412 ino_t d_ino;02413 char d_name[DIRSIZ];02414 };0241502416 #endif /* _DIR_H */

MINIX 2.0.0 28/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/sys/wait.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

02500 /* The <sys/wait.h> header contains macros related to wait(). The value02501 * returned by wait() and waitpid() depends on whether the process 02502 * terminated by an exit() call, was killed by a signal, or was stopped02503 * due to job control, as follows:02504 *02505 * High byte Low byte02506 * +---------------------+02507 * exit(status) | status | 0 |02508 * +---------------------+02509 * killed by signal | 0 | signal |02510 * +---------------------+02511 * stopped (job control) | signal | 0177 |02512 * +---------------------+02513 */0251402515 #ifndef _WAIT_H02516 #define _WAIT_H0251702518 #define _LOW(v) ( (v) & 0377)02519 #define _HIGH(v) ( ((v) >> 8) & 0377)0252002521 #define WNOHANG 1 /* do not wait for child to exit */02522 #define WUNTRACED 2 /* for job control; not implemented */0252302524 #define WIFEXITED(s) (_LOW(s) == 0) /* normal exit */02525 #define WEXITSTATUS(s) (_HIGH(s)) /* exit status */02526 #define WTERMSIG(s) (_LOW(s) & 0177) /* sig value */02527 #define WIFSIGNALED(s) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF) /* signaled */02528 #define WIFSTOPPED(s) (_LOW(s) == 0177) /* stopped */02529 #define WSTOPSIG(s) (_HIGH(s) & 0377) /* stop signal */0253002531 /* Function Prototypes. */02532 #ifndef _ANSI_H02533 #include <ansi.h>02534 #endif0253502536 _PROTOTYPE( pid_t wait, (int *_stat_loc) );02537 _PROTOTYPE( pid_t waitpid, (pid_t _pid, int *_stat_loc, int _options) );0253802539 #endif /* _WAIT_H */

MINIX 2.0.0 29/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/minix/config.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

02600 #ifndef _CONFIG_H02601 #define _CONFIG_H0260202603 /* Minix release and version numbers. */02604 #define OS_RELEASE "2.0"02605 #define OS_VERSION "0"0260602607 /* This file sets configuration parameters for the MINIX kernel, FS, and MM.02608 * It is divided up into two main sections. The first section contains02609 * user-settable parameters. In the second section, various internal system02610 * parameters are set based on the user-settable parameters.02611 */0261202613 /*===========================================================================*02614 * This section contains user-settable parameters *02615 *===========================================================================*/02616 #define MACHINE IBM_PC /* Must be one of the names listed below */0261702618 #define IBM_PC 1 /* any 8088 or 80x86-based system */02619 #define SUN_4 40 /* any Sun SPARC-based system */02620 #define SUN_4_60 40 /* Sun-4/60 (aka SparcStation 1 or Campus) */02621 #define ATARI 60 /* ATARI ST/STe/TT (68000/68030) */02622 #define AMIGA 61 /* Commodore Amiga (68000) */02623 #define MACINTOSH 62 /* Apple Macintosh (68000) */0262402625 /* Word size in bytes (a constant equal to sizeof(int)). */02626 #if __ACK__02627 #define _WORD_SIZE _EM_WSIZE02628 #endif026290263002631 /* If ROBUST is set to 1, writes of i-node, directory, and indirect blocks02632 * from the cache happen as soon as the blocks are modified. This gives a more02633 * robust, but slower, file system. If it is set to 0, these blocks are not02634 * given any special treatment, which may cause problems if the system crashes.02635 */02636 #define ROBUST 0 /* 0 for speed, 1 for robustness */0263702638 /* Number of slots in the process table for user processes. */02639 #define NR_PROCS 320264002641 /* The buffer cache should be made as large as you can afford. */02642 #if (MACHINE == IBM_PC && _WORD_SIZE == 2)02643 #define NR_BUFS 40 /* # blocks in the buffer cache */02644 #define NR_BUF_HASH 64 /* size of buf hash table; MUST BE POWER OF 2*/02645 #endif0264602647 #if (MACHINE == IBM_PC && _WORD_SIZE == 4)02648 #define NR_BUFS 512 /* # blocks in the buffer cache */02649 #define NR_BUF_HASH 1024 /* size of buf hash table; MUST BE POWER OF 2*/02650 #endif0265102652 #if (MACHINE == SUN_4_60)02653 #define NR_BUFS 512 /* # blocks in the buffer cache (<=1536) */02654 #define NR_BUF_HASH 512 /* size of buf hash table; MUST BE POWER OF 2*/02655 #endif0265602657 #if (MACHINE == ATARI)02658 #define NR_BUFS 1536 /* # blocks in the buffer cache (<=1536) */02659 #define NR_BUF_HASH 2048 /* size of buf hash table; MUST BE POWER OF 2*/02660 #endif0266102662 /* Defines for kernel configuration. */02663 #define AUTO_BIOS 0 /* xt_wini.c - use Western's autoconfig BIOS */02664 #define LINEWRAP 1 /* console.c - wrap lines at column 80 */02665 #define ALLOW_GAP_MESSAGES 1 /* proc.c - allow messages in the gap between02666 * the end of bss and lowest stack address */0266702668 /* Enable or disable the second level file system cache on the RAM disk. */02669 #define ENABLE_CACHE2 00267002671 /* Include or exclude device drivers. Set to 1 to include, 0 to exclude. */02672 #define ENABLE_NETWORKING 0 /* enable TCP/IP code */02673 #define ENABLE_AT_WINI 1 /* enable AT winchester driver */

MINIX 2.0.0 30/45 Aincludes@

02674 #define ENABLE_BIOS_WINI 0 /* enable BIOS winchester driver */02675 #define ENABLE_ESDI_WINI 0 /* enable ESDI winchester driver */02676 #define ENABLE_XT_WINI 0 /* enable XT winchester driver */02677 #define ENABLE_ADAPTEC_SCSI 0 /* enable ADAPTEC SCSI driver */02678 #define ENABLE_MITSUMI_CDROM 0 /* enable Mitsumi CD-ROM driver */02679 #define ENABLE_SB_AUDIO 0 /* enable Soundblaster audio driver */0268002681 /* DMA_SECTORS may be increased to speed up DMA based drivers. */02682 #define DMA_SECTORS 1 /* DMA buffer size (must be >= 1) */0268302684 /* Include or exclude backwards compatibility code. */02685 #define ENABLE_BINCOMPAT 0 /* for binaries using obsolete calls */02686 #define ENABLE_SRCCOMPAT 0 /* for sources using obsolete calls */0268702688 /* Determine which device to use for pipes. */02689 #define PIPE_DEV ROOT_DEV /* put pipes on root device */0269002691 /* NR_CONS, NR_RS_LINES, and NR_PTYS determine the number of terminals the02692 * system can handle.02693 */02694 #define NR_CONS 2 /* # system consoles (1 to 8) */02695 #define NR_RS_LINES 0 /* # rs232 terminals (0, 1, or 2) */02696 #define NR_PTYS 0 /* # pseudo terminals (0 to 64) */0269702698 #if (MACHINE == ATARI)02699 /* The next define says if you have an ATARI ST or TT */02700 #define ATARI_TYPE TT02701 #define ST 1 /* all ST's and Mega ST's */02702 #define STE 2 /* all STe and Mega STe's */02703 #define TT 30270402705 /* if SCREEN is set to 1 graphical screen operations are possible */02706 #define SCREEN 1 0270702708 /* This define says whether the keyboard generates VT100 or IBM_PC escapes. */02709 #define KEYBOARD VT100 /* either VT100 or IBM_PC */02710 #define VT100 1000271102712 /* The next define determines the kind of partitioning. */02713 #define PARTITIONING SUPRA /* one of the following or ATARI */02714 #define SUPRA 1 /*ICD, SUPRA and BMS are all the same */02715 #define BMS 102716 #define ICD 102717 #define CBHD 202718 #define EICKMANN 30271902720 /* Define the number of hard disk drives on your system. */02721 #define NR_ACSI_DRIVES 3 /* typically 0 or 1 */02722 #define NR_SCSI_DRIVES 1 /* typically 0 (ST, STe) or 1 (TT) */0272302724 /* Some systems need to have a little delay after each winchester02725 * commands. These systems need FAST_DISK set to 0. Other disks do not02726 * need this delay, and thus can have FAST_DISK set to 1 to avoid this delay.02727 */02728 #define FAST_DISK 1 /* 0 or 1 */0272902730 /* Note: if you want to make your kernel smaller, you can set NR_FD_DRIVES02731 * to 0. You will still be able to boot minix.img from floppy. However, you02732 * MUST fetch both the root and usr filesystem from a hard disk02733 */0273402735 /* Define the number of floppy disk drives on your system. */02736 #define NR_FD_DRIVES 1 /* 0, 1, 2 */0273702738 /* This configuration define controls parallel printer code. */02739 #define PAR_PRINTER 1 /* disable (0) / enable (1) parallel printer */0274002741 /* This configuration define controls disk controller clock code. */02742 #define HD_CLOCK 1 /* disable (0) / enable (1) hard disk clock */0274302744 #endif027450274602747 /*===========================================================================*02748 * There are no user-settable parameters after this line *02749 *===========================================================================*/02750 /* Set the CHIP type based on the machine selected. The symbol CHIP is actually02751 * indicative of more than just the CPU. For example, machines for which

MINIX 2.0.0 31/45 Aincludes@

02752 * CHIP == INTEL are expected to have 8259A interrrupt controllers and the02753 * other properties of IBM PC/XT/AT/386 types machines in general. */02754 #define INTEL 1 /* CHIP type for PC, XT, AT, 386 and clones */02755 #define M68000 2 /* CHIP type for Atari, Amiga, Macintosh */02756 #define SPARC 3 /* CHIP type for SUN-4 (e.g. SPARCstation) */0275702758 /* Set the FP_FORMAT type based on the machine selected, either hw or sw */02759 #define FP_NONE 0 /* no floating point support */02760 #define FP_IEEE 1 /* conform IEEE floating point standard */0276102762 #if (MACHINE == IBM_PC)02763 #define CHIP INTEL02764 #define SHADOWING 002765 #define ENABLE_WINI (ENABLE_AT_WINI || ENABLE_BIOS_WINI || \02766 ENABLE_ESDI_WINI || ENABLE_XT_WINI)02767 #define ENABLE_SCSI (ENABLE_ADAPTEC_SCSI)02768 #define ENABLE_CDROM (ENABLE_MITSUMI_CDROM)02769 #define ENABLE_AUDIO (ENABLE_SB_AUDIO)02770 #endif0277102772 #if (MACHINE == ATARI) || (MACHINE == AMIGA) || (MACHINE == MACINTOSH)02773 #define CHIP M6800002774 #define SHADOWING 102775 #endif0277602777 #if (MACHINE == SUN_4) || (MACHINE == SUN_4_60)02778 #define CHIP SPARC02779 #define FP_FORMAT FP_IEEE02780 #define SHADOWING 002781 #endif0278202783 #if (MACHINE == ATARI) || (MACHINE == SUN_4)02784 #define ASKDEV 1 /* ask for boot device */02785 #define FASTLOAD 1 /* use multiple block transfers to init ram */02786 #endif0278702788 #if (ATARI_TYPE == TT) /* and all other 68030's */02789 #define FPP02790 #undef SHADOWING02791 #define SHADOWING 002792 #endif0279302794 #ifndef FP_FORMAT02795 #define FP_FORMAT FP_NONE02796 #endif0279702798 /* The file buf.h uses MAYBE_WRITE_IMMED. */02799 #if ROBUST02800 #define MAYBE_WRITE_IMMED WRITE_IMMED /* slower but perhaps safer */02801 #else02802 #define MAYBE_WRITE_IMMED 0 /* faster */02803 #endif0280402805 #ifndef MACHINE02806 error "In <minix/config.h> please define MACHINE"02807 #endif0280802809 #ifndef CHIP02810 error "In <minix/config.h> please define MACHINE to have a legal value"02811 #endif0281202813 #if (MACHINE == 0)02814 error "MACHINE has incorrect value (0)"02815 #endif0281602817 #endif /* _CONFIG_H */

MINIX 2.0.0 32/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/minix/const.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

02900 /* Copyright (C) 1997 by Prentice-Hall, Inc. Permission is hereby granted02901 * to redistribute the binary and source programs of this system for02902 * educational or research purposes. For other use, written permission from02903 * Prentice-Hall is required. 02904 */0290502906 #define EXTERN extern /* used in *.h files */02907 #define PRIVATE static /* PRIVATE x limits the scope of x */02908 #define PUBLIC /* PUBLIC is the opposite of PRIVATE */02909 #define FORWARD static /* some compilers require this to be 'static'*/0291002911 #define TRUE 1 /* used for turning integers into Booleans */02912 #define FALSE 0 /* used for turning integers into Booleans */0291302914 #define HZ 60 /* clock freq (software settable on IBM-PC) */02915 #define BLOCK_SIZE 1024 /* # bytes in a disk block */02916 #define SUPER_USER (uid_t) 0 /* uid_t of superuser */0291702918 #define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */02919 #define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */0292002921 #define NULL ((void *)0) /* null pointer */02922 #define CPVEC_NR 16 /* max # of entries in a SYS_VCOPY request */02923 #define NR_IOREQS MIN(NR_BUFS, 64)02924 /* maximum number of entries in an iorequest */0292502926 #define NR_SEGS 3 /* # segments per process */02927 #define T 0 /* proc[i].mem_map[T] is for text */02928 #define D 1 /* proc[i].mem_map[D] is for data */02929 #define S 2 /* proc[i].mem_map[S] is for stack */0293002931 /* Process numbers of some important processes. */02932 #define MM_PROC_NR 0 /* process number of memory manager */02933 #define FS_PROC_NR 1 /* process number of file system */02934 #define INET_PROC_NR 2 /* process number of the TCP/IP server */02935 #define INIT_PROC_NR (INET_PROC_NR + ENABLE_NETWORKING)02936 /* init -- the process that goes multiuser */02937 #define LOW_USER (INET_PROC_NR + ENABLE_NETWORKING)02938 /* first user not part of operating system */0293902940 /* Miscellaneous */02941 #define BYTE 0377 /* mask for 8 bits */02942 #define READING 0 /* copy data to user */02943 #define WRITING 1 /* copy data from user */02944 #define NO_NUM 0x8000 /* used as numerical argument to panic() */02945 #define NIL_PTR (char *) 0 /* generally useful expression */02946 #define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */0294702948 /* Macros. */02949 #define MAX(a, b) ((a) > (b) ? (a) : (b))02950 #define MIN(a, b) ((a) < (b) ? (a) : (b))0295102952 /* Number of tasks. */02953 #define NR_TASKS (9 + ENABLE_WINI + ENABLE_SCSI + ENABLE_CDROM \02954 + ENABLE_NETWORKING + 2 * ENABLE_AUDIO)0295502956 /* Memory is allocated in clicks. */02957 #if (CHIP == INTEL)02958 #define CLICK_SIZE 256 /* unit in which memory is allocated */02959 #define CLICK_SHIFT 8 /* log2 of CLICK_SIZE */02960 #endif0296102962 #if (CHIP == SPARC) || (CHIP == M68000)02963 #define CLICK_SIZE 4096 /* unit in which memory is alocated */02964 #define CLICK_SHIFT 12 /* 2log of CLICK_SIZE */02965 #endif0296602967 #define click_to_round_k(n) \02968 ((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))02969 #if CLICK_SIZE < 102402970 #define k_to_click(n) ((n) * (1024 / CLICK_SIZE))02971 #else02972 #define k_to_click(n) ((n) / (CLICK_SIZE / 1024))02973 #endif

MINIX 2.0.0 33/45 Aincludes@

0297402975 #define ABS -999 /* this process means absolute memory */0297602977 /* Flag bits for i_mode in the inode. */02978 #define I_TYPE 0170000 /* this field gives inode type */02979 #define I_REGULAR 0100000 /* regular file, not dir or special */02980 #define I_BLOCK_SPECIAL 0060000 /* block special file */02981 #define I_DIRECTORY 0040000 /* file is a directory */02982 #define I_CHAR_SPECIAL 0020000 /* character special file */02983 #define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */02984 #define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */02985 #define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */02986 #define ALL_MODES 0006777 /* all bits for user, group and others */02987 #define RWX_MODES 0000777 /* mode bits for RWX only */02988 #define R_BIT 0000004 /* Rwx protection bit */02989 #define W_BIT 0000002 /* rWx protection bit */02990 #define X_BIT 0000001 /* rwX protection bit */02991 #define I_NOT_ALLOC 0000000 /* this inode is free */0299202993 /* Some limits. */02994 #define MAX_BLOCK_NR ((block_t) 077777777) /* largest block number */02995 #define HIGHEST_ZONE ((zone_t) 077777777) /* largest zone number */02996 #define MAX_INODE_NR ((ino_t) 0177777) /* largest inode number */02997 #define MAX_FILE_POS ((off_t) 037777777777) /* largest legal file offset */0299802999 #define NO_BLOCK ((block_t) 0) /* absence of a block number */03000 #define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */03001 #define NO_ZONE ((zone_t) 0) /* absence of a zone number */03002 #define NO_DEV ((dev_t) 0) /* absence of a device numb */

MINIX 2.0.0 34/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/minix/type.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

03100 #ifndef _TYPE_H03101 #define _TYPE_H03102 #ifndef _MINIX_TYPE_H03103 #define _MINIX_TYPE_H0310403105 /* Type definitions. */03106 typedef unsigned int vir_clicks; /* virtual addresses and lengths in clicks */03107 typedef unsigned long phys_bytes;/* physical addresses and lengths in bytes */03108 typedef unsigned int phys_clicks;/* physical addresses and lengths in clicks */0310903110 #if (CHIP == INTEL)03111 typedef unsigned int vir_bytes; /* virtual addresses and lengths in bytes */03112 #endif0311303114 #if (CHIP == M68000)03115 typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */03116 #endif0311703118 #if (CHIP == SPARC)03119 typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */03120 #endif0312103122 /* Types relating to messages. */03123 #define M1 103124 #define M3 303125 #define M4 403126 #define M3_STRING 140312703128 typedef struct {int m1i1, m1i2, m1i3; char *m1p1, *m1p2, *m1p3;} mess_1;03129 typedef struct {int m2i1, m2i2, m2i3; long m2l1, m2l2; char *m2p1;} mess_2;03130 typedef struct {int m3i1, m3i2; char *m3p1; char m3ca1[M3_STRING];} mess_3;03131 typedef struct {long m4l1, m4l2, m4l3, m4l4, m4l5;} mess_4;03132 typedef struct {char m5c1, m5c2; int m5i1, m5i2; long m5l1, m5l2, m5l3;}mess_5;03133 typedef struct {int m6i1, m6i2, m6i3; long m6l1; sighandler_t m6f1;} mess_6;0313403135 typedef struct {03136 int m_source; /* who sent the message */03137 int m_type; /* what kind of message is it */03138 union {03139 mess_1 m_m1;03140 mess_2 m_m2;03141 mess_3 m_m3;03142 mess_4 m_m4;03143 mess_5 m_m5;03144 mess_6 m_m6;03145 } m_u;03146 } message;0314703148 /* The following defines provide names for useful members. */03149 #define m1_i1 m_u.m_m1.m1i103150 #define m1_i2 m_u.m_m1.m1i203151 #define m1_i3 m_u.m_m1.m1i303152 #define m1_p1 m_u.m_m1.m1p103153 #define m1_p2 m_u.m_m1.m1p203154 #define m1_p3 m_u.m_m1.m1p30315503156 #define m2_i1 m_u.m_m2.m2i103157 #define m2_i2 m_u.m_m2.m2i203158 #define m2_i3 m_u.m_m2.m2i303159 #define m2_l1 m_u.m_m2.m2l103160 #define m2_l2 m_u.m_m2.m2l203161 #define m2_p1 m_u.m_m2.m2p10316203163 #define m3_i1 m_u.m_m3.m3i103164 #define m3_i2 m_u.m_m3.m3i203165 #define m3_p1 m_u.m_m3.m3p103166 #define m3_ca1 m_u.m_m3.m3ca10316703168 #define m4_l1 m_u.m_m4.m4l103169 #define m4_l2 m_u.m_m4.m4l203170 #define m4_l3 m_u.m_m4.m4l303171 #define m4_l4 m_u.m_m4.m4l403172 #define m4_l5 m_u.m_m4.m4l503173

MINIX 2.0.0 35/45 Aincludes@

03174 #define m5_c1 m_u.m_m5.m5c103175 #define m5_c2 m_u.m_m5.m5c203176 #define m5_i1 m_u.m_m5.m5i103177 #define m5_i2 m_u.m_m5.m5i203178 #define m5_l1 m_u.m_m5.m5l103179 #define m5_l2 m_u.m_m5.m5l203180 #define m5_l3 m_u.m_m5.m5l30318103182 #define m6_i1 m_u.m_m6.m6i103183 #define m6_i2 m_u.m_m6.m6i203184 #define m6_i3 m_u.m_m6.m6i303185 #define m6_l1 m_u.m_m6.m6l103186 #define m6_f1 m_u.m_m6.m6f10318703188 struct mem_map {03189 vir_clicks mem_vir; /* virtual address */03190 phys_clicks mem_phys; /* physical address */03191 vir_clicks mem_len; /* length */03192 };0319303194 struct iorequest_s {03195 long io_position; /* position in device file (really off_t) */03196 char *io_buf; /* buffer in user space */03197 int io_nbytes; /* size of request */03198 unsigned short io_request; /* read, write (optionally) */03199 };03200 #endif /* _TYPE_H */0320103202 typedef struct {03203 vir_bytes iov_addr; /* address of an I/O buffer */03204 vir_bytes iov_size; /* sizeof an I/O buffer */03205 } iovec_t;0320603207 typedef struct {03208 vir_bytes cpv_src; /* src address of data */03209 vir_bytes cpv_dst; /* dst address of data */03210 vir_bytes cpv_size; /* size of data */03211 } cpvec_t;0321203213 /* MM passes the address of a structure of this type to KERNEL when03214 * do_sendsig() is invoked as part of the signal catching mechanism.03215 * The structure contain all the information that KERNEL needs to build03216 * the signal stack.03217 */03218 struct sigmsg {03219 int sm_signo; /* signal number being caught */03220 unsigned long sm_mask; /* mask to restore when handler returns */03221 vir_bytes sm_sighandler; /* address of handler */03222 vir_bytes sm_sigreturn; /* address of _sigreturn in C library */03223 vir_bytes sm_stkptr; /* user stack pointer */03224 };0322503226 #define MESS_SIZE (sizeof(message)) /* might need usizeof from fs here */03227 #define NIL_MESS ((message *) 0)0322803229 struct psinfo { /* information for the ps(1) program */03230 u16_t nr_tasks, nr_procs; /* NR_TASKS and NR_PROCS constants. */03231 vir_bytes proc, mproc, fproc; /* addresses of the main process tables. */03232 };0323303234 #endif /* _MINIX_TYPE_H */

MINIX 2.0.0 36/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/minix/syslib.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

03300 /* Prototypes for system library functions. */0330103302 #ifndef _SYSLIB_H03303 #define _SYSLIB_H0330403305 /* Hide names to avoid name space pollution. */03306 #define sendrec _sendrec03307 #define receive _receive03308 #define send _send0330903310 /* Minix user+system library. */03311 _PROTOTYPE( void printk, (char *_fmt, ...) );03312 _PROTOTYPE( int sendrec, (int _src_dest, message *_m_ptr) );03313 _PROTOTYPE( int _taskcall, (int _who, int _syscallnr, message *_msgptr) );0331403315 /* Minix system library. */03316 _PROTOTYPE( int receive, (int _src, message *_m_ptr) );03317 _PROTOTYPE( int send, (int _dest, message *_m_ptr) );0331803319 _PROTOTYPE( int sys_abort, (int _how, ...) );03320 _PROTOTYPE( int sys_adjmap, (int _proc, struct mem_map *_ptr, 03321 vir_clicks _data_clicks, vir_clicks _sp) );03322 _PROTOTYPE( int sys_copy, (int _src_proc, int _src_seg, phys_bytes _src_vir, 03323 int _dst_proc, int _dst_seg, phys_bytes _dst_vir, phys_bytes _bytes));03324 _PROTOTYPE( int sys_exec, (int _proc, char *_ptr, int _traced, 03325 char *_aout, vir_bytes _initpc) );03326 _PROTOTYPE( int sys_execmap, (int _proc, struct mem_map *_ptr) );03327 _PROTOTYPE( int sys_fork, (int _parent, int _child, int _pid, 03328 phys_clicks _shadow) );03329 _PROTOTYPE( int sys_fresh, (int _proc, struct mem_map *_ptr,03330 phys_clicks _dc, phys_clicks *_basep, phys_clicks *_sizep) );03331 _PROTOTYPE( int sys_getsp, (int _proc, vir_bytes *_newsp) );03332 _PROTOTYPE( int sys_newmap, (int _proc, struct mem_map *_ptr) );03333 _PROTOTYPE( int sys_getmap, (int _proc, struct mem_map *_ptr) );03334 _PROTOTYPE( int sys_sendsig, (int _proc, struct sigmsg *_ptr) );03335 _PROTOTYPE( int sys_oldsig, (int _proc, int _sig, sighandler_t _sighandler));03336 _PROTOTYPE( int sys_endsig, (int _proc) );03337 _PROTOTYPE( int sys_sigreturn, (int _proc, vir_bytes _scp, int _flags) );03338 _PROTOTYPE( int sys_trace, (int _req, int _procnr, long _addr, long *_data_p));03339 _PROTOTYPE( int sys_xit, (int _parent, int _proc, phys_clicks *_basep, 03340 phys_clicks *_sizep));03341 _PROTOTYPE( int sys_kill, (int _proc, int _sig) );03342 _PROTOTYPE( int sys_times, (int _proc, clock_t _ptr[5]) );0334303344 #endif /* _SYSLIB_H */

MINIX 2.0.0 37/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/minix/callnr.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

03400 #define NCALLS 77 /* number of system calls allowed */0340103402 #define EXIT 1 03403 #define FORK 2 03404 #define READ 3 03405 #define WRITE 4 03406 #define OPEN 5 03407 #define CLOSE 6 03408 #define WAIT 703409 #define CREAT 8 03410 #define LINK 9 03411 #define UNLINK 10 03412 #define WAITPID 1103413 #define CHDIR 12 03414 #define TIME 1303415 #define MKNOD 14 03416 #define CHMOD 15 03417 #define CHOWN 16 03418 #define BRK 1703419 #define STAT 18 03420 #define LSEEK 1903421 #define GETPID 2003422 #define MOUNT 21 03423 #define UMOUNT 22 03424 #define SETUID 2303425 #define GETUID 2403426 #define STIME 2503427 #define PTRACE 2603428 #define ALARM 2703429 #define FSTAT 28 03430 #define PAUSE 2903431 #define UTIME 30 03432 #define ACCESS 33 03433 #define SYNC 36 03434 #define KILL 3703435 #define RENAME 3803436 #define MKDIR 3903437 #define RMDIR 4003438 #define DUP 41 03439 #define PIPE 42 03440 #define TIMES 4303441 #define SETGID 4603442 #define GETGID 4703443 #define SIGNAL 4803444 #define IOCTL 5403445 #define FCNTL 5503446 #define EXEC 5903447 #define UMASK 60 03448 #define CHROOT 61 03449 #define SETSID 6203450 #define GETPGRP 630345103452 /* The following are not system calls, but are processed like them. */03453 #define KSIG 64 /* kernel detected a signal */03454 #define UNPAUSE 65 /* to MM or FS: check for EINTR */03455 #define REVIVE 67 /* to FS: revive a sleeping process */03456 #define TASK_REPLY 68 /* to FS: reply code from tty task */0345703458 /* Posix signal handling. */03459 #define SIGACTION 7103460 #define SIGSUSPEND 7203461 #define SIGPENDING 7303462 #define SIGPROCMASK 7403463 #define SIGRETURN 750346403465 #define REBOOT 76

MINIX 2.0.0 38/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/minix/com.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

03500 /* System calls. */03501 #define SEND 1 /* function code for sending messages */03502 #define RECEIVE 2 /* function code for receiving messages */03503 #define BOTH 3 /* function code for SEND + RECEIVE */03504 #define ANY (NR_PROCS+100) /* receive(ANY, buf) accepts from any source */0350503506 /* Task numbers, function codes and reply codes. */0350703508 /* The values of several task numbers depend on whether they or other tasks03509 * are enabled. They are defined as (PREVIOUS_TASK - ENABLE_TASK) in general.03510 * ENABLE_TASK is either 0 or 1, so a task either gets a new number, or gets03511 * the same number as the previous task and is further unused.03512 * The TTY task must always have the most negative number so that it is03513 * initialized first. Many of the TTY function codes are shared with other03514 * tasks.03515 */0351603517 #define TTY (DL_ETH - 1)03518 /* terminal I/O class */03519 # define CANCEL 0 /* general req to force a task to cancel */03520 # define HARD_INT 2 /* fcn code for all hardware interrupts */03521 # define DEV_READ 3 /* fcn code for reading from tty */03522 # define DEV_WRITE 4 /* fcn code for writing to tty */03523 # define DEV_IOCTL 5 /* fcn code for ioctl */03524 # define DEV_OPEN 6 /* fcn code for opening tty */03525 # define DEV_CLOSE 7 /* fcn code for closing tty */03526 # define SCATTERED_IO 8 /* fcn code for multiple reads/writes */03527 # define TTY_SETPGRP 9 /* fcn code for setpgroup */03528 # define TTY_EXIT 10 /* a process group leader has exited */ 03529 # define OPTIONAL_IO 16 /* modifier to DEV_* codes within vector */03530 # define SUSPEND -998 /* used in interrupts when tty has no data */0353103532 #define DL_ETH (CDROM - ENABLE_NETWORKING)03533 /* networking task */0353403535 /* Message type for data link layer reqests. */03536 # define DL_WRITE 303537 # define DL_WRITEV 403538 # define DL_READ 503539 # define DL_READV 603540 # define DL_INIT 703541 # define DL_STOP 803542 # define DL_GETSTAT 90354303544 /* Message type for data link layer replies. */03545 # define DL_INIT_REPLY 2003546 # define DL_TASK_REPLY 210354703548 # define DL_PORT m2_i103549 # define DL_PROC m2_i203550 # define DL_COUNT m2_i303551 # define DL_MODE m2_l103552 # define DL_CLCK m2_l203553 # define DL_ADDR m2_p103554 # define DL_STAT m2_l10355503556 /* Bits in 'DL_STAT' field of DL replies. */03557 # define DL_PACK_SEND 0x0103558 # define DL_PACK_RECV 0x0203559 # define DL_READ_IP 0x040356003561 /* Bits in 'DL_MODE' field of DL requests. */03562 # define DL_NOMODE 0x003563 # define DL_PROMISC_REQ 0x203564 # define DL_MULTI_REQ 0x403565 # define DL_BROAD_REQ 0x80356603567 # define NW_OPEN DEV_OPEN03568 # define NW_CLOSE DEV_CLOSE03569 # define NW_READ DEV_READ03570 # define NW_WRITE DEV_WRITE03571 # define NW_IOCTL DEV_IOCTL03572 # define NW_CANCEL CANCEL03573

MINIX 2.0.0 39/45 Aincludes@

03574 #define CDROM (AUDIO - ENABLE_CDROM)03575 /* cd-rom device task */0357603577 #define AUDIO (MIXER - ENABLE_AUDIO)03578 #define MIXER (SCSI - ENABLE_AUDIO)03579 /* audio & mixer device tasks */0358003581 #define SCSI (WINCHESTER - ENABLE_SCSI)03582 /* scsi device task */0358303584 #define WINCHESTER (SYN_ALRM_TASK - ENABLE_WINI)03585 /* winchester (hard) disk class */0358603587 #define SYN_ALRM_TASK -8 /* task to send CLOCK_INT messages */0358803589 #define IDLE -7 /* task to run when there's nothing to run */0359003591 #define PRINTER -6 /* printer I/O class */0359203593 #define FLOPPY -5 /* floppy disk class */0359403595 #define MEM -4 /* /dev/ram, /dev/(k)mem and /dev/null class */03596 # define NULL_MAJOR 1 /* major device for /dev/null */03597 # define RAM_DEV 0 /* minor device for /dev/ram */03598 # define MEM_DEV 1 /* minor device for /dev/mem */03599 # define KMEM_DEV 2 /* minor device for /dev/kmem */03600 # define NULL_DEV 3 /* minor device for /dev/null */0360103602 #define CLOCK -3 /* clock class */03603 # define SET_ALARM 1 /* fcn code to CLOCK, set up alarm */03604 # define GET_TIME 3 /* fcn code to CLOCK, get real time */03605 # define SET_TIME 4 /* fcn code to CLOCK, set real time */03606 # define GET_UPTIME 5 /* fcn code to CLOCK, get uptime */03607 # define SET_SYNC_AL 6 /* fcn code to CLOCK, set up alarm which */03608 /* times out with a send */03609 # define REAL_TIME 1 /* reply from CLOCK: here is real time */03610 # define CLOCK_INT HARD_INT03611 /* this code will only be sent by */03612 /* SYN_ALRM_TASK to a task that requested a */03613 /* synchronous alarm */0361403615 #define SYSTASK -2 /* internal functions */03616 # define SYS_XIT 1 /* fcn code for sys_xit(parent, proc) */03617 # define SYS_GETSP 2 /* fcn code for sys_sp(proc, &new_sp) */03618 # define SYS_OLDSIG 3 /* fcn code for sys_oldsig(proc, sig) */03619 # define SYS_FORK 4 /* fcn code for sys_fork(parent, child) */03620 # define SYS_NEWMAP 5 /* fcn code for sys_newmap(procno, map_ptr) */03621 # define SYS_COPY 6 /* fcn code for sys_copy(ptr) */03622 # define SYS_EXEC 7 /* fcn code for sys_exec(procno, new_sp) */03623 # define SYS_TIMES 8 /* fcn code for sys_times(procno, bufptr) */03624 # define SYS_ABORT 9 /* fcn code for sys_abort() */03625 # define SYS_FRESH 10 /* fcn code for sys_fresh() (Atari only) */03626 # define SYS_KILL 11 /* fcn code for sys_kill(proc, sig) */03627 # define SYS_GBOOT 12 /* fcn code for sys_gboot(procno, bootptr) */03628 # define SYS_UMAP 13 /* fcn code for sys_umap(procno, etc) */03629 # define SYS_MEM 14 /* fcn code for sys_mem() */03630 # define SYS_TRACE 15 /* fcn code for sys_trace(req,pid,addr,data) */03631 # define SYS_VCOPY 16 /* fnc code for sys_vcopy(src_proc, dest_proc,03632 vcopy_s, vcopy_ptr) */03633 # define SYS_SENDSIG 17 /* fcn code for sys_sendsig(&sigmsg) */03634 # define SYS_SIGRETURN 18 /* fcn code for sys_sigreturn(&sigmsg) */03635 # define SYS_ENDSIG 19 /* fcn code for sys_endsig(procno) */03636 # define SYS_GETMAP 20 /* fcn code for sys_getmap(procno, map_ptr) */0363703638 #define HARDWARE -1 /* used as source on interrupt generated msgs*/0363903640 /* Names of message fields for messages to CLOCK task. */03641 #define DELTA_TICKS m6_l1 /* alarm interval in clock ticks */03642 #define FUNC_TO_CALL m6_f1 /* pointer to function to call */03643 #define NEW_TIME m6_l1 /* value to set clock to (SET_TIME) */03644 #define CLOCK_PROC_NR m6_i1 /* which proc (or task) wants the alarm? */03645 #define SECONDS_LEFT m6_l1 /* how many seconds were remaining */0364603647 /* Names of message fields used for messages to block and character tasks. */03648 #define DEVICE m2_i1 /* major-minor device */03649 #define PROC_NR m2_i2 /* which (proc) wants I/O? */03650 #define COUNT m2_i3 /* how many bytes to transfer */03651 #define REQUEST m2_i3 /* ioctl request code */

MINIX 2.0.0 40/45 Aincludes@

03652 #define POSITION m2_l1 /* file offset */03653 #define ADDRESS m2_p1 /* core buffer address */0365403655 /* Names of message fields for messages to TTY task. */03656 #define TTY_LINE DEVICE /* message parameter: terminal line */03657 #define TTY_REQUEST COUNT /* message parameter: ioctl request code */03658 #define TTY_SPEK POSITION /* message parameter: ioctl speed, erasing */03659 #define TTY_FLAGS m2_l2 /* message parameter: ioctl tty mode */03660 #define TTY_PGRP m2_i3 /* message parameter: process group */ 0366103662 /* Names of the message fields for QIC 02 status reply from tape driver */03663 #define TAPE_STAT0 m2_l103664 #define TAPE_STAT1 m2_l20366503666 /* Names of messages fields used in reply messages from tasks. */03667 #define REP_PROC_NR m2_i1 /* # of proc on whose behalf I/O was done */03668 #define REP_STATUS m2_i2 /* bytes transferred or error number */0366903670 /* Names of fields for copy message to SYSTASK. */03671 #define SRC_SPACE m5_c1 /* T or D space (stack is also D) */03672 #define SRC_PROC_NR m5_i1 /* process to copy from */03673 #define SRC_BUFFER m5_l1 /* virtual address where data come from */03674 #define DST_SPACE m5_c2 /* T or D space (stack is also D) */03675 #define DST_PROC_NR m5_i2 /* process to copy to */03676 #define DST_BUFFER m5_l2 /* virtual address where data go to */03677 #define COPY_BYTES m5_l3 /* number of bytes to copy */0367803679 /* Field names for accounting, SYSTASK and miscellaneous. */03680 #define USER_TIME m4_l1 /* user time consumed by process */03681 #define SYSTEM_TIME m4_l2 /* system time consumed by process */03682 #define CHILD_UTIME m4_l3 /* user time consumed by process' children */03683 #define CHILD_STIME m4_l4 /* sys time consumed by process' children */03684 #define BOOT_TICKS m4_l5 /* number of clock ticks since boot time */0368503686 #define PROC1 m1_i1 /* indicates a process */03687 #define PROC2 m1_i2 /* indicates a process */03688 #define PID m1_i3 /* process id passed from MM to kernel */03689 #define STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */03690 #define PR m6_i1 /* process number for sys_sig */03691 #define SIGNUM m6_i2 /* signal number for sys_sig */03692 #define FUNC m6_f1 /* function pointer for sys_sig */03693 #define MEM_PTR m1_p1 /* tells where memory map is for sys_newmap */03694 #define NAME_PTR m1_p2 /* tells where program name is for dmp */03695 #define IP_PTR m1_p3 /* initial value for ip after exec */03696 #define SIG_PROC m2_i1 /* process number for inform */03697 #define SIG_MAP m2_l1 /* used by kernel for passing signal bit map */03698 #define SIG_MSG_PTR m1_i1 /* pointer to info to build sig catch stack */03699 #define SIG_CTXT_PTR m1_p1 /* pointer to info to restore signal context */

MINIX 2.0.0 41/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/minix/boot.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

03700 /* boot.h */0370103702 #ifndef _BOOT_H03703 #define _BOOT_H0370403705 /* Redefine root and root image devices as variables.03706 * This keeps the diffs small but may cause future confusion.03707 */03708 #define ROOT_DEV (boot_parameters.bp_rootdev)03709 #define IMAGE_DEV (boot_parameters.bp_ramimagedev)0371003711 /* Device numbers of RAM, floppy and hard disk devices.03712 * h/com.h defines RAM_DEV but only as the minor number.03713 */03714 #define DEV_FD0 0x20003715 #define DEV_HD0 0x30003716 #define DEV_RAM 0x10003717 #define DEV_SCSI 0x700 /* Atari TT only */0371803719 /* Structure to hold boot parameters. */03720 struct bparam_s03721 {03722 dev_t bp_rootdev;03723 dev_t bp_ramimagedev;03724 unsigned short bp_ramsize;03725 unsigned short bp_processor;03726 };0372703728 extern struct bparam_s boot_parameters;03729 #endif /* _BOOT_H */

MINIX 2.0.0 42/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/minix/keymap.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

03800 /* keymap.h - defines for keymapping Author: Marcus Hampel03801 */03802 #ifndef _SYS__KEYMAP_H03803 #define _SYS__KEYMAP_H0380403805 #define C(c) ((c) & 0x1F) /* Map to control code */03806 #define A(c) ((c) | 0x80) /* Set eight bit (ALT) */03807 #define CA(c) A(C(c)) /* Control-Alt */03808 #define L(c) ((c) | HASCAPS) /* Add "Caps Lock has effect" attribute */0380903810 #define EXT 0x0100 /* Normal function keys */03811 #define CTRL 0x0200 /* Control key */03812 #define SHIFT 0x0400 /* Shift key */03813 #define ALT 0x0800 /* Alternate key */03814 #define EXTKEY 0x1000 /* extended keycode */03815 #define HASCAPS 0x8000 /* Caps Lock has effect */0381603817 /* Numeric keypad */03818 #define HOME (0x01 + EXT)03819 #define END (0x02 + EXT)03820 #define UP (0x03 + EXT)03821 #define DOWN (0x04 + EXT)03822 #define LEFT (0x05 + EXT)03823 #define RIGHT (0x06 + EXT)03824 #define PGUP (0x07 + EXT)03825 #define PGDN (0x08 + EXT)03826 #define MID (0x09 + EXT)03827 #define NMIN (0x0A + EXT)03828 #define PLUS (0x0B + EXT)03829 #define INSRT (0x0C + EXT)0383003831 /* Alt + Numeric keypad */03832 #define AHOME (0x01 + ALT)03833 #define AEND (0x02 + ALT)03834 #define AUP (0x03 + ALT)03835 #define ADOWN (0x04 + ALT)03836 #define ALEFT (0x05 + ALT)03837 #define ARIGHT (0x06 + ALT)03838 #define APGUP (0x07 + ALT)03839 #define APGDN (0x08 + ALT)03840 #define AMID (0x09 + ALT)03841 #define ANMIN (0x0A + ALT)03842 #define APLUS (0x0B + ALT)03843 #define AINSRT (0x0C + ALT)0384403845 /* Ctrl + Numeric keypad */03846 #define CHOME (0x01 + CTRL)03847 #define CEND (0x02 + CTRL)03848 #define CUP (0x03 + CTRL)03849 #define CDOWN (0x04 + CTRL)03850 #define CLEFT (0x05 + CTRL)03851 #define CRIGHT (0x06 + CTRL)03852 #define CPGUP (0x07 + CTRL)03853 #define CPGDN (0x08 + CTRL)03854 #define CMID (0x09 + CTRL)03855 #define CNMIN (0x0A + CTRL)03856 #define CPLUS (0x0B + CTRL)03857 #define CINSRT (0x0C + CTRL)0385803859 /* Lock keys */03860 #define CALOCK (0x0D + EXT) /* caps lock */03861 #define NLOCK (0x0E + EXT) /* number lock */03862 #define SLOCK (0x0F + EXT) /* scroll lock */0386303864 /* Function keys */03865 #define F1 (0x10 + EXT)03866 #define F2 (0x11 + EXT)03867 #define F3 (0x12 + EXT)03868 #define F4 (0x13 + EXT)03869 #define F5 (0x14 + EXT)03870 #define F6 (0x15 + EXT)03871 #define F7 (0x16 + EXT)03872 #define F8 (0x17 + EXT)03873 #define F9 (0x18 + EXT)

MINIX 2.0.0 43/45 Aincludes@

03874 #define F10 (0x19 + EXT)03875 #define F11 (0x1A + EXT)03876 #define F12 (0x1B + EXT)0387703878 /* Alt+Fn */03879 #define AF1 (0x10 + ALT)03880 #define AF2 (0x11 + ALT)03881 #define AF3 (0x12 + ALT)03882 #define AF4 (0x13 + ALT)03883 #define AF5 (0x14 + ALT)03884 #define AF6 (0x15 + ALT)03885 #define AF7 (0x16 + ALT)03886 #define AF8 (0x17 + ALT)03887 #define AF9 (0x18 + ALT)03888 #define AF10 (0x19 + ALT)03889 #define AF11 (0x1A + ALT)03890 #define AF12 (0x1B + ALT)0389103892 /* Ctrl+Fn */03893 #define CF1 (0x10 + CTRL)03894 #define CF2 (0x11 + CTRL)03895 #define CF3 (0x12 + CTRL)03896 #define CF4 (0x13 + CTRL)03897 #define CF5 (0x14 + CTRL)03898 #define CF6 (0x15 + CTRL)03899 #define CF7 (0x16 + CTRL)03900 #define CF8 (0x17 + CTRL)03901 #define CF9 (0x18 + CTRL)03902 #define CF10 (0x19 + CTRL)03903 #define CF11 (0x1A + CTRL)03904 #define CF12 (0x1B + CTRL)0390503906 /* Shift+Fn */03907 #define SF1 (0x10 + SHIFT)03908 #define SF2 (0x11 + SHIFT)03909 #define SF3 (0x12 + SHIFT)03910 #define SF4 (0x13 + SHIFT)03911 #define SF5 (0x14 + SHIFT)03912 #define SF6 (0x15 + SHIFT)03913 #define SF7 (0x16 + SHIFT)03914 #define SF8 (0x17 + SHIFT)03915 #define SF9 (0x18 + SHIFT)03916 #define SF10 (0x19 + SHIFT)03917 #define SF11 (0x1A + SHIFT)03918 #define SF12 (0x1B + SHIFT)0391903920 /* Alt+Shift+Fn */03921 #define ASF1 (0x10 + ALT + SHIFT)03922 #define ASF2 (0x11 + ALT + SHIFT)03923 #define ASF3 (0x12 + ALT + SHIFT)03924 #define ASF4 (0x13 + ALT + SHIFT)03925 #define ASF5 (0x14 + ALT + SHIFT)03926 #define ASF6 (0x15 + ALT + SHIFT)03927 #define ASF7 (0x16 + ALT + SHIFT)03928 #define ASF8 (0x17 + ALT + SHIFT)03929 #define ASF9 (0x18 + ALT + SHIFT)03930 #define ASF10 (0x19 + ALT + SHIFT)03931 #define ASF11 (0x1A + ALT + SHIFT)03932 #define ASF12 (0x1B + ALT + SHIFT)0393303934 #define MAP_COLS 6 /* Number of columns in keymap */03935 #define NR_SCAN_CODES 0x80 /* Number of scan codes (rows in keymap) */0393603937 typedef unsigned short keymap_t[NR_SCAN_CODES * MAP_COLS];0393803939 #define KEY_MAGIC "KMAZ" /* Magic number of keymap file */0394003941 #endif /* _SYS__KEYMAP_H */

MINIX 2.0.0 44/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/minix/partition.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

04000 /* minix/partition.h Author: Kees J. Bot04001 * 7 Dec 199504002 * Place of a partition on disk and the disk geometry,04003 * for use with the DIOCGETP and DIOCSETP ioctl's.04004 */04005 #ifndef _MINIX__PARTITION_H04006 #define _MINIX__PARTITION_H0400704008 struct partition {04009 u32_t base; /* byte offset to the partition start */04010 u32_t size; /* number of bytes in the partition */04011 unsigned cylinders; /* disk geometry */04012 unsigned heads;04013 unsigned sectors;04014 };04015 #endif /* _MINIX__PARTITION_H */

MINIX 2.0.0 45/45 Aincludes@

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++include/ibm/partition.h

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

04100 /* Description of entry in partition table. */04101 #ifndef _PARTITION_H04102 #define _PARTITION_H0410304104 struct part_entry {04105 unsigned char bootind; /* boot indicator 0/ACTIVE_FLAG */04106 unsigned char start_head; /* head value for first sector */04107 unsigned char start_sec; /* sector value + cyl bits for first sector */04108 unsigned char start_cyl; /* track value for first sector */04109 unsigned char sysind; /* system indicator */04110 unsigned char last_head; /* head value for last sector */04111 unsigned char last_sec; /* sector value + cyl bits for last sector */04112 unsigned char last_cyl; /* track value for last sector */04113 unsigned long lowsec; /* logical first sector */04114 unsigned long size; /* size of partition in sectors */04115 };0411604117 #define ACTIVE_FLAG 0x80 /* value for active in bootind field (hd0) */04118 #define NR_PARTITIONS 4 /* number of entries in partition table */04119 #define PART_TABLE_OFF 0x1BE /* offset of partition table in boot sector */0412004121 /* Partition types. */04122 #define MINIX_PART 0x81 /* Minix partition type */04123 #define NO_PART 0x00 /* unused entry */04124 #define OLD_MINIX_PART 0x80 /* created before 1.4b, obsolete */04125 #define EXT_PART 0x05 /* extended partition */0412604127 #endif /* _PARTITION_H */