add directory study

This commit is contained in:
gohigh
2024-02-19 00:25:23 -05:00
parent b1306b38b1
commit f3774e2f8c
4001 changed files with 2285787 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
/* The <a.out> header file describes the format of executable files. */
#ifndef _AOUT_H
#define _AOUT_H
struct exec { /* a.out header */
unsigned char a_magic[2]; /* magic number */
unsigned char a_flags; /* flags, see below */
unsigned char a_cpu; /* cpu id */
unsigned char a_hdrlen; /* length of header */
unsigned char a_unused; /* reserved for future use */
unsigned short a_version; /* version stamp */
/* not used */
long a_text; /* size of text segement in bytes */
long a_data; /* size of data segment in bytes */
long a_bss; /* size of bss segment in bytes */
long a_no_entry; /* in fact: entry point, a_entry */
long a_total; /* total memory allocated */
long a_syms; /* size of symbol table */
/* SHORT FORM ENDS HERE */
long a_trsize; /* text relocation size */
long a_drsize; /* data relocation size */
long a_tbase; /* text relocation base */
long a_dbase; /* data relocation base */
};
#define A_MAGIC0 (unsigned char) 0x01
#define A_MAGIC1 (unsigned char) 0x03
#define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 ||\
(X).a_magic[1] != A_MAGIC1)
/* CPU Id of TARGET machine */
/* byte order coded in low order two bits */
#define A_NONE 0x00 /* unknown */
#define A_I8086 0x04 /* intel i8086/8088 */
#define A_M68K 0x0B /* motorola m68000 */
#define A_NS16K 0x0C /* national semiconductor 16032 */
#define A_I80386 0x10 /* intel i80386 */
#define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */
#define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */
/* flags: */
#define A_EXEC 0x10 /* executable */
#define A_SEP 0x20 /* separate I/D */
#define A_PURE 0x40 /* pure text */ /* not used */
#define A_TOVLY 0x80 /* text overlay */ /* not used */
/* offsets of various things: */
#define A_MINHDR 32
#define A_TEXTPOS(X) ((long)(X).a_hdrlen)
#define A_DATAPOS(X) (A_TEXTPOS(X) + (X).a_text)
#define A_HASRELS(X) ((X).a_hdrlen > (unsigned char) A_MINHDR)
#define A_HASEXT(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 8))
#define A_HASLNS(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 16))
#define A_HASTOFF(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 24))
#define A_TRELPOS(X) (A_DATAPOS(X) + (X).a_data)
#define A_DRELPOS(X) (A_TRELPOS(X) + (X).a_trsize)
#define A_SYMPOS(X) (A_TRELPOS(X) + (A_HASRELS(X) ? \
((X).a_trsize + (X).a_drsize) : 0))
struct reloc {
long r_vaddr; /* virtual address of reference */
unsigned short r_symndx; /* internal segnum or extern symbol num */
unsigned short r_type; /* relocation type */
};
/* r_tyep values: */
#define R_ABBS 0
#define R_RELLBYTE 2
#define R_PCRBYTE 3
#define R_RELWORD 4
#define R_PCRWORD 5
#define R_RELLONG 6
#define R_PCRLONG 7
#define R_REL3BYTE 8
#define R_KBRANCHE 9
/* r_symndx for internal segments */
#define S_ABS ((unsigned short)-1)
#define S_TEXT ((unsigned short)-2)
#define S_DATA ((unsigned short)-3)
#define S_BSS ((unsigned short)-4)
struct nlist { /* symbol table entry */
char n_name[8]; /* symbol name */
long n_value; /* value */
unsigned char n_sclass; /* storage class */
unsigned char n_numaux; /* number of auxiliary entries */
/* not used */
unsigned short n_type; /* language base and derived type */
/* not used */
};
/* low bits of storage class (section) */
#define N_SECT 07 /* section mask */
#define N_UNDF 00 /* undefined */
#define N_ABS 01 /* absolute */
#define N_TEXT 02 /* text */
#define N_DATA 03 /* data */
#define N_BSS 04 /* bss */
#define N_COMM 05 /* (common) */
/* high bits of storage class */
#define N_CLASS 0370 /* storage class mask */
#define C_NULL
#define C_EXT 0020 /* external symbol */
#define C_STAT 0030 /* static */
#endif /* _AOUT_H */

View File

@@ -0,0 +1,100 @@
#ifndef _AMOEBA_H
#define _AMOEBA_H
/****************************************************************************/
/* */
/* (c) Copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands */
/* */
/* This product is part of the Amoeba distributed operating system. */
/* */
/* Permission to use, sell, duplicate or disclose this software must be */
/* obtained in writing. Requests for such permissions may be sent to */
/* */
/* */
/* Dr. Andrew S. Tanenbaum */
/* Dept. of Mathematics and Computer Science */
/* Vrije Universiteit */
/* Postbus 7161 */
/* 1007 MC Amsterdam */
/* The Netherlands */
/* */
/****************************************************************************/
/*
** If the host operating system for amoeba transactions is not amoeba
** then several things may need to be done to make the amoeba code
** compatible. These are provided in host_os.h.
*/
#include "host_os.h"
#define PORTSIZE 6
#define OOBSIZE 20
#define HEADERSIZE 32
#define PRIVSIZE 10
#define CAPSIZE 16
#define FAIL ((unshort) -1)
#define NOTFOUND ((unshort) -2)
#define BADADDRESS ((unshort) -3)
#define ABORTED ((unshort) -4)
#define TRYAGAIN ((unshort) -5)
#define sizeoftable(t) (sizeof(t) / sizeof((t)[0]))
#define NILPORT ((port *) 0)
#define NILBUF ((bufptr) 0)
#define _FP(p) ((struct _fakeport *) (p))
#ifndef lint
#define PortCmp(p, q) (_FP(p)->_p1==_FP(q)->_p1 && _FP(p)->_p2==_FP(q)->_p2)
#define NullPort(p) (_FP(p)->_p1==0L && _FP(p)->_p2==0)
#else
#define PortCmp(p, q) ((p)->_portbytes[0] == (q)->_portbytes[0])
#define NullPort(p) ((p)->_portbytes[0] == 0)
#endif
typedef char *bufptr;
#ifndef MAX_BLOCK_NR
typedef unsigned short unshort;
#endif
typedef char *event_t;
typedef struct {
char _portbytes[PORTSIZE];
} port;
struct _fakeport {
long _p1;
short _p2;
};
typedef struct { /* private part of capability */
char prv_object[3];
char prv_rights;
port prv_random;
} private;
typedef struct {
port cap_port;
private cap_priv;
} capability;
typedef struct {
port h_port;
port h_signature;
private h_priv;
unshort h_command;
long h_offset;
unshort h_size;
unshort h_extra;
} header;
#define h_status h_command /* alias: reply status */
/*
** Some function declarations that people tend to forget
** because they are lazy.
*/
extern unshort trans(), getreq(), putrep(), timeout();
#endif /* _AMOEBA_H */

View File

@@ -0,0 +1,17 @@
/*
** parameters for trans, getreq and putrep are given to the kernel
** in a Trpar struct
*/
typedef struct
{
header * p_hdr; /* header pointer */
bufptr p_buf; /* buffer pointer */
unshort p_cnt; /* character count */
} Param;
typedef struct
{
Param tp_par[2];
unshort tp_maxloc; /* trans locate timeout */
} Trpar;

View File

@@ -0,0 +1,54 @@
/* The <ansi.h> header checks whether the compiler claims conformance to ANSI
* Standard C. If so, the symbol _ANSI is defined as 1, otherwise it is
* defined as 0. Based on the result, a macro
*
* _PROTOTYPE(function, params)
*
* is defined. This macro expands in different ways, generating either
* ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie)
* prototypes, as needed. Finally, some programs use _CONST, _VOIDSTAR etc
* in such a way that they are portable over both ANSI and K&R compilers.
* The appropriate macros are defined here.
*/
#ifndef _ANSI_H
#define _ANSI_H
/* ANSI C requires __STDC__ to be defined as 1 for an ANSI C compiler.
* Some half-ANSI compilers define it as 0. Get around this here.
*/
#define _ANSI 0 /* 0 if compiler is not ANSI C, 1 if it is */
#ifdef __STDC__ /* __STDC__ defined for (near) ANSI compilers*/
#if __STDC__ == 1 /* __STDC__ == 1 for conformant compilers */
#undef _ANSI /* get rid of above definition */
#define _ANSI 1 /* _ANSI = 1 for ANSI C compilers */
#endif
#endif
/* At this point, _ANSI has been set correctly to 0 or 1. Define the
* _PROTOTYPE macro to either expand both of its arguments (ANSI prototypes),
* only the function name (K&R prototypes).
*/
#if _ANSI
#define _PROTOTYPE(function, params) function params
#define _VOIDSTAR void *
#define _VOID void
#define _CONST const
#define _VOLATILE volatile
#define _SIZET size_t
#else
#define _PROTOTYPE(function, params) function()
#define _VOIDSTAR void *
#define _VOID void
#define _CONST
#define _VOLATILE
#define _SIZET int
#endif /* _ANSI */
#endif /* ANSI_H */

View File

@@ -0,0 +1,18 @@
/* The <ar.h> header gives the layout of archives. */
#ifndef _AR_H
#define _AR_H
#define ARMAG 0177545
#define _NAME_MAX 14
struct ar_hdr {
char ar_name[_NAME_MAX];
char ar_date[4]; /* long in byte order 2 3 1 0 */
char ar_uid;
char ar_gid;
char ar_mode[2]; /* short in byte order 0 1 */
char ar_size[4]; /* long in byte order 2 3 1 0 */
};
#endif /* _AR_H */

View File

@@ -0,0 +1,35 @@
/* The <assert.h> header contains a macro called "assert" that allows
* programmers to put assertions in the code. These assertions can be verified
* at run time. If an assertion fails, an error message is printed.
* Assertion checking can be disabled by adding the statement
*
* #define NDEBUG
*
* to the program before the
*
* #include <assert.h>
*
* statement.
*/
#ifdef assert
#undef assert /* make this file idempotent */
#endif
#ifndef _ANSI_H
#include <ansi.h>
#endif
#ifdef NDEBUG
/* Debugging disabled -- do not evaluate assertions. */
#define assert(expr) ((void) 0)
#else
/* Debugging enabled -- verify assertions at run time. */
#if _ANSI
_PROTOTYPE( _VOID __bad_assertion, (const char *__expr, const char *__file, int __line) );
#define assert(expr) ((void) ((expr) ? (void)0 : __bad_assertion( #expr, __FILE__, __LINE__)))
#else
#define assert(expr) ((void) ((expr) ? 0 : __assert( __FILE__, __LINE__)))
#endif
#endif

View File

@@ -0,0 +1,6 @@
#ifndef _BLOCK_SIZE_H
#define _BLOCK_SIZE_H
#define BLOCK_SIZE 1024 /* file system data block size */
#endif /* _BLOCK_SIZE_H */

View File

@@ -0,0 +1,72 @@
/* The <ctype.h> header file defines some macros used to identify characters.
* It works by using a table stored in chartab.c. When a character is presented
* to one of these macros, the character is used as an index into the table
* (__ctype) to retrieve a byte. The relevant bit is then extracted.
*/
#ifndef _CTYPE_H
#define _CTYPE_H
extern char __ctype[]; /* property array defined in chartab.c */
extern int __x; /* scratch variable defined in chartab.c */
#define _U 0x01 /* this bit is for upper-case letters [A-Z] */
#define _L 0x02 /* this bit is for lower-case letters [a-z] */
#define _N 0x04 /* this bit is for numbers [0-9] */
#define _S 0x08 /* this bit is for white space \t \n \f etc */
#define _P 0x10 /* this bit is for punctuation characters */
#define _C 0x20 /* this bit is for control characters */
#define _X 0x40 /* this bit is for hex digits [a-f] and [A-F]*/
/* Function Prototypes (have to go before the macros). */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( int isalnum, (int _c) ); /* alphanumeric [a-z], [A-Z], [0-9] */
_PROTOTYPE( int isalpha, (int _c) ); /* alphabetic */
_PROTOTYPE( int iscntrl, (int _c) ); /* control characters */
_PROTOTYPE( int isdigit, (int _c) ); /* digit [0-9] */
_PROTOTYPE( int isgraph, (int _c) ); /* graphic character */
_PROTOTYPE( int islower, (int _c) ); /* lower-case letter [a-z] */
_PROTOTYPE( int isprint, (int _c) ); /* printable character */
_PROTOTYPE( int ispunct, (int _c) ); /* punctuation mark */
_PROTOTYPE( int isspace, (int _c) ); /* white space sp, \f, \n, \r, \t, \v*/
_PROTOTYPE( int isupper, (int _c) ); /* upper-case letter [A-Z] */
_PROTOTYPE( int isxdigit,(int _c) ); /* hex digit [0-9], [a-f], [A-F] */
_PROTOTYPE( int tolower, (int _c) ); /* convert to lower-case */
_PROTOTYPE( int toupper, (int _c) ); /* convert to upper-case */
/* Macros for identifying character classes. */
#define isalnum(c) ((__ctype+1)[c]&(_U|_L|_N))
#define isalpha(c) ((__ctype+1)[c]&(_U|_L))
#define iscntrl(c) ((__ctype+1)[c]&_C)
#define isgraph(c) ((__ctype+1)[c]&(_P|_U|_L|_N))
#define ispunct(c) ((__ctype+1)[c]&_P)
#define isspace(c) ((__ctype+1)[c]&_S)
#define isxdigit(c) ((__ctype+1)[c]&(_N|_X))
#define isdigit(c) ((unsigned) ((c) - '0') < 10)
#define islower(c) ((unsigned) ((c) - 'a') < 26)
#define isupper(c) ((unsigned) ((c) - 'A') < 26)
#define isprint(c) ((unsigned) ((c) - ' ') < 95)
#define isascii(c) ((unsigned) (c) < 128)
/* The following two macros are weird to keep the Language Police at bay.
* The macro 'tolower' only affects upper case letters, and 'toupper'
* only affects lower case letters. Neither one is permitted to evaluate
* its argument more than once. Thus a simple definition like:
*
* #define tolower(c) (isupper(c) ? c - 'A' + 'a' : c)
*
* is prohibited because the argument 'c' is evaluated twice.
* It might be an expression that has side effects, such as a function
* call that increments a counter and returns its value as a character.
* The solution is to first copy the argument to a scratch variable, __x.
*/
#define tolower(c) (__x = (c), isupper(__x) ? __x - 'A' + 'a' : __x)
#define toupper(c) (__x = (c), islower(__x) ? __x - 'a' + 'A' : __x)
#endif /* _CTYPE_H */

View File

@@ -0,0 +1,39 @@
#ifndef _CURSES_H
#define _CURSES_H
#include <ansi.h>
/* Lots of junk here, not packaged right. */
extern char termcap[];
extern char tc[];
extern char *ttytype;
extern char *arp;
extern char *cp;
extern char *cl;
extern char *cm;
extern char *so;
extern char *se;
extern char /* nscrn[ROWS][COLS], cscrn[ROWS][COLS], */ row, col, mode;
extern char str[];
_PROTOTYPE( void addstr, (char *_s) );
_PROTOTYPE( void clear, (void) );
_PROTOTYPE( void clrtobot, (void) );
_PROTOTYPE( void clrtoeol, (void) );
_PROTOTYPE( void endwin, (void) );
_PROTOTYPE( void fatal, (char *_s) );
_PROTOTYPE( char inch, (void) );
_PROTOTYPE( void initscr, (void) );
_PROTOTYPE( void move, (int _y, int _x) );
/* WRONG, next is varargs. */
_PROTOTYPE( void printw, (char *_fmt, char *_a1, char *_a2, char *_a3,
char *_a4, char *_a5) );
_PROTOTYPE( void outc, (int _c) );
_PROTOTYPE( void refresh, (void) );
_PROTOTYPE( void standend, (void) );
_PROTOTYPE( void standout, (void) );
_PROTOTYPE( void touchwin, (void) );
#endif /* _CURSES_H */

View File

@@ -0,0 +1,40 @@
/* The <dirent.h> header file is for POSIX. It is used by the opendir(),
* readdir(), writedir(), and related procedure calls.
*/
#ifndef _DIRENT_H
#define _DIRENT_H
/* DIRBUF must in general be larger than the filesystem buffer size. */
#define _DIRBUF 2048 /* buffer size for fs-indep. dirs */
#define _DIR_MAGIC 19997 /* arbitrary number for marking DIRs */
/* The DIR structure is used for all the directory operations. */
typedef struct {
int dd_fd; /* file descriptor */
int dd_loc; /* offset in block */
int dd_size; /* amount of valid data */
int dd_magic; /* magic number to recognize DIRs */
char *dd_buf; /* -> directory block */
} DIR; /* stream data from opendir() */
struct dirent { /* data from getdents()/readdir() */
long d_ino; /* inode number of entry */
off_t d_off; /* offset of disk directory entry */
unsigned short d_reclen; /* length of this record */
char d_name[1]; /* name of file plus a 0 byte */
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( int closedir, (DIR *_dirp) );
_PROTOTYPE( int getdents, (int _fildes, char *_buf, unsigned _nbyte) );
_PROTOTYPE( DIR *opendir, (char *_dirname) );
_PROTOTYPE( struct dirent *readdir, (DIR *_dirp) );
_PROTOTYPE( void rewinddir, (DIR *_dirp) );
#endif /* _DIRENT_H */

View File

@@ -0,0 +1,96 @@
/* The <errno.h> header defines the numbers of the various errors that can
* occur during program execution. They are visible to user programs and
* should be small positive integers. However, they are also used within
* MINIX, where they must be negative. For example, the READ system call is
* executed internally by calling do_read(). This function returns either a
* (negative) error number or a (positive) number of bytes actually read.
*
* To solve the problem of having the error numbers be negative inside the
* the system and positive outside, the following mechanism is used. All the
* definitions are are the form:
*
* #define EPERM (_SIGN 1)
*
* If the macro _SYSTEM is defined, then _SIGN is set to "-", otherwise it is
* set to "". Thus when compiling the operating system, the macro _SYSTEM
* will be defined, setting EPERM to (- 1), whereas when when this
* file is included in an ordinary user program, EPERM has the value ( 1).
*/
#ifndef _ERRNO_H /* check if <errno.h> is already included */
#define _ERRNO_H /* it is not included; note that fact */
/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
#ifdef _SYSTEM
# define _SIGN -
# define OK 0
#else
# define _SIGN
#endif
extern int errno; /* place where the error numbers go */
/* Here are the numerical values of the error numbers. */
#define _NERROR 39 /* number of errors */
#define ERROR (_SIGN 99) /* generic error */
#define EPERM (_SIGN 1) /* operation not permitted */
#define ENOENT (_SIGN 2) /* no such file or directory */
#define ESRCH (_SIGN 3) /* no such process */
#define EINTR (_SIGN 4) /* interrupted function call */
#define EIO (_SIGN 5) /* input/output error */
#define ENXIO (_SIGN 6) /* no such device or address */
#define E2BIG (_SIGN 7) /* arg list too long */
#define ENOEXEC (_SIGN 8) /* exec format error */
#define EBADF (_SIGN 9) /* bad file descriptor */
#define ECHILD (_SIGN 10) /* no child process */
#define EAGAIN (_SIGN 11) /* resource temporarily unavailable */
#define ENOMEM (_SIGN 12) /* not enough space */
#define EACCES (_SIGN 13) /* permission denied */
#define EFAULT (_SIGN 14) /* bad address */
#define ENOTBLK (_SIGN 15) /* Extension: not a block special file */
#define EBUSY (_SIGN 16) /* resource busy */
#define EEXIST (_SIGN 17) /* file exists */
#define EXDEV (_SIGN 18) /* improper link */
#define ENODEV (_SIGN 19) /* no such device */
#define ENOTDIR (_SIGN 20) /* not a directory */
#define EISDIR (_SIGN 21) /* is a directory */
#define EINVAL (_SIGN 22) /* invalid argument */
#define ENFILE (_SIGN 23) /* too many open files in system */
#define EMFILE (_SIGN 24) /* too many open files */
#define ENOTTY (_SIGN 25) /* inappropriate I/O control operation */
#define ETXTBSY (_SIGN 26) /* no longer used */
#define EFBIG (_SIGN 27) /* file too large */
#define ENOSPC (_SIGN 28) /* no space left on device */
#define ESPIPE (_SIGN 29) /* invalid seek */
#define EROFS (_SIGN 30) /* read-only file system */
#define EMLINK (_SIGN 31) /* too many links */
#define EPIPE (_SIGN 32) /* broken pipe */
#define EDOM (_SIGN 33) /* domain error (from ANSI C std) */
#define ERANGE (_SIGN 34) /* result too large (from ANSI C std) */
#define EDEADLK (_SIGN 35) /* resource deadlock avoided */
#define ENAMETOOLONG (_SIGN 36) /* file name too long */
#define ENOLCK (_SIGN 37) /* no locks available */
#define ENOSYS (_SIGN 38) /* function not implemented */
#define ENOTEMPTY (_SIGN 39) /* directory not empty */
/* The following are not POSIX errors, but they can still happen. */
#define ELOCKED (_SIGN 101) /* can't send message */
#define EBADCALL (_SIGN 102) /* error on send/receive */
/* The following error codes are generated by the kernel itself. */
#ifdef _SYSTEM
#define E_BAD_DEST -1 /* destination address illegal */
#define E_BAD_SRC -2 /* source address illegal */
#define E_TRY_AGAIN -3 /* can't send-- tables full */
#define E_OVERRUN -4 /* interrupt for task that is not waiting */
#define E_BAD_BUF -5 /* message buf outside caller's addr space */
#define E_TASK -6 /* can't send to task */
#define E_NO_MESSAGE -7 /* RECEIVE failed: no message present */
#define E_NO_PERM -8 /* ordinary users can't send to tasks */
#define E_BAD_FCN -9 /* only valid fcns are SEND, RECEIVE, BOTH */
#define E_BAD_ADDR -10 /* bad address given to utility routine */
#define E_BAD_PROC -11 /* bad proc number given to utility */
#endif /* _SYSTEM */
#endif /* _ERRNO_H */

View File

@@ -0,0 +1,68 @@
/* The <fcntl.h> header is needed by the open() and fcntl() system calls,
* which have a variety of parameters and flags. They are described here.
* The formats of the calls to each of these are:
*
* open(path, oflag [,mode]) open a file
* fcntl(fd, cmd [,arg]) get or set file attributes
*
*/
#ifndef _FCNTL_H
#define _FCNTL_H
/* These values are used for cmd in fcntl(). POSIX Table 6-1. */
#define F_DUPFD 0 /* duplicate file descriptor */
#define F_GETFD 1 /* get file descriptor flags */
#define F_SETFD 2 /* set file descriptor flags */
#define F_GETFL 3 /* get file status flags */
#define F_SETFL 4 /* set file status flags */
#define F_GETLK 5 /* get record locking information */
#define F_SETLK 6 /* set record locking information */
#define F_SETLKW 7 /* set record locking info; wait if blocked */
/* File descriptor flags used for fcntl(). POSIX Table 6-2. */
#define FD_CLOEXEC 1 /* close on exec flag for third arg of fcntl */
/* L_type values for record locking with fcntl(). POSIX Table 6-3. */
#define F_RDLCK 0 /* shared or read lock */
#define F_WRLCK 1 /* exclusive or write lock */
#define F_UNLCK 2 /* unlock */
/* Oflag values for open(). POSIX Table 6-4. */
#define O_CREAT 00100 /* creat file if it doesn't exist */
#define O_EXCL 00200 /* exclusive use flag */
#define O_NOCTTY 00400 /* do not assign a controlling terminal */
#define O_TRUNC 01000 /* truncate flag */
/* File status flags for open() and fcntl(). POSIX Table 6-5. */
#define O_APPEND 02000 /* set append mode */
#define O_NONBLOCK 04000 /* no delay */
/* File access modes for open() and fcntl(). POSIX Table 6-6. */
#define O_RDONLY 0 /* open(name, O_RDONLY) opens read only */
#define O_WRONLY 1 /* open(name, O_WRONLY) opens write only */
#define O_RDWR 2 /* open(name, O_RDWR) opens read/write */
/* Mask for use with file access modes. POSIX Table 6-7. */
#define O_ACCMODE 03 /* mask for file access modes */
/* Struct used for locking. POSIX Table 6-8. */
struct flock {
short l_type; /* type: F_RDLCK, F_WRLCK, or F_UNLCK */
short l_whence; /* flag for starting offset */
off_t l_start; /* relative offset in bytes */
off_t l_len; /* size; if 0, then until EOF */
pid_t l_pid; /* process id of the locks' owner */
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( int creat, (const char *_path, /* mode_t */ unsigned _mode) );
_PROTOTYPE( int fcntl, (int _filedes, int _cmd, ...) );
_PROTOTYPE( int open, (const char *_path, int _oflag, ...) );
#endif /* _FCNTL_H */

View File

@@ -0,0 +1,68 @@
/* The <fcntl.h> header is needed by the open() and fcntl() system calls,
* which have a variety of parameters and flags. They are described here.
* The formats of the calls to each of these are:
*
* open(path, oflag [mode]) open a file
* fcntl(fd, cmd,[ arg]) get or set file attributes
*
*/
#ifndef _FCNTL_H
#define _FCNTL_H
/* These values are used for cmd in fcntl(). POSIX Table 6-1. */
#define F_DUPFD 0 /* duplicate file descriptor */
#define F_GETFD 1 /* get file descriptor flags */
#define F_SETFD 2 /* set file descriptor flags */
#define F_GETFL 3 /* get file status flags */
#define F_SETFL 4 /* set file status flags */
#define F_GETLK 5 /* get record locking information */
#define F_SETLK 6 /* set record locking information */
#define F_SETLKW 7 /* set record locking info; wait if blocked */
/* File descriptor flags used for fcntl(). POSIX Table 6-2. */
#define FD_CLOEXEC 1 /* close on exec flag for third arg of fcntl */
/* L_type values for record locking with fcntl(). POSIX Table 6-3. */
#define F_RDLCK 0 /* shared or read lock */
#define F_WRLCK 1 /* exclusive or write lock */
#define F_UNLCK 2 /* unlock */
/* Oflag values for open(). POSIX Table 6-4. */
#define O_CREAT 00100 /* creat file if it doesn't exist */
#define O_EXCL 00200 /* exclusive use flag */
#define O_NOCTTY 00400 /* do not assign a controlling terminal */
#define O_TRUNC 01000 /* truncate flag */
/* File status flags for open() and fcntl(). POSIX Table 6-5. */
#define O_APPEND 02000 /* set append mode */
#define O_NONBLOCK 04000 /* no delay */
/* File access modes for open() and fcntl(). POSIX Table 6-6. */
#define O_RDONLY 0 /* open(name, O_RDONLY) opens read only */
#define O_WRONLY 1 /* open(name, O_WRONLY) opens write only */
#define O_RDWR 2 /* open(name, O_RDWR) opens read/write */
/* Mask for use with file access modes. POSIX Table 6-7. */
#define O_ACCMODE 03 /* mask for file access modes */
/* Struct used for locking. POSIX Table 6-8. */
struct flock {
short l_type; /* type: F_RDLCK, F_WRLCK, or F_UNLCK */
short l_whence; /* flag for starting offset */
off_t l_start; /* relative offset in bytes */
off_t l_len; /* size; if 0, then until EOF */
pid_t l_pid; /* process id of the locks' owner */
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( int creat, (const char *_path, /* mode_t */ unsigned _mode) );
_PROTOTYPE( int fcntl, (int _filedes, int _cmd, ...) );
_PROTOTYPE( int open, (const char *_path, int _oflag, ...) );
#endif /* _FCNTL_H */

View File

@@ -0,0 +1,42 @@
/* The <float.h> header defines some implementation limits for (IEEE) floating
* point. Application programs can use it to find out how big and small
* floating-point numbers can be, what epsilon to use for iteration, etc.
*/
#ifndef _FLOAT_H
#define _FLOAT_H
#define FLT_DIG 6
#define FLT_EPSILON 1.19209290e-07
#define FLT_MANT_DIG 24
#define FLT_MAX 3.40282347e+38F
#define FLT_MAX_10_EXP 38
#define FLT_MAX_EXP 128
#define FLT_MIN 1.17549435e-38F
#define FLT_MIN_10_EXP -37
#define FLT_MIN_EXP -125
#define DBL_DIG 15
#define DBL_EPSILON 2.2204460492503131e-16
#define DBL_MANT_DIG 53
#define DBL_MAX 1.7976931348623157e+308
#define DBL_MAX_10_EXP 308
#define DBL_MAX_EXP 1024
#define DBL_MIN 2.2250738585072014e-308
#define DBL_MIN_10_EXP -307
#define DBL_MIN_EXP -1021
#define LDBL_DIG 15
#define LDBL_EPSILON 2.2204460492503131e-16
#define LDBL_MANT_DIG 53
#define LDBL_MAX 1.7976931348623157e+308L
#define LDBL_MAX_10_EXP 308
#define LDBL_MAX_EXP 1024
#define LDBL_MIN 2.2250738585072014e-308L
#define LDBL_MIN_10_EXP -307
#define LDBL_MIN_EXP -1021
#define FLT_ROUNDS 1
#define FLT_RADIX 2
#endif /* _FLOAT_H */

View File

@@ -0,0 +1,27 @@
/* The <grp.h> header is used for the getgrid() and getgrnam() calls. */
#ifndef _GRP_H
#define _GRP_H
struct group {
char *gr_name; /* the name of the group */
char *gr_passwd; /* the group passwd */
gid_t gr_gid; /* the numerical group ID */
char **gr_mem; /* a vector of pointers to the members */
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( struct group *getgrgid, (int _gid) );
_PROTOTYPE( struct group *getgrnam, (char *_name) );
#ifdef _MINIX
_PROTOTYPE( void endgrent, (void) );
_PROTOTYPE( struct group *getgrent, (void) );
_PROTOTYPE( int setgrent, (void) );
#endif
#endif /* _GRP_H */

View File

@@ -0,0 +1,136 @@
/****************************************************************************/
/* */
/* (c) Copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands */
/* */
/* This product is part of the Amoeba distributed operating system. */
/* */
/* Permission to use, sell, duplicate or disclose this software must be */
/* obtained in writing. Requests for such permissions may be sent to */
/* */
/* */
/* Dr. Andrew S. Tanenbaum */
/* Dept. of Mathematics and Computer Science */
/* Vrije Universiteit */
/* Postbus 7161 */
/* 1007 MC Amsterdam */
/* The Netherlands */
/* */
/****************************************************************************/
/*
** This is the host_os.h file for Minix
*/
#define SIGAMOEBA SIGEMT
#ifdef AM_KERNEL
/*
** to avoid altering trans.c, portcache.c, etc we need the following
*/
#ifndef PRIVATE
#define PRIVATE static
#endif
/*
** The following sequences of undefs and defines is to avoid clashes in the
** naming of variables and constants in Amoeba and Minix.
*/
#undef ABORT
#undef ABORTED
#undef ACK
#undef ACKED
#undef ALIVE
#undef BADADDRESS
#undef BROADCAST
#undef BUFSIZE
#undef CRASH
#undef DEAD
#undef DELETE
#undef DONE
#undef DONTKNOW
#undef ENQUIRY
#undef FAIL
#undef FAILED
#undef GLOBAL
#undef HASHMASK
#undef HEADERSIZE
#undef HERE
#undef IDLE
#undef IMMORTAL
#undef LAST
#undef LOCAL
#undef LOCATE
#undef LOCATING
#undef LOOK
#undef MEMFAULT
#undef MORTAL
#undef NAK
#undef NESTED
#undef NHASH
#undef NILVECTOR
#undef NOSEND
#undef NOTFOUND
#undef NOWAIT
#undef NOWHERE
#undef PACKETSIZE
#undef PORT
#undef RECEIVING
#undef REPLY
#undef REQUEST
#undef RETRANS
#undef RUNNABLE
#undef SEND
#undef SENDING
#undef SERVING
#undef SOMEWHERE
#undef TASK
#undef TYPE
#undef WAIT
#undef bit
#undef concat
#undef disable
#undef enable
#undef hash
#undef hibyte
#undef lobyte
#undef siteaddr
#undef sizeoftable
#define allocbuf am_allocbuf
#define append am_append
#define area am_area
#define badassertion am_badassertion
#define cleanup am_cleanup
#define debug am_debug
#define destroy am_destroy
#define freebuf am_freebuf
#define getall am_gall
#define getbuf am_gbuf
#define getreq am_greq
#define getsig am_gsig
#define handle am_handle
#define locate am_locate
#define netenable am_netenable
#define netsweep am_sweep
#define ntask am_ntsk
#define pickoff am_pickoff
#define porttab am_ptab
#define puthead am_puthead
#define putbuf am_pbuf
#define putrep am_prep
#define putsig am_psig
#define sendsig am_sendsig
#define sleep am_sleep
#define task am_task
#define ticker am_ticker
#define timeout am_timeout
#define trans am_trans
#define umap am_umap
#define uniqport am_uniqport
#define uppertask am_uppertask
#define wakeup am_wakeup
#endif /* AM_KERNEL */

View File

@@ -0,0 +1,39 @@
/* The <lib.h> header is the master header used by the library.
* All the C files in the lib subdirectories include it.
*/
#ifndef _LIB_H
#define _LIB_H
/* First come the defines. */
#define _POSIX_SOURCE 1 /* tell headers to include POSIX stuff */
#define _MINIX 1 /* tell headers to include MINIX stuff */
/* The following are so basic, all the lib files get them automatically. */
#include <minix/config.h> /* must be first */
#include <sys/types.h>
#include <limits.h>
#include <errno.h>
#include <ansi.h>
#include <minix/const.h>
#include <minix/type.h>
#include <minix/callnr.h>
extern message _M;
#define MM 0
#define FS 1
_PROTOTYPE( int _callm1, (int _proc, int _syscallnr,
int _int1, int _int2, int _int3,
char *_ptr1, char *_ptr2, char *_ptr3) );
_PROTOTYPE( int _callm3, (int _proc, int _syscallnr, int _int1,
const char *_name) );
_PROTOTYPE( int _callx, (int _proc, int _syscallnr) );
_PROTOTYPE( int _len, (const char *_s) );
_PROTOTYPE( void panic, (const char *_message, int _errnum) );
_PROTOTYPE( int _sendrec, (int _src_dest, message *_m_ptr) );
_PROTOTYPE( void begsig, (int dummy) );
#endif /* _LIB_H */

View File

@@ -0,0 +1,39 @@
/* The <lib.h> header is the master header used by the library.
* All the C files in the lib subdirectories include it.
*/
#ifndef _LIB_H
#define _LIB_H
/* First come the defines. */
#define _POSIX_SOURCE 1 /* tell headers to include POSIX stuff */
#define _MINIX 1 /* tell headers to include MINIX stuff */
/* The following are so basic, all the lib files get them automatically. */
#include <minix/config.h> /* must be first */
#include <sys/types.h>
#include <limits.h>
#include <errno.h>
#include <ansi.h>
#include <minix/const.h>
#include <minix/type.h>
#include <minix/callnr.h>
extern message _M;
#define MM 0
#define FS 1
_PROTOTYPE( int _callm1, (int _proc, int _syscallnr,
int _int1, int _int2, int _int3,
char *_ptr1, char *_ptr2, char *_ptr3) );
_PROTOTYPE( int _callm3, (int _proc, int _syscallnr, int _int1,
const char *_name) );
_PROTOTYPE( int _callx, (int _proc, int _syscallnr) );
_PROTOTYPE( int _len, (const char *_s) );
_PROTOTYPE( void panic, (const char *_message, int _errnum) );
_PROTOTYPE( int _sendrec, (int _src_dest, message *_m_ptr) );
extern _PROTOTYPE( void begsig, (int _dummy) );
#endif /* _LIB_H */

View File

@@ -0,0 +1,63 @@
/* The <limits.h> header defines some basic sizes, both of the language types
* (e.g., the number of bits in an integer), and of the operating system (e.g.
* the number of characters in a file name.
*/
#ifndef _LIMITS_H
#define _LIMITS_H
/* Definitions about chars (8 bits in MINIX, and signed). */
#define CHAR_BIT 8 /* # bits in a char */
#define CHAR_MIN -128 /* minimum value of a char */
#define CHAR_MAX 127 /* maximum value of a char */
#define SCHAR_MIN -128 /* minimum value of a signed char */
#define SCHAR_MAX 127 /* maximum value of a signed char */
#define UCHAR_MAX 255 /* maximum value of an unsigned char */
#define MB_LEN_MAX 1 /* maximum length of a multibyte char */
/* Definitions about shorts (16 bits in MINIX). */
#define SHRT_MIN (-32767-1) /* minimum value of a short */
#define SHRT_MAX 32767 /* maximum value of a short */
#define USHRT_MAX 65535 /* maximum value of unsigned short */
/* Definitions about ints (16 bits in MINIX for 8088, 80286, Atari etc) */
#define INT_MIN (-32767-1) /* minimum value of an int */
#define INT_MAX 32767 /* maximum value of an int */
#define UINT_MAX 65535 /* maximum value of an unsigned int */
/*Definitions about longs (32 bits in MINIX). */
#define LONG_MIN (-2147483647-1)/* minimum value of a long */
#define LONG_MAX 2147483647L /* maximum value of a long */
#define ULONG_MAX 4294967295L /* maximum value of an unsigned long */
/* Minimum sizes required by the POSIX P1003.1 standard (Table 2-2). */
#ifdef _POSIX_SOURCE /* these are only visible for POSIX */
#define _POSIX_ARG_MAX 4096 /* exec() may have 4K worth of args */
#define _POSIX_CHILD_MAX 6 /* a process may have 6 children */
#define _POSIX_LINK_MAX 8 /* a file may have 8 links */
#define _POSIX_MAX_CANON 255 /* size of the canonical input queue */
#define _POSIX_MAX_INPUT 255 /* you can type 255 chars ahead */
#define _POSIX_NAME_MAX 14 /* a file name may have 14 chars */
#define _POSIX_NGROUPS_MAX 0 /* supplementary group IDs are optional */
#define _POSIX_OPEN_MAX 16 /* a process may have 16 files open */
#define _POSIX_PATH_MAX 255 /* a pathname may contain 255 chars */
#define _POSIX_PIPE_BUF 512 /* pipes writes of 512 bytes are atomic */
/* Values actually implemented by MINIX (Tables 2-3, 2-4, and 2-5). */
/* Some of these old names had better be defined when not POSIX. */
#define _NO_LIMIT 100 /* arbitrary number; limit not enforced */
#define NGROUPS_MAX 0 /* supplemental group IDs not available */
#define ARG_MAX 4096 /* # bytes of args + environ for exec() */
#define CHILD_MAX _NO_LIMIT /* MINIX does not limit children */
#define OPEN_MAX 20 /* # open files a process may have */
#define LINK_MAX 127 /* # links a file may have */
#define MAX_CANON 255 /* size of the canonical input queue */
#define MAX_INPUT 255 /* size of the type-ahead buffer */
#define NAME_MAX 14 /* # chars in a file name */
#define PATH_MAX 255 /* # chars in a path name */
#define PIPE_BUF 512 /* # bytes in atomic write to a pipe */
#endif /* _POSIX_SOURCE */
#endif /* _LIMITS_H */

View File

@@ -0,0 +1,47 @@
/* The <locale.h> header is used to custom tailor currency symbols, decimal
* points, and other items to the local style. It is ANSI's attempt at
* avoiding cultural imperialism. The locale given below is for C.
*/
#ifndef _LOCALE_H
#define _LOCALE_H
struct lconv {
char *decimal_point; /* "." */
char *thousands_sep; /* "" */
char *grouping; /* "" */
char *int_curr_symbol; /* "" */
char *currency_symbol; /* "" */
char *mon_decimal_point; /* "" */
char *mon_thousands_sep; /* "" */
char *mon_grouping; /* "" */
char *positive_sign; /* "" */
char *negative_sign; /* "" */
char int_frac_digits; /* CHAR_MAX */
char frac_digits; /* CHAR_MAX */
char p_cs_precedes; /* CHAR_MAX */
char p_sep_by_space; /* CHAR_MAX */
char n_cs_precedes; /* CHAR_MAX */
char n_sep_by_space; /* CHAR_MAX */
char p_sign_posn; /* CHAR_MAX */
char n_sign_posn; /* CHAR_MAX */
};
#define NULL ((void *)0)
#define LC_ALL 1
#define LC_COLLATE 2
#define LC_CTYPE 3
#define LC_MONETARY 4
#define LC_NUMERIC 5
#define LC_TIME 6
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( char *setlocale, (int _category, const char *_locale) );
_PROTOTYPE( struct lconv *localeconv, (void) );
#endif /* _LOCALE_H */

View File

@@ -0,0 +1,36 @@
/* The <math.h> header contains prototypes for mathematical functions. */
#ifndef _MATH_H
#define _MATH_H
#define HUGE_VAL 9.9e+999 /* though it will generate a warning */
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( double acos, (double _x) );
_PROTOTYPE( double asin, (double _x) );
_PROTOTYPE( double atan, (double _x) );
_PROTOTYPE( double atan2, (double _y, double _x) );
_PROTOTYPE( double ceil, (double _x) );
_PROTOTYPE( double cos, (double _x) );
_PROTOTYPE( double cosh, (double _x) );
_PROTOTYPE( double exp, (double _x) );
_PROTOTYPE( double fabs, (double _x) );
_PROTOTYPE( double floor, (double _x) );
_PROTOTYPE( double fmod, (double _x, double _y) );
_PROTOTYPE( double frexp, (double _x, int *_exp) );
_PROTOTYPE( double ldexp, (double _x, int _exp) );
_PROTOTYPE( double log, (double _x) );
_PROTOTYPE( double log10, (double _x) );
_PROTOTYPE( double modf, (double _x, double *_iptr) );
_PROTOTYPE( double pow, (double _x, double _y) );
_PROTOTYPE( double sin, (double _x) );
_PROTOTYPE( double sinh, (double _x) );
_PROTOTYPE( double sqrt, (double _x) );
_PROTOTYPE( double tan, (double _x) );
_PROTOTYPE( double tanh, (double _x) );
#endif /* _MATH_H */

View File

@@ -0,0 +1,29 @@
/*
* mathconst.h - mathematic constants
*/
/* $Header: mathconst.h,v 1.3 89/12/18 13:59:33 eck Exp $ */
#if !defined(_MATHCONST_H)
#define _MATHCONST_H
/* some constants (Hart & Cheney) */
#define M_PI 3.14159265358979323846264338327950288
#define M_2PI 6.28318530717958647692528676655900576
#define M_3PI_4 2.35619449019234492884698253745962716
#define M_PI_2 1.57079632679489661923132169163975144
#define M_3PI_8 1.17809724509617246442349126872981358
#define M_PI_4 0.78539816339744830961566084581987572
#define M_PI_8 0.39269908169872415480783042290993786
#define M_1_PI 0.31830988618379067153776752674502872
#define M_2_PI 0.63661977236758134307553505349005744
#define M_4_PI 1.27323954473516268615107010698011488
#define M_E 2.71828182845904523536028747135266250
#define M_LOG2E 1.44269504088896340735992468100189213
#define M_LOG10E 0.43429448190325182765112891891660508
#define M_LN2 0.69314718055994530941723212145817657
#define M_LN10 2.30258509299404568401799145468436421
#define M_SQRT2 1.41421356237309504880168872420969808
#define M_1_SQRT2 0.70710678118654752440084436210484904
#define M_EULER 0.57721566490153286060651209008240243
#endif /* _MATHCONST_H */

View File

@@ -0,0 +1,43 @@
/* boot.h */
/* Redefine root and root image devices as variables.
* This keeps the diffs small but may cause future confusion.
*/
#define BOOT_DEV (boot_parameters.bp_ramimagedev)
#define ROOT_DEV (boot_parameters.bp_rootdev)
/* Device numbers of RAM, floppy and hard disk devices.
* h/com.h defines RAM_DEV but only as the minor number.
*/
#define DEV_FD0 0x200
#define DEV_HD0 0x300
#define DEV_RAM 0x100
/* Default device numbers for root and root image.
* Root image is only used when root is /dev/ram.
*/
#define DRAMIMAGEDEV (DEV_FD0 + 0)
#define DROOTDEV (DEV_RAM + 0)
/* Default RAM disk size.
* Not used if root is /dev/ram when size is from root image.
*/
#define DRAMSIZE 0
/* Default scan code to fake a PC keyboard. */
#define DSCANCODE 13
/* Default processor type for no restriction (88 would force 386 to 88). */
#define DPROCESSOR 0xFFFF
/* Structure to hold boot parameters. */
struct bparam_s
{
dev_t bp_rootdev;
dev_t bp_ramimagedev;
unsigned short bp_ramsize;
unsigned short bp_scancode; /* still put into BX for kernel */
unsigned short bp_processor;
};
extern struct bparam_s boot_parameters;

View File

@@ -0,0 +1,58 @@
#define NCALLS 70 /* number of system calls allowed */
#define EXIT 1
#define FORK 2
#define READ 3
#define WRITE 4
#define OPEN 5
#define CLOSE 6
#define WAIT 7
#define CREAT 8
#define LINK 9
#define UNLINK 10
#define CHDIR 12
#define TIME 13
#define MKNOD 14
#define CHMOD 15
#define CHOWN 16
#define BRK 17
#define STAT 18
#define LSEEK 19
#define GETPID 20
#define MOUNT 21
#define UMOUNT 22
#define SETUID 23
#define GETUID 24
#define STIME 25
#define PTRACE 26
#define ALARM 27
#define FSTAT 28
#define PAUSE 29
#define UTIME 30
#define ACCESS 33
#define SYNC 36
#define KILL 37
#define RENAME 38
#define MKDIR 39
#define RMDIR 40
#define DUP 41
#define PIPE 42
#define TIMES 43
#define SETGID 46
#define GETGID 47
#define SIGNAL 48
#define IOCTL 54
#define FCNTL 55
#define EXEC 59
#define UMASK 60
#define CHROOT 61
/* The following are not system calls, but are processed like them. */
#define KSIG 64 /* kernel detected a signal */
#define UNPAUSE 65 /* to MM or FS: check for EINTR */
#define BRK2 66 /* to MM: used to say how big FS & INIT are */
#define REVIVE 67 /* to FS: revive a sleeping process */
#define TASK_REPLY 68 /* to FS: reply code from tty task */
/* The following IS a system call for amoeba transactions */
#define AM_SYSCALL 69

View File

@@ -0,0 +1,166 @@
/* System calls. */
#define SEND 1 /* function code for sending messages */
#define RECEIVE 2 /* function code for receiving messages */
#define BOTH 3 /* function code for SEND + RECEIVE */
#define ANY (NR_PROCS+100) /* receive(ANY, buf) accepts from any source */
/* Task numbers, function codes and reply codes. */
#define TTY -NR_TASKS /* terminal I/O class */
# define TTY_READ 3 /* fcn code for reading from tty */
# define TTY_WRITE 4 /* fcn code for writing to tty */
# define TTY_IOCTL 5 /* fcn code for ioctl */
# define TTY_SETPGRP 6 /* fcn code for setpgrp */
# define TTY_OPEN 7 /* fcn code for opening tty */
# define TTY_CLOSE 8 /* fcn code for closing tty */
# define SUSPEND -998 /* used in interrupts when tty has no data */
#ifdef AM_KERNEL
#define AMOEBA
#endif
#ifdef AMOEBA
/* There are AM_NTASK copies of the amoeba kernel task.
* If you change AM_NTASKS be sure to adjust kernel/table.c and fs/table.c
*/
#define AM_NTASKS 4 /* number of kernel tasks of this class */
#define AMINT_CLASS (TTY+1) /* Amoeba event handler */
#define AMOEBA_CLASS (AMINT_CLASS+AM_NTASKS) /* transaction handlers */
# define ETHER_ARRIV 1 /* fcn code for packet arrival */
# define AM_TRANS 2 /* amoeba transaction */
# define AM_GETREQ 3 /* amoeba getrequest */
# define AM_PUTREP 4 /* amoeba putrep */
# define AM_REVIVE 6 /* used by kernel task to revive luser task */
# define AM_TIMEOUT 8 /* used to talk to clock task */
# define AM_PUTSIG 9 /* when the luser hits the DEL ! */
# define AM_TASK_DIED 10 /* sent if task died during a transaction */
#else /* if AMOEBA not defined */
#define AMOEBA_CLASS TTY
#endif /* AMOEBA */
/*
* New class definitions should go here and should be defined relative
* to AMOEBA_CLASS (ie. as AMOEBA_CLASS+n, for the nth task added).
*/
#define IDLE (AMOEBA_CLASS+1) /* task to run when there's nothing to run */
#define PRINTER -7 /* printer I/O class */
/* The printer uses the same commands as TTY. */
#define WINCHESTER -6 /* winchester (hard) disk class */
#define FLOPPY -5 /* floppy disk class */
# define DISK_READ 3 /* fcn code to DISK (must equal TTY_READ) */
# define DISK_WRITE 4 /* fcn code to DISK (must equal TTY_WRITE) */
# define DISK_IOCTL 5 /* fcn code for setting up RAM disk */
# define SCATTERED_IO 6 /* fcn code for multiple reads/writes */
# define OPTIONAL_IO 16 /* modifier to DISK_* codes within vector */
#define MEM -4 /* /dev/ram, /dev/(k)mem and /dev/null class */
# define RAM_DEV 0 /* minor device for /dev/ram */
# define MEM_DEV 1 /* minor device for /dev/mem */
# define KMEM_DEV 2 /* minor device for /dev/kmem */
# define NULL_DEV 3 /* minor device for /dev/null */
#if (CHIP == INTEL)
# define PORT_DEV 4 /* minor device for /dev/port */
#endif
#define CLOCK -3 /* clock class */
# define SET_ALARM 1 /* fcn code to CLOCK, set up alarm */
# define GET_TIME 3 /* fcn code to CLOCK, get real time */
# define SET_TIME 4 /* fcn code to CLOCK, set real time */
# define REAL_TIME 1 /* reply from CLOCK: here is real time */
#define SYSTASK -2 /* internal functions */
# define SYS_XIT 1 /* fcn code for sys_xit(parent, proc) */
# define SYS_GETSP 2 /* fcn code for sys_sp(proc, &new_sp) */
# define SYS_SIG 3 /* fcn code for sys_sig(proc, sig) */
# define SYS_FORK 4 /* fcn code for sys_fork(parent, child) */
# define SYS_NEWMAP 5 /* fcn code for sys_newmap(procno, map_ptr) */
# define SYS_COPY 6 /* fcn code for sys_copy(ptr) */
# define SYS_EXEC 7 /* fcn code for sys_exec(procno, new_sp) */
# define SYS_TIMES 8 /* fcn code for sys_times(procno, bufptr) */
# define SYS_ABORT 9 /* fcn code for sys_abort() */
# define SYS_FRESH 10 /* fcn code for sys_fresh() (Atari only) */
# define SYS_KILL 11 /* fcn code for sys_kill(proc, sig) */
# define SYS_GBOOT 12 /* fcn code for sys_gboot(procno, bootptr) */
# define SYS_UMAP 13 /* fcn code for sys_umap(procno, etc) */
# define SYS_MEM 14 /* fcn code for sys_mem() */
# define SYS_TRACE 15 /* fcn code for sys_trace(req,pid,addr,data) */
#define HARDWARE -1 /* used as source on interrupt generated msgs*/
/* Names of message fields for messages to CLOCK task. */
#define DELTA_TICKS m6_l1 /* alarm interval in clock ticks */
#define FUNC_TO_CALL m6_f1 /* pointer to function to call */
#define NEW_TIME m6_l1 /* value to set clock to (SET_TIME) */
#define CLOCK_PROC_NR m6_i1 /* which proc (or task) wants the alarm? */
#define SECONDS_LEFT m6_l1 /* how many seconds were remaining */
/* Names of message fields used for messages to block and character tasks. */
#define DEVICE m2_i1 /* major-minor device */
#define PROC_NR m2_i2 /* which (proc) wants I/O? */
#define COUNT m2_i3 /* how many bytes to transfer */
#define POSITION m2_l1 /* file offset */
#define ADDRESS m2_p1 /* core buffer address */
/* Names of message fields for messages to TTY task. */
#define TTY_LINE m2_i1 /* message parameter: terminal line */
#define TTY_REQUEST m2_i3 /* message parameter: ioctl request code */
#define TTY_SPEK m2_l1 /* message parameter: ioctl speed, erasing */
#define TTY_FLAGS m2_l2 /* message parameter: ioctl tty mode */
#define TTY_PGRP m2_i3 /* message parameter: process group */
/* Names of messages fields used in reply messages from tasks. */
#define REP_PROC_NR m2_i1 /* # of proc on whose behalf I/O was done */
#define REP_STATUS m2_i2 /* bytes transferred or error number */
/* Names of fields for copy message to SYSTASK. */
#define SRC_SPACE m5_c1 /* T or D space (stack is also D) */
#define SRC_PROC_NR m5_i1 /* process to copy from */
#define SRC_BUFFER m5_l1 /* virtual address where data come from */
#define DST_SPACE m5_c2 /* T or D space (stack is also D) */
#define DST_PROC_NR m5_i2 /* process to copy to */
#define DST_BUFFER m5_l2 /* virtual address where data go to */
#define COPY_BYTES m5_l3 /* number of bytes to copy */
/* Field names for accounting, SYSTASK and miscellaneous. */
#define USER_TIME m4_l1 /* user time consumed by process */
#define SYSTEM_TIME m4_l2 /* system time consumed by process */
#define CHILD_UTIME m4_l3 /* user time consumed by process' children */
#define CHILD_STIME m4_l4 /* sys time consumed by process' children */
#define PROC1 m1_i1 /* indicates a process */
#define PROC2 m1_i2 /* indicates a process */
#define PID m1_i3 /* process id passed from MM to kernel */
#define STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
#define PR m6_i1 /* process number for sys_sig */
#define SIGNUM m6_i2 /* signal number for sys_sig */
#define FUNC m6_f1 /* function pointer for sys_sig */
#define MEM_PTR m1_p1 /* tells where memory map is for sys_newmap */
#define CANCEL 0 /* general request to force a task to cancel */
#define SIG_MAP m1_i2 /* used by kernel for passing signal bit map */
#ifdef AMOEBA
/* Names of message fields for amoeba tasks */
#define AM_OP m2_i1 /* one of the above operators */
#define AM_PROC_NR m2_i2 /* process # of proc doing operation */
#define AM_COUNT m2_i3 /* size of buffer for operation */
#define AM_ADDRESS m2_p1 /* address of buffer for operation */
/* For communication between MM and AMOEBA_CLASS kernel tasks */
#define AM_STATUS m2_i3 /* same use as REP_STATUS but for amoeba */
#define AM_FREE_IT m2_l1 /* 1=not a getreq, 0=is a getreq */
/* Special for passing a physical address from the ethernet driver */
#define AM_PADDR m2_l1 /* to the transaction layer */
#endif /* AMOEBA */
#define HARD_INT 2 /* fcn code for all hardware interrupts */

View File

@@ -0,0 +1,111 @@
/* This file sets configuration parameters for the MINIX kernel, FS, and MM.
* It is divided up into two main sections. The first section contains
* user-settable parameters. In the second section, various internal system
* parameters are set based on the user-settable parameters.
*/
/*===========================================================================*
* This section contains user-settable parameters *
*===========================================================================*/
/* MACHINE must be set to one of the machine types list below. */
#define MACHINE IBM_PC /* Must be one of the names listed below */
#define IBM_PC 1 /* any 8088 or 80286-based system */
#define IBM_386 3 /* any 80386-based system, IBM or clone */
#define IBM_486 4 /* any 80486-based system, IBM or clone */
#define IBM_586 5 /* any 80586-based system, IBM or clone */
#define PS2_30 23 /* IBM PS/2 model 30 (8086) */
#define PS2_50 25 /* IBM PS/2 model 50 or 60 (80286) */
#define PS2_70 27 /* IBM PS/2 model 70 or 80 (80386) */
#define SUN_4 40 /* any SUN SPARC-based system */
#define ATARI 60 /* ATARI ST (68000) */
#define AMIGA 61 /* Commodore Amiga (68000) */
#define MACINTOSH 62 /* Apple Macintosh (68000) */
/* If ROBUST is set to 1, writes of i-node, directory, and indirect blocks
* from the cache happen as soon as the blocks are modified. This gives a more
* robust, but slower, file system. If it is set to 0, these blocks are not
* given any special treatment, which may cause problems if the system crashes.
*/
#define ROBUST 0 /* 0 for speed, 1 for robustness */
/* If HAVE_SCATTERED_IO is set to 1, scattered I/O is enabled. */
/* DEBUG - 1.4b will always use this. */
#define HAVE_SCATTERED_IO 1
/* The buffer cache should be made as large as you can afford. */
#if INTEL_32BITS
#define NR_BUFS 320 /* # blocks in the buffer cache */
#define NR_BUF_HASH 512 /* size of buf hash table; MUST BE POWER OF 2*/
#else
#define NR_BUFS 30 /* # blocks in the buffer cache */
#define NR_BUF_HASH 32 /* size of buf hash table; MUST BE POWER OF 2*/
#endif
/* Defines for kernel configuration. */
#define AUTO_BIOS 0 /* xt_wini.c - use Western's autoconfig BIOS */
#define C_RS232_INT_HANDLERS 0 /* rs232.c - use slower C int handlers */
#define DEFAULT_CLASS 0 /* floppy.c - 3 or 5 to get only that size */
#define LINEWRAP 0 /* console.c - wrap lines at column 80 */
#define NO_HANDSHAKE 0 /* rs232.c - don't use CTS/RTS handshaking */
#define STUPID_WINI_ADJUST 0 /* *wini.c - skip odd 1st sector of partition*/
/* These configuration defines control debugging and unfinished code. */
#define FLOPPY_TIMING 0 /* floppy.c - for fine tuning floppy driver */
#define MONITOR 0 /* xt_wini.c - monitor loop in w_wait_int */
#define RECORD_FLOPPY_SKEW 0 /* floppy.c - for deciding nr_sectors */
/* These configuration defines control worthless code. */
#define SPARE_VIDEO_MEMORY 0 /* misc.c - use memory from any 2nd vid card */
#define SPLIMITS 0 /* mpx*.x - set stack limits (never checked) */
/*===========================================================================*
* There are no user-settable parameters after this line *
*===========================================================================*/
/* Set the CHIP type based on the machine selected. The symbol CHIP is actually
* indicative of more than just the CPU. For example, machines for which
* CHIP == INTEL are expected to have 8259A interrrupt controllers and the
* other properties of IBM PC/XT/AT/386 types machines in general. */
#define INTEL 1 /* CHIP type for PC, XT, AT, 386 and clones */
#define M68000 2 /* CHIP type for Atari, Amiga, Macintosh */
#define SPARC 3 /* CHIP type for SUN-4 (e.g. SPARCstation) */
#if MACHINE <= PS2_70
#define CHIP INTEL
#endif
#if (MACHINE == ATARI) | (MACHINE == AMIGA) | (MACHINE == MACINTOSH)
#define CHIP M68000
#endif
#if (MACHINE == SUN_4)
#define CHIP SPARC
#endif
#if MACHINE == ATARI
#define ASKDEV 1 /* ask for boot device */
#define FASTLOAD 1 /* use multiple block transfers to init ram */
#endif
/* The file buf.h uses MAYBE_WRITE_IMMED. */
#if ROBUST
#define MAYBE_WRITE_IMMED WRITE_IMMED /* slower but perhaps safer */
#else
#define MAYBE_WRITE_IMMED 0 /* faster */
#endif
#ifndef MACHINE
#error "In <minix/config.h> please define MACHINE"
#endif
#ifndef CHIP
#error "In <minix/config.h> please define MACHINE to have a legal value"
#endif
#if (MACHINE == 0)
#error "MACHINE has incorrect value (0)"
#endif

View File

@@ -0,0 +1,88 @@
/* Copyright (C) 1990 by Prentice-Hall, Inc. Permission is hereby granted
* to redistribute the binary and source programs of this system for
* educational or research purposes. For other use, written permission from
* Prentice-Hall is required.
*/
#define EXTERN extern /* used in *.h files */
#define PRIVATE static /* PRIVATE x limits the scope of x */
#define PUBLIC /* PUBLIC is the opposite of PRIVATE */
#define FORWARD static /* some compilers require this to be 'static'*/
#define TRUE 1 /* used for turning integers into Booleans */
#define FALSE 0 /* used for turning integers into Booleans */
#define HZ 60 /* clock freq (software settable on IBM-PC) */
#define BLOCK_SIZE 1024 /* # bytes in a disk block */
#define SUPER_USER (uid_t) 0 /* uid_t of superuser */
#define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
#define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
#ifdef AM_KERNEL
#define NR_TASKS 14 /* must be 5 more than without amoeba */
#else
#define NR_TASKS 9 /* number of tasks in the transfer vector */
#endif
#define NR_PROCS 32 /* number of slots in proc table */
#define NR_SEGS 3 /* # segments per process */
#define T 0 /* proc[i].mem_map[T] is for text */
#define D 1 /* proc[i].mem_map[D] is for data */
#define S 2 /* proc[i].mem_map[S] is for stack */
#define MAX_P_LONG 2147483647 /* maximum positive long, i.e. 2**31 - 1 */
/* Memory is allocated in clicks. */
#if (CHIP == INTEL) || (CHIP == M68000)
#define CLICK_SIZE 256 /* unit in which memory is allocated */
#define CLICK_SHIFT 8 /* log2 of CLICK_SIZE */
#endif
#define click_to_round_k(n) \
((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
#if CLICK_SIZE < 1024
#define k_to_click(n) ((n) * (1024 / CLICK_SIZE))
#else
#define k_to_click(n) ((n) / (CLICK_SIZE / 1024))
#endif
/* Process numbers of some important processes */
#define MM_PROC_NR 0 /* process number of memory manager */
#define FS_PROC_NR 1 /* process number of file system */
#define INIT_PROC_NR 2 /* init -- the process that goes multiuser */
#define LOW_USER 2 /* first user not part of operating system */
/* Miscellaneous */
#define BYTE 0377 /* mask for 8 bits */
#define TO_USER 0 /* flag telling to copy from fs to user */
#define FROM_USER 1 /* flag telling to copy from user to fs */
#define READING 0 /* copy data to user */
#define WRITING 1 /* copy data from user */
#if (MACHINE != ATARI)
#define ABS -999 /* this process means absolute memory */
#endif
#define WORD_SIZE 2 /* number of bytes per word */
#define NIL_PTR (char *) 0 /* generally useful expression */
#define NO_NUM 0x8000 /* used as numerical argument to panic() */
#define SIG_PUSH_BYTES (4*sizeof(int)) /* how many bytes pushed by signal */
/* Flag bits for i_mode in the inode. */
#define I_TYPE 0170000 /* this field gives inode type */
#define I_REGULAR 0100000 /* regular file, not dir or special */
#define I_BLOCK_SPECIAL 0060000 /* block special file */
#define I_DIRECTORY 0040000 /* file is a directory */
#define I_CHAR_SPECIAL 0020000 /* character special file */
#define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */
#define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */
#define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */
#define ALL_MODES 0006777 /* all bits for user, group and others */
#define RWX_MODES 0000777 /* mode bits for RWX only */
#define R_BIT 0000004 /* Rwx protection bit */
#define W_BIT 0000002 /* rWx protection bit */
#define X_BIT 0000001 /* rwX protection bit */
#define I_NOT_ALLOC 0000000 /* this inode is free */

View File

@@ -0,0 +1,17 @@
/* PC (and AT) BIOS structure to hold disk parameters. Under Minix, it is
* used mainly for formatting.
*/
struct disk_parameter_s {
char spec1;
char spec2;
char motor_turnoff_sec;
char sector_size_code;
char sectors_per_cylinder;
char gap_length;
char dtl;
char gap_length_for_format;
char fill_byte_for_format;
char head_settle_msec;
char motor_start_eigth_sec;
};

View File

@@ -0,0 +1,68 @@
#ifndef _MINIX_ERRNO_H
#define _MINIX_ERRNO_H /* it is not included; note that fact */
#define OK 0
extern int errno; /* place where the error numbers go */
/* Here are the numerical values of the error numbers. */
#define ERROR (-99) /* generic error */
#define EPERM (- 1) /* operation not permitted */
#define ENOENT (- 2) /* no such file or directory */
#define ESRCH (- 3) /* no such process */
#define EINTR (- 4) /* interrupted function call */
#define EIO (- 5) /* input/output error */
#define ENXIO (- 6) /* no such device or address */
#define E2BIG (- 7) /* arg list too long */
#define ENOEXEC (- 8) /* exec format error */
#define EBADF (- 9) /* bad file descriptor */
#define ECHILD (-10) /* no child process */
#define EAGAIN (-11) /* resource temporarily unavailable */
#define ENOMEM (-12) /* not enough space */
#define EACCES (-13) /* permission denied */
#define EFAULT (-14) /* bad address */
#define ENOTBLK (-15) /* Extension: not a block special file */
#define EBUSY (-16) /* resource busy */
#define EEXIST (-17) /* file exists */
#define EXDEV (-18) /* improper link */
#define ENODEV (-19) /* no such device */
#define ENOTDIR (-20) /* not a directory */
#define EISDIR (-21) /* is a directory */
#define EINVAL (-22) /* invalid argument */
#define ENFILE (-23) /* too many open files in system */
#define EMFILE (-24) /* too many open files */
#define ENOTTY (-25) /* inappropriate I/O control operation */
#define ETXTBSY (-26) /* no longer used */
#define EFBIG (-27) /* file too large */
#define ENOSPC (-28) /* no space left on device */
#define ESPIPE (-29) /* invalid seek */
#define EROFS (-30) /* read-only file system */
#define EMLINK (-31) /* too many links */
#define EPIPE (-32) /* broken pipe */
#define EDOM (-33) /* domain error (from ANSI C std) */
#define ERANGE (-34) /* result too large (from ANSI C std) */
#define EDEADLK (-35) /* resource deadlock avoided */
#define ENAMETOOLONG (-36) /* file name too long */
#define ENOLCK (-37) /* no locks available */
#define ENOSYS (-38) /* function not implemented */
#define ENOTEMPTY (-39) /* directory not empty */
/* The following are not POSIX errors, but they can still happen. */
#define ELOCKED (-101) /* can't send message */
#define EBADCALL (-102) /* error on send/receive */
#define ELONGSTRING (-103) /* string too long */
/* The following error codes are generated by the kernel itself. */
#define E_BAD_DEST -1 /* destination address illegal */
#define E_BAD_SRC -2 /* source address illegal */
#define E_TRY_AGAIN -3 /* can't send-- tables full */
#define E_OVERRUN -4 /* interrupt for task that is not waiting */
#define E_BAD_BUF -5 /* message buf outside caller's addr space */
#define E_TASK -6 /* can't send to task */
#define E_NO_MESSAGE -7 /* RECEIVE failed: no message present */
#define E_NO_PERM -8 /* ordinary users can't send to tasks */
#define E_BAD_FCN -9 /* only valid fcns are SEND, RECEIVE, BOTH */
#define E_BAD_ADDR -10 /* bad address given to utility routine */
#define E_BAD_PROC -11 /* bad proc number given to utility */
#endif /* _MINIX_ERRNO_H */

View File

@@ -0,0 +1,22 @@
/* Description of entry in partition table. */
struct part_entry {
unsigned char bootind; /* boot indicator 0/ACTIVE_FLAG */
unsigned char start_head; /* head value for first sector */
unsigned char start_sec; /* sector value + cyl bits for first sector */
unsigned char start_cyl; /* track value for first sector */
unsigned char sysind; /* system indicator - see systype() */
unsigned char last_head; /* head value for last sector */
unsigned char last_sec; /* sector value + cyl bits for last sector */
unsigned char last_cyl; /* track value for last sector */
unsigned long lowsec; /* logical first sector */
unsigned long size; /* size of partion in sectors */
};
#define ACTIVE_FLAG 0x80 /* value for active in bootind field (hd0) */
#define NR_PARTITIONS 4 /* number of entries in partition table */
#define PART_TABLE_OFF 0x1BE /* offset of partition table in boot sector */
/* Partition types. */
#define MINIX_PART 0x81
#define NO_PART 0x00
#define OLD_MINIX_PART 0x80 /* created before 1.4b, driver must round */

View File

@@ -0,0 +1,129 @@
/* Macros */
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
/* Type definitions */
typedef unsigned short unshort; /* must be 16-bit unsigned */
typedef unshort block_nr; /* block number */
#define NO_BLOCK (block_nr) 0 /* indicates the absence of a block number */
#define MAX_BLOCK_NR (block_nr) 0177777
#define NO_ENTRY (ino_t) 0 /* indicates the absence of a dir entry */
#define MAX_INODE_NR (ino_t) 0177777
typedef unshort zone_nr; /* zone number */
#define NO_ZONE (zone_nr) 0 /* indicates the absence of a zone number */
#define HIGHEST_ZONE (zone_nr) 0177777
typedef unshort bit_nr; /* if ino_t & zone_nr both unshort,
then also unshort, else long */
typedef long zone_type; /* zone size */
#define NO_DEV (dev_t) ~0 /* indicates absence of a device number */
#define MAX_FILE_POS 017777777777L
#if (CHIP == INTEL)
typedef unsigned vir_bytes; /* virtual addresses and lengths in bytes */
#endif
#if (CHIP == M68000)
typedef long vir_bytes; /* virtual addresses and lengths in bytes */
#endif
typedef unsigned vir_clicks; /* virtual addresses and lengths in clicks */
typedef long phys_bytes; /* physical addresses and lengths in bytes */
typedef unsigned phys_clicks; /* physical addresses and lengths in clicks */
typedef int signed_clicks; /* same length as phys_clicks, but signed */
/* Types relating to messages. */
#define M1 1
#define M3 3
#define M4 4
#define M3_STRING 14
typedef struct {int m1i1, m1i2, m1i3; char *m1p1, *m1p2, *m1p3;} mess_1;
typedef struct {int m2i1, m2i2, m2i3; long m2l1, m2l2; char *m2p1;} mess_2;
typedef struct {int m3i1, m3i2; char *m3p1; char m3ca1[M3_STRING];} mess_3;
typedef struct {long m4l1, m4l2, m4l3, m4l4;} mess_4;
typedef struct {char m5c1, m5c2; int m5i1, m5i2; long m5l1, m5l2, m5l3;} mess_5;
typedef struct {int m6i1, m6i2, m6i3; long m6l1; void (*m6f1)();} mess_6;
typedef struct {
int m_source; /* who sent the message */
int m_type; /* what kind of message is it */
union {
mess_1 m_m1;
mess_2 m_m2;
mess_3 m_m3;
mess_4 m_m4;
mess_5 m_m5;
mess_6 m_m6;
} m_u;
} message;
#define MESS_SIZE (sizeof(message))
#define NIL_MESS (message *) 0
/* The following defines provide names for useful members. */
#define m1_i1 m_u.m_m1.m1i1
#define m1_i2 m_u.m_m1.m1i2
#define m1_i3 m_u.m_m1.m1i3
#define m1_p1 m_u.m_m1.m1p1
#define m1_p2 m_u.m_m1.m1p2
#define m1_p3 m_u.m_m1.m1p3
#define m2_i1 m_u.m_m2.m2i1
#define m2_i2 m_u.m_m2.m2i2
#define m2_i3 m_u.m_m2.m2i3
#define m2_l1 m_u.m_m2.m2l1
#define m2_l2 m_u.m_m2.m2l2
#define m2_p1 m_u.m_m2.m2p1
#define m3_i1 m_u.m_m3.m3i1
#define m3_i2 m_u.m_m3.m3i2
#define m3_p1 m_u.m_m3.m3p1
#define m3_ca1 m_u.m_m3.m3ca1
#define m4_l1 m_u.m_m4.m4l1
#define m4_l2 m_u.m_m4.m4l2
#define m4_l3 m_u.m_m4.m4l3
#define m4_l4 m_u.m_m4.m4l4
#define m5_c1 m_u.m_m5.m5c1
#define m5_c2 m_u.m_m5.m5c2
#define m5_i1 m_u.m_m5.m5i1
#define m5_i2 m_u.m_m5.m5i2
#define m5_l1 m_u.m_m5.m5l1
#define m5_l2 m_u.m_m5.m5l2
#define m5_l3 m_u.m_m5.m5l3
#define m6_i1 m_u.m_m6.m6i1
#define m6_i2 m_u.m_m6.m6i2
#define m6_i3 m_u.m_m6.m6i3
#define m6_l1 m_u.m_m6.m6l1
#define m6_f1 m_u.m_m6.m6f1
struct mem_map {
vir_clicks mem_vir; /* virtual address */
phys_clicks mem_phys; /* physical address */
vir_clicks mem_len; /* length */
};
struct copy_info { /* used by sys_copy(src, dst, bytes) */
int cp_src_proc;
int cp_src_space;
vir_bytes cp_src_vir;
int cp_dst_proc;
int cp_dst_space;
vir_bytes cp_dst_vir;
vir_bytes cp_bytes;
};
struct iorequest_s {
long io_position; /* position in device file (really off_t) */
char *io_buf; /* buffer in user space */
unsigned short io_nbytes; /* size of request */
unsigned short io_request; /* read, write (optionally) */
};

View File

@@ -0,0 +1,30 @@
/* The <pwd.h> header defines the items in the password file. */
#ifndef _PWD_H
#define _PWD_H
struct passwd {
char *pw_name; /* login name */
uid_t pw_uid; /* uid corresponding to the name */
gid_t pw_gid; /* gid corresponding to the name */
char *pw_dir; /* user's home directory */
char *pw_shell; /* name of the user's shell */
/* The following members are not defined by POSIX. */
char *pw_passwd; /* password information */
char *pw_gecos; /* just in case you have a GE 645 around */
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( void endpwent, (void) );
_PROTOTYPE( struct passwd *getpwnam, (char *_name) );
_PROTOTYPE( struct passwd *getpwuid, (int _uid) );
_PROTOTYPE( struct passwd *getpwent, (void) );
_PROTOTYPE( int setpwent, (void) );
#endif /* _PWD_H */

View File

@@ -0,0 +1,28 @@
/* The <regexp.h> header is used by the (V8-compatible) regexp(3) routines. */
#ifndef _REGEXP_H
#define _REGEXP_H
#define CHARBITS 0377
#define NSUBEXP 10
typedef struct regexp {
char *startp[NSUBEXP];
char *endp[NSUBEXP];
char regstart; /* Internal use only. */
char reganch; /* Internal use only. */
char *regmust; /* Internal use only. */
int regmlen; /* Internal use only. */
char program[1]; /* Unwarranted chumminess with compiler. */
} regexp;
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( regexp *regcomp, (char *_exp) );
_PROTOTYPE( int regexec, (regexp *_prog, char *_string, int _bolflag) );
_PROTOTYPE( void regsub, (regexp *_prog, char *_source, char *_dest) );
_PROTOTYPE( void regerror, (char *_message) );
#endif /* _REGEXP_H */

View File

@@ -0,0 +1,35 @@
/* The <setjmp.h> header relates to the C phenomenon known as setjmp/longjmp.
* It is used to escape out of the current situation into a previous one.
* A typical example is in an editor, where hitting DEL breaks off the current
* command and puts the editor back in the main loop.
*/
/* In a jmp_buf, there is room for: 1 mask (long), 1 flag (int) and 3
* pointers (stack-pointer, local base and program-counter). This may be
* too big, but that doesn't matter. It could also be too small, when
* sigset_t is larger than a long. Soit.
* The identifier __setjmp has a special meaning to the compiler.
*/
#ifndef _SETJMP_H
#define _SETJMP_H
#ifndef _ANSI_H
#include <ansi.h>
#endif
typedef char jmp_buf[ sizeof(long) + sizeof(int) + 3 * sizeof(void *)];
_PROTOTYPE(int __setjmp, (jmp_buf _env, int _savemask) );
#define setjmp(env) __setjmp(env, 0)
_PROTOTYPE(void longjmp, (jmp_buf _env, int _val) );
#ifdef _POSIX_SOURCE
typedef jmp_buf sigjmp_buf;
#define sigsetjmp(env, savemask) __setjmp(env, savemask)
_PROTOTYPE(int siglongjmp, (sigjmp_buf _env, int _val) );
#endif
#endif /* _SETJMP_H */

View File

@@ -0,0 +1,96 @@
/* The <sgtty.h> header contains data structures for ioctl(). */
#ifndef _SGTTY_H
#define _SGTTY_H
struct sgttyb {
char sg_ispeed; /* input speed */
char sg_ospeed; /* output speed */
char sg_erase; /* erase character */
char sg_kill; /* kill character */
int sg_flags; /* mode flags */
};
struct tchars {
char t_intrc; /* SIGINT char */
char t_quitc; /* SIGQUIT char */
char t_startc; /* start output (initially CTRL-Q) */
char t_stopc; /* stop output (initially CTRL-S) */
char t_eofc; /* EOF (initially CTRL-D) */
char t_brkc; /* input delimiter (like nl) */
};
/* Field names */
#define XTABS 0006000 /* do tab expansion */
#define BITS8 0001400 /* 8 bits/char */
#define BITS7 0001000 /* 7 bits/char */
#define BITS6 0000400 /* 6 bits/char */
#define BITS5 0000000 /* 5 bits/char */
#define EVENP 0000200 /* even parity */
#define ODDP 0000100 /* odd parity */
#define RAW 0000040 /* enable raw mode */
#define CRMOD 0000020 /* map lf to cr + lf */
#define ECHO 0000010 /* echo input */
#define CBREAK 0000002 /* enable cbreak mode */
#define COOKED 0000000 /* neither CBREAK nor RAW */
#define DCD 0100000 /* Data Carrier Detect */
/* Line speeds */
#define B0 0 /* code for line-hangup */
#define B110 1
#define B300 3
#define B1200 12
#define B2400 24
#define B4800 48
#define B9600 96
#define TIOCGETP (('t'<<8) | 8)
#define TIOCSETP (('t'<<8) | 9)
#define TIOCGETC (('t'<<8) | 18)
#define TIOCSETC (('t'<<8) | 17)
#define TIOCFLUSH (('t'<<8) | 16)
/* Things Minix supports but not properly */
/* the divide-by-100 encoding ain't too hot */
#define ANYP 0000300
#define B50 0
#define B75 0
#define B134 0
#define B150 0
#define B200 2
#define B600 6
#define B1800 18
#define B3600 36
#define B7200 72
#define EXTA 192
#define EXTB 0
/* Things Minix doesn't support but are fairly harmless if used */
#define NLDELAY 0001400
#define TBDELAY 0006000
#define CRDELAY 0030000
#define VTDELAY 0040000
#define BSDELAY 0100000
#define ALLDELAY 0177400
#if MACHINE == ATARI
/* ST specific clock stuff */
#define DCLOCK ('D'<<8)
#define DC_RBMS100 (DCLOCK|1)
#define DC_RBMS200 (DCLOCK|2)
#define DC_RSUPRA (DCLOCK|3)
#define DC_RICD (DCLOCK|4)
#define DC_WBMS100 (DCLOCK|8)
#define DC_WBMS200 (DCLOCK|9)
#endif
#include <ansi.h>
_PROTOTYPE( int gtty, (int _fd, struct sgttyb *_argp) );
_PROTOTYPE( int ioctl, (int _fd, int _request, struct sgttyb *_argp) );
_PROTOTYPE( int stty, (int _fd, struct sgttyb *_argp) );
#endif /* _SGTTY_H */

View File

@@ -0,0 +1,97 @@
/* The <sgtty.h> header contains data structures for ioctl(). */
#ifndef _SGTTY_H
#define _SGTTY_H
struct sgttyb {
char sg_ispeed; /* input speed */
char sg_ospeed; /* output speed */
char sg_erase; /* erase character */
char sg_kill; /* kill character */
int sg_flags; /* mode flags */
};
struct tchars {
char t_intrc; /* SIGINT char */
char t_quitc; /* SIGQUIT char */
char t_startc; /* start output (initially CTRL-Q) */
char t_stopc; /* stop output (initially CTRL-S) */
char t_eofc; /* EOF (initially CTRL-D) */
char t_brkc; /* input delimiter (like nl) */
};
/* Field names */
#define XTABS 0006000 /* do tab expansion */
#define BITS8 0001400 /* 8 bits/char */
#define BITS7 0001000 /* 7 bits/char */
#define BITS6 0000400 /* 6 bits/char */
#define BITS5 0000000 /* 5 bits/char */
#define EVENP 0000200 /* even parity */
#define ODDP 0000100 /* odd parity */
#define RAW 0000040 /* enable raw mode */
#define CRMOD 0000020 /* map lf to cr + lf */
#define ECHO 0000010 /* echo input */
#define CBREAK 0000002 /* enable cbreak mode */
#define COOKED 0000000 /* neither CBREAK nor RAW */
#define DCD 0100000 /* Data Carrier Detect */
/* Line speeds */
#define B0 0 /* code for line-hangup */
#define B110 1
#define B300 3
#define B1200 12
#define B2400 24
#define B4800 48
#define B9600 96
#define TIOCGETP (('t'<<8) | 8)
#define TIOCSETP (('t'<<8) | 9)
#define TIOCGETC (('t'<<8) | 18)
#define TIOCSETC (('t'<<8) | 17)
#define TIOCFLUSH (('t'<<8) | 16)
/* Things Minix supports but not properly */
/* the divide-by-100 encoding ain't too hot */
#define ANYP 0000300
#define B0 0
#define B50 0
#define B75 0
#define B134 0
#define B150 0
#define B200 2
#define B600 6
#define B1800 18
#define B3600 36
#define B7200 72
#define EXTA 192
#define EXTB 0
/* Things Minix doesn't support but are fairly harmless if used */
#define NLDELAY 0001400
#define TBDELAY 0006000
#define CRDELAY 0030000
#define VTDELAY 0040000
#define BSDELAY 0100000
#define ALLDELAY 0177400
#if MACHINE == ATARI
/* ST specific clock stuff */
#define DCLOCK ('D'<<8)
#define DC_RBMS100 (DCLOCK|1)
#define DC_RBMS200 (DCLOCK|2)
#define DC_RSUPRA (DCLOCK|3)
#define DC_RICD (DCLOCK|4)
#define DC_WBMS100 (DCLOCK|8)
#define DC_WBMS200 (DCLOCK|9)
#endif
#include <ansi.h>
_PROTOTYPE( int gtty, (int _fd, struct sgttyb *_argp) );
_PROTOTYPE( int ioctl, (int _fd, int _request, struct sgttyb *_argp) );
_PROTOTYPE( int stty, (int _fd, struct sgttyb *_argp) );
#endif /* _SGTTY_H */

View File

@@ -0,0 +1,114 @@
/* The <signal.h> header defines all the ANSI and POSIX signals.
* MINIX supports all the signals required by POSIX. They are defined below.
* Some additional signals are also supported.
*/
#ifndef _SIGNAL_H
#define _SIGNAL_H
/* Here are types that are closely associated with signal handling. */
typedef int sig_atomic_t;
#ifdef _POSIX_SOURCE
typedef unsigned short sigset_t;
#endif
#define _NSIG 16 /* number of signals used */
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt (DEL) */
#define SIGQUIT 3 /* quit (ASCII FS) */
#define SIGILL 4 /* illegal instruction */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGABRT 6 /* IOT instruction */
#define SIGIOT 6 /* SIGABRT for people who speak PDP-11 */
#define SIGUNUSED 7 /* spare code */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGUSR1 10 /* user defined signal # 1 */
#define SIGSEGV 11 /* segmentation violation */
#define SIGUSR2 12 /* user defined signal # 2 */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#define SIGSTKFLT 16 /* used by kernel to indicate stack fault */
#define SIGEMT 7 /* obsolete */
#define SIGBUS 10 /* obsolete */
/* POSIX requires the following signals to be defined, even if they are
* not supported. Here are the definitions, but they are not supported.
*/
#define SIGCHLD 17 /* child process terminated or stopped */
#define SIGCONT 18 /* continue if stopped */
#define SIGSTOP 19 /* stop signal */
#define SIGTSTP 20 /* interactive stop signal */
#define SIGTTIN 21 /* background process wants to read */
#define SIGTTOU 22 /* background process wants to write */
#ifdef _POSIX_SOURCE
#define SA_NOCLDSTOP 1 /* signal parent if child stops */
#endif /* _POSIX_SOURCE */
/* POSIX requires these values for use on system calls involving signals. */
#define SIG_BLOCK 0 /* for blocking signals */
#define SIG_UNBLOCK 1 /* for unblocking signals */
#define SIG_SETMASK 2 /* for setting the signal mask */
#ifndef _ANSI_H
#include <ansi.h>
#endif
/* Macros used as function pointers and one awful prototype. */
#if _ANSI
#define SIG_DFL ((void (*)(int))0) /* default signal handling */
#define SIG_IGN ((void (*)(int))1) /* ignore signal */
#define SIG_ERR ((void (*)(int))-1)
void (*signal(int _sig, void (*_func)(int)))(int);
#ifdef _POSIX_SOURCE
struct sigaction {
void (*sa_handler)(int); /* SIG_DFL, SIG_IGN, or pointer to function */
sigset_t sa_mask; /* signals to be blocked during handler */
int sa_flags; /* special flags */
};
#endif
#else /* !_ANSI */
#define SIG_DFL ((void (*)())0) /* default signal handling */
#define SIG_IGN ((void (*)())1) /* ignore signal */
#define SIG_ERR ((void (*)())-1)
void (*signal()) ();
#ifdef _POSIX_SOURCE /* otherwise sigset_t is not defined */
struct sigaction {
void (*sa_handler)(); /* SIG_DFL, SIG_IGN, or pointer to function */
sigset_t sa_mask; /* signals to be blocked during handler */
int sa_flags; /* special flags */
};
#endif
#endif /* _ANSI */
/* Function Prototypes. */
_PROTOTYPE( int raise, (int _sig) );
#ifdef _POSIX_SOURCE
_PROTOTYPE( int kill, (pid_t _pid, int _sig) );
_PROTOTYPE( int sigaddset, (sigset_t *_set) );
_PROTOTYPE( int sigdelset, (sigset_t *_set) );
_PROTOTYPE( int sigemptyset, (sigset_t *_set) );
_PROTOTYPE( int sigfillset, (sigset_t *_set) );
_PROTOTYPE( int sigismember, (sigset_t *_set, int _signo) );
_PROTOTYPE( int sigpending, (sigset_t *set) );
_PROTOTYPE( int sigprocmask, (int _how, sigset_t *_set, sigset_t *_oset));
_PROTOTYPE( int sigsuspend, (sigset_t *_sigmask) );
_PROTOTYPE( int sigaction,
(int _sig, struct sigaction *_a, struct sigaction *_oact) );
#endif
#endif /* _SIGNAL_H */

View File

@@ -0,0 +1,113 @@
/* The <signal.h> header defines all the ANSI and POSIX signals.
* MINIX supports all the signals required by POSIX. They are defined below.
* Some additional signals are also supported.
*/
#ifndef _SIGNAL_H
#define _SIGNAL_H
/* Here are types that are closely associated with signal handling. */
typedef int sig_atomic_t;
#ifdef _POSIX_SOURCE
typedef unsigned short sigset_t;
#endif
#define _NSIG 16 /* number of signals used */
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt (DEL) */
#define SIGQUIT 3 /* quit (ASCII FS) */
#define SIGILL 4 /* illegal instruction */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGABRT 6 /* IOT instruction */
#define SIGIOT 6 /* SIGABRT for people who speak PDP-11 */
#define SIGUNUSED 7 /* spare code */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGUSR1 10 /* user defined signal # 1 */
#define SIGSEGV 11 /* segmentation violation */
#define SIGUSR2 12 /* user defined signal # 2 */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#define SIGSTKFLT 16 /* used by kernel to indicate stack fault */
#define SIGEMT 7 /* obsolete */
#define SIGBUS 10 /* obsolete */
/* POSIX requires the following signals to be defined, even if they are
* not supported. Here are the definitions, but they are not supported.
*/
#define SIGCHLD 17 /* child process terminated or stopped */
#define SIGCONT 18 /* continue if stopped */
#define SIGSTOP 19 /* stop signal */
#define SIGTSTP 20 /* interactive stop signal */
#define SIGTTIN 21 /* background process wants to read */
#define SIGTTOU 22 /* background process wants to write */
#ifdef _POSIX_SOURCE
#define SA_NOCLDSTOP 1 /* signal parent if child stops */
#endif /* _POSIX_SOURCE */
/* POSIX requires these values for use on system calls involving signals. */
#define SIG_BLOCK 0 /* for blocking signals */
#define SIG_UNBLOCK 1 /* for unblocking signals */
#define SIG_SETMASK 2 /* for setting the signal mask */
#ifndef _ANSI_H
#include <ansi.h>
#endif
/* Macros used as function pointers and one awful prototype. */
#if _ANSI
#define SIG_DFL ((void (*)(int))0) /* default signal handling */
#define SIG_IGN ((void (*)(int))1) /* ignore signal */
#define SIG_ERR ((void (*)(int))-1)
void (*signal(int _sig, void (*_func)(int)))(int);
#ifdef _POSIX_SOURCE
struct sigaction {
void (*sa_handler)(int); /* SIG_DFL, SIG_IGN, or pointer to function */
sigset_t sa_mask; /* signals to be blocked during handler */
int sa_flags; /* special flags */
};
#endif
#else /* !_ANSI */
#define SIG_DFL ((void (*)())0) /* default signal handling */
#define SIG_IGN ((void (*)())1) /* ignore signal */
#define SIG_ERR ((void (*)())-1)
void (*signal()) ();
#ifdef _POSIX_SOURCE /* otherwise sigset_t is not defined */
struct sigaction {
void (*sa_handler)(); /* SIG_DFL, SIG_IGN, or pointer to function */
sigset_t sa_mask; /* signals to be blocked during handler */
int sa_flags; /* special flags */
};
#endif
#endif /* _ANSI */
/* Function Prototypes. */
_PROTOTYPE( int raise, (int _sig) );
#ifdef _POSIX_SOURCE
_PROTOTYPE( int kill, (pid_t _pid, int _sig) );
_PROTOTYPE( int sigaddset, (sigset_t *_set) );
_PROTOTYPE( int sigdelset, (sigset_t *_set) );
_PROTOTYPE( int sigemptyset, (sigset_t *_set) );
_PROTOTYPE( int sigfillset, (sigset_t *_set) );
_PROTOTYPE( int sigismember, (sigset_t *_set, int _signo) );
_PROTOTYPE( int sigpending, (sigset_t *set) );
_PROTOTYPE( int sigprocmask, (int _how, sigset_t *_set, sigset_t *_oset));
_PROTOTYPE( int sigsuspend, (sigset_t *_sigmask) );
_PROTOTYPE( int sigaction,
(int _sig, struct sigaction *_a, struct sigaction *_oact) );
#endif
#endif /* _SIGNAL_H */

View File

@@ -0,0 +1,29 @@
/* The <stdarg.h> header is ANSI's way to handle variable numbers of params.
* Some programming languages require a function that is declared with n
* parameters to be called with n parameters. C does not. A function may
* called with more parameters than it is declared with. The well-known
* printf function, for example, may have arbitrarily many parameters.
* The question arises how one can access all the parameters in a portable
* way. The C standard defines three macros that programs can use to
* advance through the parameter list. The definition of these macros for
* MINIX are given in this file. The three macros are:
*
* va_start(ap, parmN) prepare to access parameters
* va_arg(ap, type) get next parameter value and type
* va_end(ap) access is finished
*/
#ifndef _STDARG_H
#define _STDARG_H
typedef char *va_list;
#define __vasz(x) ((sizeof(x)+sizeof(int)-1) & ~(sizeof(int) -1))
#define va_start(ap, parmN) ((ap) = (va_list)&parmN + __vasz(parmN))
#define va_arg(ap, type) \
(*((type *)((va_list)((ap) = (void *)((va_list)(ap) + __vasz(type))) \
- __vasz(type))))
#define va_end(ap)
#endif /* _STDARG_H */

View File

@@ -0,0 +1,23 @@
/* The <stddef.h> header defines certain commonly used macros. */
#ifndef _STDDEF_H
#define _STDDEF_H
#define NULL ((void *)0)
/* The following is not portable, but the compiler accepts it. */
#define offsetof(type, ident) ((size_t) &(((type *)0)->ident))
typedef int ptrdiff_t; /* result of subtracting two pointers */
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif
#ifndef _WCHAR_T
#define _WCHAR_T
typedef char wchar_t; /* type expanded character set */
#endif
#endif /* _STDDEF_H */

View File

@@ -0,0 +1,137 @@
/*
* stdio.h - input/output definitions
*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/* $Header: stdio.h,v 1.3 89/12/18 14:00:10 eck Exp $ */
#ifndef _STDIO_H
#define _STDIO_H
/*
* Focus point of all stdio activity.
*/
typedef struct __iobuf {
int _count;
int _fd;
int _flags;
int _bufsiz;
char *_tname;
unsigned char *_buf;
unsigned char *_ptr;
} FILE;
#define _IOFBF 0x000
#define _IOREAD 0x001
#define _IOWRITE 0x002
#define _IONBF 0x004
#define _IOMYBUF 0x008
#define _IOEOF 0x010
#define _IOERR 0x020
#define _IOLBF 0x040
#define _IOREADING 0x080
#define _IOWRITING 0x100
#define _IOAPPEND 0x200
/* The following definitions are also in <unistd.h>. They should not
* conflict.
*/
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define stdin (&__stdin)
#define stdout (&__stdout)
#define stderr (&__stderr)
#define BUFSIZ 1024
#define NULL ((void *)0)
#define EOF (-1)
#define FOPEN_MAX 20
#define FILENAME_MAX 14
#define TMP_MAX 999
#define L_tmpnam (sizeof("/tmp/") + 15)
typedef long int fpos_t;
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif /* _SIZE_T */
extern FILE *__iotab[FOPEN_MAX];
extern FILE __stdin, __stdout, __stderr;
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( int remove, (const char *_filename) );
_PROTOTYPE( int rename, (const char *_old, const char *_new) );
_PROTOTYPE( FILE *tmpfile, (void) );
_PROTOTYPE( char *tmpnam, (char *_s) );
_PROTOTYPE( int fclose, (FILE *_stream) );
_PROTOTYPE( int fflush, (FILE *_stream) );
_PROTOTYPE( FILE *fopen, (const char *_filename, const char *_mode) );
_PROTOTYPE( FILE *freopen,
(const char *_filename, const char *_mode, FILE *_stream) );
_PROTOTYPE( void setbuf, (FILE *_stream, char *_buf) );
_PROTOTYPE( int setvbuf,
(FILE *_stream, char *_buf, int _mode, size_t _size) );
_PROTOTYPE( int fprintf, (FILE *_stream, const char *_format, ...) );
_PROTOTYPE( int fscanf, (FILE *_stream, const char *_format, ...) );
_PROTOTYPE( int printf, (const char *_format, ...) );
_PROTOTYPE( int scanf, (const char *_format, ...) );
_PROTOTYPE( int sprintf, (char *_s, const char *_format, ...) );
_PROTOTYPE( int sscanf, (char *_s, const char *_format, ...) );
_PROTOTYPE( int vfprintf,
(FILE *_stream, const char *_format, char *_arg) );
_PROTOTYPE( int vprintf, (const char *_format, char *_arg) );
_PROTOTYPE( int vsprintf, (char *_s, const char *_format, char *_arg) );
_PROTOTYPE( int fgetc, (FILE *_stream) );
_PROTOTYPE( char *fgets, (char *_s, int _n, FILE *_stream) );
_PROTOTYPE( int fputc, (int _c, FILE *_stream) );
_PROTOTYPE( int fputs, (const char *_s, FILE *_stream) );
_PROTOTYPE( int getc, (FILE *_stream) );
_PROTOTYPE( int getchar, (void) );
_PROTOTYPE( char *gets, (char *_s) );
_PROTOTYPE( int putc, (int _c, FILE *_stream) );
_PROTOTYPE( int putchar, (int _c) );
_PROTOTYPE( int puts, (const char *_s) );
_PROTOTYPE( int ungetc, (int _c, FILE *_stream) );
_PROTOTYPE( size_t fread,
(void *_ptr, size_t _size, size_t _nmemb, FILE *_stream) );
_PROTOTYPE( size_t fwrite,
(const void *_ptr, size_t _size, size_t _nmemb, FILE *_stream) );
_PROTOTYPE( int fgetpos, (FILE *_stream, fpos_t *_pos) );
_PROTOTYPE( int fseek, (FILE *_stream, long _offset, int _whence) );
_PROTOTYPE( int fsetpos, (FILE *_stream, fpos_t *_pos) );
_PROTOTYPE( long ftell, (FILE *_stream) );
_PROTOTYPE( void rewind, (FILE *_stream) );
_PROTOTYPE( void clearerr, (FILE *_stream) );
_PROTOTYPE( int feof, (FILE *_stream) );
_PROTOTYPE( int ferror, (FILE *_stream) );
_PROTOTYPE( void perror, (const char *_s) );
_PROTOTYPE( int __fillbuf, (FILE *_stream) );
_PROTOTYPE( int __flushbuf, (int _c, FILE *_stream) );
#define getchar() getc(stdin)
#define putchar(c) putc(c,stdout)
#define getc(p) (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \
__fillbuf(p))
#define putc(c, p) (--(p)->_count >= 0 ? \
(int) (*(p)->_ptr++ = (c)) : \
__flushbuf((c),(p)))
#define feof(p) (((p)->_flags & _IOEOF) != 0)
#define ferror(p) (((p)->_flags & _IOERR) != 0)
#ifdef _POSIX_SOURCE
_PROTOTYPE( int fileno, (FILE *_stream) );
#define fileno(stream) ((stream)->_fd)
#endif
#endif /* _STDIO_H */

View File

@@ -0,0 +1,66 @@
/* The <stdlib.h> header defines certain common macros, types, and functions.*/
#ifndef _STDLIB_H
#define _STDLIB_H
/* The macros are NULL, EXIT_FAILURE, EXIT_SUCCESS, RAND_MAX, and MB_CUR_MAX.*/
#define NULL ((void *)0)
#define EXIT_FAILURE 1 /* standard error return using exit() */
#define EXIT_SUCCESS 0 /* successful return using exit() */
#define RAND_MAX 32767 /* largest value generated by rand() */
#define MB_CUR_MAX 1 /* max value of multibyte character in MINIX */
typedef struct { int quot, rem; } div_t;
typedef struct { long quot, rem; } ldiv_t;
/* The types are size_t, wchar_t, div_t, and ldiv_t. */
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif
#ifndef _WCHAR_T
#define _WCHAR_T
typedef char wchar_t; /* type expanded character set */
#endif
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( void abort, (void) );
_PROTOTYPE( int abs, (int _j) );
_PROTOTYPE( int atexit, (void (*func)(void)) );
_PROTOTYPE( double atof, (const char *_nptr) );
_PROTOTYPE( int atoi, (const char *_nptr) );
_PROTOTYPE( long atol, (const char *_nptr) );
_PROTOTYPE( void *calloc, (size_t _nmemb, size_t _size) );
_PROTOTYPE( div_t div, (int _numer, int _denom) );
_PROTOTYPE( void exit, (int _status) );
_PROTOTYPE( void free, (void *_ptr) );
_PROTOTYPE( char *getenv, (const char *_name) );
_PROTOTYPE( long labs, (long _j) );
_PROTOTYPE( ldiv_t ldiv, (long _numer, long _denom) );
_PROTOTYPE( void *malloc, (size_t _size) );
_PROTOTYPE( int mblen, (const char *_s, size_t _n) );
_PROTOTYPE( size_t mbstowcs, (wchar_t *_pwcs, const char *_s, size_t _n));
_PROTOTYPE( int mbtowc, (wchar_t *_pwc, const char *_s, size_t _n) );
_PROTOTYPE( int rand, (void) );
_PROTOTYPE( void *realloc, (void *_ptr, size_t _size) );
_PROTOTYPE( void srand, (unsigned int _seed) );
_PROTOTYPE( double strtod, (const char *_nptr, char **_endptr) );
_PROTOTYPE( long strtol, (const char *_nptr, char **_endptr, int _base) );
_PROTOTYPE( int system, (const char *_string) );
_PROTOTYPE( size_t wcstombs, (char *_s, const wchar_t *_pwcs, size_t _n));
_PROTOTYPE( int wctomb, (char *_s, int _wchar) );
_PROTOTYPE( void *bsearch,
(const void *_key, const void *_base, size_t _nmemb,
size_t _size, int (*_compar) (const void *, const void *)) );
_PROTOTYPE( void qsort, (void *_base, size_t _nmemb, size_t _size,
int (*_compar) (const void *, const void *)) );
_PROTOTYPE( unsigned long int strtoul,
(const char *_nptr, char **_endptr, int _base) );
#endif /* STDLIB_H */

View File

@@ -0,0 +1,55 @@
/* The <string.h> header contains prototypes for the string handling
* functions.
*/
#ifndef _STRING_H
#define _STRING_H
#define NULL ((void *)0)
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( void *memcpy, (void *_s1, const void *_s2, size_t _n) );
_PROTOTYPE( void *memmove, (void *_s1, const void *_s2, size_t _n) );
_PROTOTYPE( char *strcpy, (char *_s1, const char *_s2) );
_PROTOTYPE( char *strncpy, (char *_s1, const char *_s2, size_t _n) );
_PROTOTYPE( char *strcat, (char *_s1, const char *_s2) );
_PROTOTYPE( char *strncat, (char *_s1, const char *_s2, size_t _n) );
_PROTOTYPE( int memcmp, (const void *_s1, const void *_s2, size_t _n) );
_PROTOTYPE( int strcmp, (const char *_s1, const char *_s2) );
_PROTOTYPE( int strcoll, (const char *_s1, const char *_s2) );
_PROTOTYPE( int strncmp, (const char *_s1, const char *_s2, size_t _n) );
_PROTOTYPE( size_t strxfrm, (char *_s1, const char *_s2, size_t _n) );
_PROTOTYPE( void *memchr, (const void *_s, int _c, size_t _n) );
_PROTOTYPE( char *strchr, (const char *_s, int _c) );
_PROTOTYPE( size_t strcspn, (const char *_s1, const char *_s2) );
_PROTOTYPE( char *strpbrk, (const char *_s1, const char *_s2) );
_PROTOTYPE( char *strrchr, (const char *_s, int _c) );
_PROTOTYPE( size_t strspn, (const char *_s1, const char *_s2) );
_PROTOTYPE( char *strstr, (const char *_s1, const char *_s2) );
_PROTOTYPE( char *strtok, (char *_s1, const char *_s2) );
_PROTOTYPE( void *memset, (void *_s, int _c, size_t _n) );
_PROTOTYPE( char *strerror, ( int _errnum) );
_PROTOTYPE( size_t strlen, (const char *_s) );
#ifdef _MINIX
/* For backward compatibility. */
_PROTOTYPE( char *index, (const char *_s, int _charwanted) );
_PROTOTYPE( char *rindex, (const char *_s, int _charwanted) );
_PROTOTYPE( void bcopy, (const char *_src, char *_dst, int _length) );
_PROTOTYPE( int bcmp, (const char *_s1, const char *_s2, int _length) );
_PROTOTYPE( void bzero, (char *_dst, int _length) );
_PROTOTYPE( void *memccpy, (char *_dst, const char *_src, int _ucharstop,
size_t _size) );
#endif
#endif /* _STRING_H */

View File

@@ -0,0 +1,21 @@
/* The <dir.h> header gives the layout of a directory. */
#ifndef _SYS_DIR_H
#define _SYS_DIR_H
#ifndef _SYS_TYPES_H /* not quite right */
#include <sys/types.h>
#endif
#define DIRBLKSIZ 512 /* size of directory block */
#ifndef DIRSIZ
#define DIRSIZ 14
#endif
struct direct {
ino_t d_ino;
char d_name[DIRSIZ];
};
#endif /* _SYS_DIR_H */

View File

@@ -0,0 +1,35 @@
/*
<sys/dirent.h> -- file system independent directory entry (SVR3)
last edit: 25-Apr-1987 D A Gwyn
prerequisite: <sys/types.h>
*/
/* $Header: dirent.h,v 1.2 89/12/18 13:53:00 eck Exp $ */
#if !defined(_SYS_DIRENT_H)
#define _SYS_DIRENT_H
struct dirent /* data from getdents()/readdir() */
{
long d_ino; /* inode number of entry */
off_t d_off; /* offset of disk directory entry */
unsigned short d_reclen; /* length of this record */
char d_name[1]; /* name of file */ /* non-POSIX */
};
/* The following nonportable ugliness could have been avoided by defining
DIRENTSIZ and DIRENTBASESIZ to also have (struct dirent *) arguments. */
#define DIRENTBASESIZ (((struct dirent *)0)->d_name \
- (char *)&((struct dirent *)0)->d_ino)
#define DIRENTSIZ( namlen ) ((DIRENTBASESIZ + sizeof(long) + (namlen)) \
/ sizeof(long) * sizeof(long))
/* DAG -- the following was moved from <dirent.h>, which was the wrong place */
#define MAXNAMLEN 512 /* maximum filename length */
#if !defined(NAME_MAX)
#define NAME_MAX (MAXNAMLEN - 1) /* DAG -- added for POSIX */
#endif
#endif /* _SYS_DIRENT_H */

View File

@@ -0,0 +1,144 @@
/*
* sys/errno.h - error numbers
*/
/* $Header: errno.h,v 1.1 89/12/18 13:50:40 eck Exp $ */
#if !defined(_SYS_ERRNO_H)
#define _SYS_ERRNO_H
#define EPERM 1 /* Not owner */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* I/O error */
#define ENXIO 6 /* No such device or address */
#define E2BIG 7 /* Arg list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No children */
#define EAGAIN 11 /* No more processes */
#define ENOMEM 12 /* Not enough core */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#define ENOTBLK 15 /* Block device required */
#define EBUSY 16 /* Mount device busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory*/
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* File table overflow */
#define EMFILE 24 /* Too many open files */
#define ENOTTY 25 /* Not a typewriter */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
#define EROFS 30 /* Read-only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
#if defined(__USG)
/* Only ENOMSG, EIDRM and EDEADLK are documented */
#define ENOMSG 35 /* No message of desired type */
#define EIDRM 36 /* Identifier Removed */
#define ECHRNG 37 /* Channel number out of range */
#define EL2NSYNC 38 /* Level 2 not synchronized */
#define EL3HLT 39 /* Level 3 halted */
#define EL3RST 40 /* Level 3 reset */
#define ELNRNG 41 /* Link number out of range */
#define EUNATCH 42 /* Protocol driver not attached */
#define ENOCSI 43 /* No CSI structure available */
#define EL2HLT 44 /* Level 2 halted */
#define EDEADLK 45 /* DeadLock */
#endif /* __USG */
#if defined(__BDS4_2)
/* non-blocking and interrupt i/o */
#define EWOULDBLOCK 35 /* Operation would block */
#define EINPROGRESS 36 /* Operation now in progress */
#define EALREADY 37 /* Operation already in progress */
/* ipc/network software */
/* argument errors */
#define ENOTSOCK 38 /* Socket operation on non-socket */
#define EDESTADDRREQ 39 /* Destination address required */
#define EMSGSIZE 40 /* Message too long */
#define EPROTOTYPE 41 /* Protocol wrong type for socket */
#define ENOPROTOOPT 42 /* Protocol not available */
#define EPROTONOSUPPORT 43 /* Protocol not supported */
#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
#define EOPNOTSUPP 45 /* Operation not supported on socket */
#define EPFNOSUPPORT 46 /* Protocol family not supported */
#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
#define EADDRINUSE 48 /* Address already in use */
#define EADDRNOTAVAIL 49 /* Can't assign requested address */
/* operational errors */
#define ENETDOWN 50 /* Network is down */
#define ENETUNREACH 51 /* Network is unreachable */
#define ENETRESET 52 /* Network dropped connection on reset */
#define ECONNABORTED 53 /* Software caused connection abort */
#define ECONNRESET 54 /* Connection reset by peer */
#define ENOBUFS 55 /* No buffer space available */
#define EISCONN 56 /* Socket is already connected */
#define ENOTCONN 57 /* Socket is not connected */
#define ESHUTDOWN 58 /* Can't send after socket shutdown */
/* ETOOMANYREFS is not documented */
#define ETOOMANYREFS 59 /* Too many references: can't splice */
#define ETIMEDOUT 60 /* Connection timed out */
#define ECONNREFUSED 61 /* Connection refused */
/* */
#define ELOOP 62 /* Too many levels of symbolic links */
#define ENAMETOOLONG 63 /* File name too long */
/* In BSD4.2, ENOTEMPTY is defined as 64. */
/* Just use BSD4.3 & Sun UNIX 4.2 definitions */
#define EHOSTDOWN 64 /* Host is down */
#define EHOSTUNREACH 65 /* No route to host */
#define ENOTEMPTY 66 /* Directory not empty */
/* quotas & mush */
/* EPROCLIM and EUSERS are not documented */
#define EPROCLIM 67 /* Too many processes */
#define EUSERS 68 /* Too many users */
#define EDQUOT 69 /* Disc quota exceeded */
/* Network File System */
#define ESTALE 70 /* Stale NFS file handle */
#define EREMOTE 71 /* Too many levels of remote in path */
/* streams */
/* only ENOMSG is documented */
#define ENOSTR 72 /* Device is not a stream */
#define ETIME 73 /* Timer expired */
#define ENOSR 74 /* Out of streams resources */
#define ENOMSG 75 /* No message of desired type */
#define EBADMSG 76 /* Trying to read unreadable message */
#define EIDRM 77 /* Identifier removed */
/* SystemV Record Locking */
#define EDEADLK 78 /* Deadlock condition. */
#define ENOLCK 79 /* No record locks available. */
#endif /* __BSD4_2 */
#if defined(_POSIX_SOURCE)
#if defined(_MINIX)
#define EDEADLK 35 /* resource deadlock avoided */
#define ENAMETOOLONG 36 /* file name too long */
#define ENOLCK 37 /* no locks available */
#define ENOSYS 38 /* function not implemented */
#define ENOTEMPTY 39 /* directory not empty */
#define ELOCKED 101 /* can't send message */
#define EBADCALL 102 /* error on send/recieve */
#define ELONGSTRING 103 /* string too long */
#endif
/* Room for other POSIX implementations */
#endif
#endif /* _SYS_ERRNO_H */

View File

@@ -0,0 +1,75 @@
/* The <sys/stat.h> header defines a struct that is used in the stat() and
* fstat functions. The information in this struct comes from the i-node of
* some file. These calls are the only approved way to inspect i-nodes.
*/
#ifndef _SYS_STAT_H
#define _SYS_STAT_H
#ifndef _SYS_TYPES_H /* not quite right */
#include <sys/types.h>
#endif
struct stat {
dev_t st_dev; /* major/minor device number */
ino_t st_ino; /* i-node number */
mode_t st_mode; /* file mode, protection bits, etc. */
short int st_nlink; /* # links; TEMPORARY HACK: should be nlink_t*/
uid_t st_uid; /* uid of the file's owner */
short int st_gid; /* gid; TEMPORARY HACK: should be gid_t */
dev_t st_rdev;
off_t st_size; /* file size */
time_t st_atime; /* time of last access */
time_t st_mtime; /* time of last data modification */
time_t st_ctime; /* time of last file status change */
};
/* Traditional mask definitions for st_mode. */
#define S_IFMT 0170000 /* type of file */
#define S_IFREG 0100000 /* regular */
#define S_IFBLK 0060000 /* block special */
#define S_IFDIR 0040000 /* directory */
#define S_IFCHR 0020000 /* character special */
#define S_IFIFO 0010000 /* this is a FIFO */
#define S_ISUID 0004000 /* set user id on execution */
#define S_ISGID 0002000 /* set group id on execution */
/* next is reserved for future use */
#define S_ISVTX 01000 /* save swapped text even after use */
/* POSIX masks for st_mode. */
#define S_IRWXU 00700 /* owner: rwx------ */
#define S_IRUSR 00400 /* owner: r-------- */
#define S_IWUSR 00200 /* owner: -w------- */
#define S_IXUSR 00100 /* owner: --x------ */
#define S_IRWXG 00070 /* group: ---rwx--- */
#define S_IRGRP 00040 /* group: ---r----- */
#define S_IWGRP 00020 /* group: ----w---- */
#define S_IXGRP 00010 /* group: -----x--- */
#define S_IRWXO 00007 /* others: ------rwx */
#define S_IROTH 00004 /* others: ------r-- */
#define S_IWOTH 00002 /* others: -------w- */
#define S_IXOTH 00001 /* others: --------x */
/* The following macros test st_mode (from POSIX Sec. 5.6.1.1. */
#define S_ISREG(m) ((m & S_IFMT) == S_IFREG) /* is a reg file */
#define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) /* is a directory */
#define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR) /* is a char spec */
#define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK) /* is a block spec */
#define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO) /* is a pipe/FIFO */
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( int chmod, (const char *_path, int _mode) );
_PROTOTYPE( int fstat, (int _fildes, struct stat *_buf) );
_PROTOTYPE( int mkdir, (const char *_path, int _mode) );
_PROTOTYPE( int mkfifo, (const char *_path, int _mode) );
_PROTOTYPE( int stat , (const char *_path, struct stat *_buf) );
_PROTOTYPE( mode_t umask, (int _cmask) );
#endif /* _SYS_STAT_H */

View File

@@ -0,0 +1,26 @@
/* The <times.h> header is for time times() system call. */
#ifndef _SYS_TIMES_H
#define _SYS_TIMES_H
#ifndef _CLOCK_T
#define _CLOCK_T
typedef long clock_t; /* time in ticks since process started */
#endif
struct tms {
clock_t tms_utime;
clock_t tms_stime;
clock_t tms_cutime;
clock_t tms_cstime;
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( clock_t times, (struct tms *_buffer) );
#endif /* _SYS_TIMES_H */

View File

@@ -0,0 +1,35 @@
/* The <sys/types.h> header contains important data type definitions.
* It is considered good programming practice to use these definitions,
* instead of the underlying base type. By convention, all type names end
* with _t.
*/
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H
/* The type size_t holds the result of the size_of operator. At first glance,
* it seems obvious that it should be an unsigned int, but this is not always
* the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit
* integers. When one asks for the size of a 70K struct or array, the result
* requires 17 bits to express, so size_t must be a long type.
*/
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t; /* type returned by sizeof */
#endif
#ifndef _TIME_T
#define _TIME_T
typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
#endif
typedef unsigned short dev_t; /* holds (major|minor) device pair */
typedef unsigned char gid_t; /* group id */
typedef unsigned short ino_t; /* i-node number */
typedef unsigned short mode_t; /* mode number within an i-node */
typedef unsigned char nlink_t; /* number-of-links field within an i-node */
typedef long off_t; /* offsets within a file */
typedef int pid_t; /* type for pids (must be signed) */
typedef unsigned short uid_t; /* user id */
#endif /* _SYS_TYPES_H */

View File

@@ -0,0 +1,25 @@
/* The <sys/utsname.h> header gives the system name. */
#ifndef _SYS_UTSNAME_H
#define _SYS_UTSNAME_H
#define _UTSLEN (8 + 1)
#define _SNLEN (14 + 1)
struct utsname {
char sysname[_UTSLEN];
char nodename[_UTSLEN];
char release[_UTSLEN];
char version[_UTSLEN];
char machine[_UTSLEN];
char idnumber[_SNLEN];
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( int uname, (struct utsname *_name) );
#endif /* _SYS_UTSNAME_H */

View File

@@ -0,0 +1,44 @@
/* The <sys/wait.h> header contains macros related to wait(). The value
* returned by wait() and waitpid() depends on whether the process
* terminated by an exit() call, was killed by a signal, or was stopped
* due to job control, as follows:
*
* High byte Low byte
* +---------------------+
* exit(status) | status | 0 |
* +---------------------+
* killed by signal | 0 | signal |
* +---------------------+
* stopped (job control) | signal | 0177 |
* +---------------------+
*/
#ifndef _SYS_WAIT_H
#define _SYS_WAIT_H
#ifndef _SYS_TYPES_H /* not quite right */
#include <sys/types.h>
#endif
#define _LOW(v) ( (v) & 0377)
#define _HIGH(v) ( ((v) >> 8) & 0377)
#define WNOHANG 1 /* do not wait for child to exit */
#define WUNTRACED 2 /* for job control; not implemented */
#define WIFEXITED(s) (_LOW(s) == 0) /* normal exit */
#define WEXITSTATUS(s) (_HIGH(s)) /* exit status */
#define WTERMSIG(s) (_LOW(s) & 0177) /* sig value */
#define WIFSIGNALED(s) (((unsigned int)(x)-1 & 0xFFFF) < 0xFF) /* signaled */
#define WIFSTOPPED(s) (_LOW(s) == 0177) /* stopped */
#define WSTOPSIG(s) (_HIGH(s) & 0377) /* stop signal */
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( pid_t wait, (int *stat_loc) );
_PROTOTYPE( pid_t waitpid, (pid_t _pid, int *_stat_loc, int _options) );
#endif /* _SYS_WAIT_H */

View File

@@ -0,0 +1,71 @@
/* The <tar.h> header is used with the tape archiver, tar. */
#ifndef _TAR_H
#define _TAR_H
#define TBLOCK 512
#define NAMSIZ 100
#define PFXSIZ 155
#define TMODLEN 8
#define TUIDLEN 8
#define TGIDLEN 8
#define TSIZLEN 12
#define TMTMLEN 12
#define TCKSLEN 8
#define TMAGIC "ustar"
#define TMAGLEN 6
#define TVERSION "00"
#define TVERSLEN 2
#define TUNMLEN 32
#define TGNMLEN 32
#define TDEVLEN 8
#define REGTYPE '0'
#define AREGTYPE '\0'
#define LNKTYPE '1'
#define SYMTYPE '2'
#define CHRTYPE '3'
#define BLKTYPE '4'
#define DIRTYPE '5'
#define FIFOTYPE '6'
#define CONTTYPE '7'
#define TSUID 04000
#define TSGID 02000
#define TSVTX 01000
#define TUREAD 00400
#define TUWRITE 00200
#define TUEXEC 00100
#define TGREAD 00040
#define TGWRITE 00020
#define TGEXEC 00010
#define TOREAD 00004
#define TOWRITE 00002
#define TOEXEC 00001
union hblock {
char dummy[TBLOCK];
struct header {
char name[NAMSIZ];
char mode[TMODLEN];
char uid[TUIDLEN];
char gid[TGIDLEN];
char size[TSIZLEN];
char mtime[TMTMLEN];
char chksum[TCKSLEN];
char typeflag;
char linkname[NAMSIZ];
char magic[TMAGLEN];
char version[TVERSLEN];
char uname[TUNMLEN];
char gname[TGNMLEN];
char devmajor[TDEVLEN];
char devminor[TDEVLEN];
char prefix[PFXSIZ];
} dbuf;
};
#endif /* _TAR_H */

View File

@@ -0,0 +1,13 @@
#ifndef _TERMCAP_H
#define _TERMCAP_H
#include <ansi.h>
_PROTOTYPE( int tgetent, (char *_bp, char *_name) );
_PROTOTYPE( int tgetflag, (char *_id) );
_PROTOTYPE( int tgetnum, (char *_id) );
_PROTOTYPE( char *tgetstr, (char *_id, char **_area) );
_PROTOTYPE( char *tgoto, (char *_cm, int _destcol, int _destline) );
_PROTOTYPE( int tputs, (char *_cp, int _affcnt, void (*_outc)(int)) );
#endif /* _TERMCAP_H */

View File

@@ -0,0 +1,131 @@
/* The <termios.h> header is used for controlling tty modes. */
#ifndef _TERMIOS_H
#define _TERMIOS_H
typedef unsigned short tcflag_t;
typedef unsigned char cc_t;
typedef unsigned int speed_t;
#define NCCS 11 /* size of cc_c array */
/* Primary terminal control structure. POSIX Table 7-1. */
struct termios {
tcflag_t c_iflag; /* input modes */
tcflag_t c_oflag; /* output modes */
tcflag_t c_cflag; /* control modes */
tcflag_t c_lflag; /* local modes */
speed_t c_ispeed; /* input speed */
speed_t c_ospeed; /* output speed */
cc_t c_cc[NCCS]; /* control characters */
};
/* Values for termios c_iflag bit map. POSIX Table 7-2. */
#define BRKINT 000001 /* signal interrupt on break */
#define ICRNL 000002 /* map CR to NL on input */
#define IGNBRK 000004 /* ignore break */
#define IGNCR 000010 /* ignore CR */
#define IGNPAR 000020 /* ignore characters with parity errors */
#define INLCR 000100 /* map NL to CR on input */
#define INPCK 000200 /* enable input parity check */
#define ISTRIP 000400 /* mask off 8th bit */
#define IXOFF 001000 /* enable start/stop input control */
#define IXON 002000 /* enable start/stop output control */
#define PARMRK 004000 /* mark parity errors in the input queue */
/* Values for termios c_oflag bit map. POSIX Sec. 7.1.2.3. */
#define OPOST 000001 /* perform output processing */
/* Values for termios c_cflag bit map. POSIX Table 7-3. */
#define CLOCAL 000001 /* ignore modem status lines */
#define CREAD 000002 /* enable receiver */
#define CSIZE 000014 /* number of bits per character */
#define CSTOPB 000020 /* send 2 stop bits if set, else 1 */
#define HUPCL 000040 /* hang up on last close */
#define PARENB 000100 /* enable parity on output */
#define PARODD 000200 /* use odd parity if set, else even */
#define CS5 000000 /* if CSIZE is CS5, characters are 5 bits */
#define CS6 000004 /* if CSIZE is CS6, characters are 6 bits */
#define CS7 000010 /* if CSIZE is CS7, characters are 7 bits */
#define CS8 000014 /* if CSIZE is CS8, characters are 8 bits */
/* Values for termios c_lflag bit map. POSIX Table 7-4. */
#define ECHO 000001 /* enable echoing of input characters */
#define ECHOE 000002 /* echo ERASE as backspace */
#define ECHOK 000004 /* echo KILL */
#define ECHONL 000010 /* echo NL */
#define ICANON 000020 /* canonical input (erase and kill enabled) */
#define IEXTEN 000040 /* enable extended functions */
#define ISIG 000100 /* enable signals */
#define NOFLSH 000200 /* disable flush after interrupt or quit */
#define TOSTOP 000400 /* send SIGTTOU (job control, not implemented*/
/* Indices into c_cc array. Default values in parentheses. POSIX Table 7-5. */
#define VEOF 0 /* cc_c[VEOF] = EOF char (CTRL-D) */
#define VEOL 1 /* cc_c[VEOL] = EOL char (??) */
#define VERASE 2 /* cc_c[VERASE] = ERASE char (CTRL-H) */
#define VINTR 3 /* cc_c[VINTR] = INTR char (DEL) */
#define VKILL 4 /* cc_c[VKILL] = KILL char (@) */
#define VMIN 5 /* cc_c[VMIN] = MIN value for timer */
#define VQUIT 6 /* cc_c[VQUIT] = QUIT char (CTRL-\) */
#define VTIME 7 /* cc_c[VTIME] = TIME value for timer */
#define VSUSP 8 /* cc_c[VSUSP] = SUSP (job control, not impl */
#define VSTART 9 /* cc_c[VSTART] = START char (always CTRL-S) */
#define VSTOP 10 /* cc_c[VSTOP] = STOP char (always CTRL-Q) */
/* Values for the baud rate settings. POSIX Table 7-6. */
#define B0 0000000 /* hang up the line */
#define B50 0010000 /* 50 baud */
#define B75 0020000 /* 75 baud */
#define B110 0030000 /* 110 baud */
#define B134 0040000 /* 134.5 baud */
#define B150 0050000 /* 150 baud */
#define B200 0060000 /* 200 baud */
#define B300 0070000 /* 300 baud */
#define B600 0100000 /* 600 baud */
#define B1200 0110000 /* 1200 baud */
#define B1800 0120000 /* 1800 baud */
#define B2400 0130000 /* 2400 baud */
#define B4800 0140000 /* 4800 baud */
#define B9600 0150000 /* 9600 baud */
#define B19200 0160000 /* 19200 baud */
#define B38400 0170000 /* 38400 baud */
/* Optional actions for tcsetattr(). POSIX Sec. 7.2.1.2. */
#define TCSANOW 1 /* changes take effect immediately */
#define TCSADRAIN 2 /* changes take effect after output is done */
#define TCSAFLUSH 3 /* wait for output to finish and flush input */
/* Queue_selector values for tcflush(). POSIX Sec. 7.2.2.2. */
#define TCIFLUSH 1 /* flush accumulated input data */
#define TCOFLUSH 2 /* flush accumulated output data */
#define TCIOFLUSH 3 /* flush accumulated input and output data */
/* Action values for tcflow(). POSIX Sec. 7.2.2.2. */
#define TCOOFF 1 /* suspend output */
#define TCOON 2 /* restart suspended output */
#define TCIOFF 3 /* transmit a STOP character on the line */
#define TCION 4 /* transmit a START character on the line */
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( int tcsendbreak, (int _fildes, int _duration) );
_PROTOTYPE( int tcdrain, (int _filedes) );
_PROTOTYPE( int tcflush, (int _filedes, int _queue_selector) );
_PROTOTYPE( int tcflow, (int _filedes, int _action) );
_PROTOTYPE( speed_t cfgetospeed, (struct termios *_termios_p) );
_PROTOTYPE( speed_t cfsetospeed, \
(struct termios *_termios_p, speed_t _speed) );
_PROTOTYPE( speed_t cfgetispeed, (struct termios *_termios_p) );
_PROTOTYPE( speed_t cfsetispeed, \
(struct termios *_termios_p, speed_t _speed) );
_PROTOTYPE( int tcgetattr, (int _filedes, struct termios *_termios_p) );
_PROTOTYPE( int tcsetattr, \
(int _filedes, int _opt_actions, struct termios *_termios_p) );
#endif /* _TERMIOS_H */

View File

@@ -0,0 +1,67 @@
/* The <time.h> header is used by the procedures that deal with time.
* Handling time is surprisingly complicated, what with GMT, local time
* and other factors. Although the Bishop of Ussher (1581-1656) once
* calculated that based on the Bible, the world began on 12 Oct. 4004 BC
* at 9 o'clock in the morning, in the UNIX world time begins at midnight,
* 1 Jan. 1970 GMT. Before that, all was NULL and (void).
*/
#ifndef _TIME_H
#define _TIME_H
#define CLOCKS_PER_SEC 60 /* MINIX always uses 60 Hz, even in Europe */
#ifdef _POSIX_SOURCE
#define CLK_TCK CLOCKS_PER_SEC /* obsolete name for CLOCKS_PER_SEC */
#endif
#define NULL ((void *)0)
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t;
#endif
#ifndef _TIME_T
#define _TIME_T
typedef unsigned long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
#endif
#ifndef _CLOCK_T
#define _CLOCK_T
typedef unsigned long clock_t; /* time in ticks since process started */
#endif
struct tm {
int tm_sec; /* seconds after the minute [0, 59] */
int tm_min; /* minutes after the hour [0, 59] */
int tm_hour; /* hours since midnight [0, 23] */
int tm_mday; /* day of the month [1, 31] */
int tm_mon; /* months since January [0, 11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday [0, 6] */
int tm_yday; /* days since January 1 [0, 365] */
int tm_isdst; /* Daylight Saving Time flag */
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( clock_t clock, (void) );
_PROTOTYPE( double difftime, (time_t _time1, time_t _time0) );
_PROTOTYPE( time_t mktime, (struct tm *_timeptr) );
_PROTOTYPE( time_t time, (time_t *_timeptr) );
_PROTOTYPE( char *asctime, (const struct tm *_timeptr) );
_PROTOTYPE( char *ctime, (const time_t *_timer) );
_PROTOTYPE( struct tm *gmtime, (const time_t *_timer) );
_PROTOTYPE( struct tm *localtime, (const time_t *_timer) );
_PROTOTYPE( size_t strftime, (char *_s, size_t _max, const char *_fmt,
const struct tm *_timep) );
#ifdef _POSIX_SOURCE
_PROTOTYPE( void tzset, (void) );
#endif
#endif /* _TIME_H */

View File

@@ -0,0 +1,67 @@
/* The <time.h> header is used by the procedures that deal with time.
* Handling time is surprisingly complicated, what with GMT, local time
* and other factors. Although the Bishop of Ussher (1581-1656) once
* calculated that based on the Bible, the world began on 12 Oct. 4004 BC
* at 9 o'clock in the morning, in the UNIX world time begins at midnight,
* 1 Jan. 1970 GMT. Before that, all was NULL and (void).
*/
#ifndef _TIME_H
#define _TIME_H
#define CLOCKS_PER_SEC 60 /* MINIX always uses 60 Hz, even in Europe */
#ifdef _POSIX_SOURCE
#define CLK_TCK CLOCKS_PER_SEC /* obsolete name for CLOCKS_PER_SEC */
#endif
#define NULL ((void *)0)
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t;
#endif
#ifndef _TIME_T
#define _TIME_T
typedef unsigned long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
#endif
#ifndef _CLOCK_T
#define _CLOCK_T
typedef unsigned long clock_t; /* time in ticks since process started */
#endif
struct tm {
int tm_sec; /* seconds after the minute [0, 59] */
int tm_min; /* minutes after the hour [0, 59] */
int tm_hour; /* hours since midnight [0, 23] */
int tm_mday; /* day of the month [1, 31] */
int tm_mon; /* months since January [0, 11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday [0, 6] */
int tm_yday; /* days since January 1 [0, 365] */
int tm_isdst; /* Daylight Saving Time flag */
};
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( clock_t clock, (void) );
_PROTOTYPE( double difftime, (time_t _time1, time_t _time0) );
_PROTOTYPE( time_t mktime, (struct tm *_timeptr) );
_PROTOTYPE( time_t time, (time_t *_timeptr) );
_PROTOTYPE( char *asctime, (const struct tm *_timeptr) );
_PROTOTYPE( char *ctime, (const time_t *_timer) );
_PROTOTYPE( struct tm *gmtime, (const time_t *_timer) );
_PROTOTYPE( struct tm *localtime, (const time_t *_timer) );
_PROTOTYPE( size_t strftime, (char *_s, size_t _max, const char *_fmt,
const struct tm *_timep) );
#ifdef _POSIX_SOURCE
_PROTOTYPE( void tzset, (void) );
#endif
#endif /* _TIME_H */