Initial revision

This commit is contained in:
Ben Gras
2005-04-21 14:53:53 +00:00
commit 9865aeaa79
2264 changed files with 411685 additions and 0 deletions

11
include/Makefile Normal file
View File

@@ -0,0 +1,11 @@
INC=/usr/include
all::
clean::
install::
-rm -rf $(INC)
mkdir $(INC)
tar cf - `find . -name '*.h'` | (cd $(INC) && tar xf -)

118
include/a.out.h Executable file
View File

@@ -0,0 +1,118 @@
/* 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 at present) */
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_entry; /* entry point */
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_SPARC 0x17 /* Sun SPARC */
#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_UZP 0x01 /* unmapped zero page (pages) */
#define A_PAL 0x02 /* page aligned executable */
#define A_NSYM 0x04 /* new style symbol table */
#define A_IMG 0x08 /* image instead of executable (e.g. root FS) */
#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 */
/* Function prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( int nlist, (char *_file, struct nlist *_nl) );
#endif /* _AOUT_H */

24
include/alloca.h Executable file
View File

@@ -0,0 +1,24 @@
/* alloca.h - The dreaded alloca() function.
*/
#ifndef _ALLOCA_H
#define _ALLOCA_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
#if __GNUC__
/* The compiler recognizes this special keyword, and inlines the code. */
#define alloca(size) __builtin_alloca(size)
#endif /* __GCC__ */
#if __ACK__ || __CCC__
_PROTOTYPE(void *alloca, (size_t _size) );
#endif /* __ACK__ || __CCC__ */
#endif /* _ALLOCA_H */

66
include/ansi.h Executable file
View File

@@ -0,0 +1,66 @@
/* The <ansi.h> header attempts to decide whether the compiler has enough
* conformance to Standard C for Minix to take advantage of. If so, the
* symbol _ANSI is defined (as 31415). Otherwise _ANSI is not defined
* here, but it may be defined by applications that want to bend the rules.
* The magic number in the definition is to inhibit unnecessary bending
* of the rules. (For consistency with the new '#ifdef _ANSI" tests in
* the headers, _ANSI should really be defined as nothing, but that would
* break many library routines that use "#if _ANSI".)
* If _ANSI ends up being defined, 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
#if __STDC__ == 1
#define _ANSI 31459 /* compiler claims full ANSI conformance */
#endif
#ifdef __GNUC__
#define _ANSI 31459 /* gcc conforms enough even in non-ANSI mode */
#endif
#ifdef _ANSI
/* Keep everything for ANSI prototypes. */
#define _PROTOTYPE(function, params) function params
#define _ARGS(params) params
#define _VOIDSTAR void *
#define _VOID void
#define _CONST const
#define _VOLATILE volatile
#define _SIZET size_t
#else
/* Throw away the parameters for K&R prototypes. */
#define _PROTOTYPE(function, params) function()
#define _ARGS(params) ()
#define _VOIDSTAR void *
#define _VOID void
#define _CONST
#define _VOLATILE
#define _SIZET int
#endif /* _ANSI */
/* Setting any of _MINIX, _POSIX_C_SOURCE or _POSIX2_SOURCE implies
* _POSIX_SOURCE. (Seems wrong to put this here in ANSI space.)
*/
#if defined(_MINIX) || _POSIX_C_SOURCE > 0 || defined(_POSIX2_SOURCE)
#undef _POSIX_SOURCE
#define _POSIX_SOURCE 1
#endif
#endif /* ANSI_H */

40
include/assert.h Executable file
View File

@@ -0,0 +1,40 @@
/* 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 and the
* program aborts.
* Assertion checking can be disabled by adding the statement
*
* #define NDEBUG
*
* to the program before the
*
* #include <assert.h>
*
* statement.
*/
#undef assert
#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. */
#ifdef _ANSI
#define __str(x) # x
#define __xstr(x) __str(x)
_PROTOTYPE( void __bad_assertion, (const char *_mess) );
#define assert(expr) ((expr)? (void)0 : \
__bad_assertion("Assertion \"" #expr \
"\" failed, file " __xstr(__FILE__) \
", line " __xstr(__LINE__) "\n"))
#else
#define assert(expr) ((void) ((expr) ? 0 : __assert( __FILE__, __LINE__)))
#endif /* _ANSI */
#endif

44
include/configfile.h Executable file
View File

@@ -0,0 +1,44 @@
/* configfile.h - Generic configuration file format.
* Author: Kees J. Bot
* 5 Jun 1999
*/
#ifndef _CONFIGFILE_H
#define _CONFIGFILE_H
/* Data can only be modified inside the library. */
#ifndef _c
#define _c const
#endif
typedef _c struct config { /* Contents of a generic configuration file. */
_c struct config *next; /* Next configuration file thing. */
_c struct config *list; /* For a { sublist }. */
const char *file; /* File and line where this is found. */
unsigned line;
int flags; /* Special flags. */
char word[1]; /* Payload. */
} config_t;
#define CFG_CLONG 0x0001 /* strtol(word, &end, 0) is valid. */
#define CFG_OLONG 0x0002 /* strtol(word, &end, 010). */
#define CFG_DLONG 0x0004 /* strtol(word, &end, 10). */
#define CFG_XLONG 0x0008 /* strtol(word, &end, 0x10). */
#define CFG_CULONG 0x0010 /* strtoul(word, &end, 0). */
#define CFG_OULONG 0x0020 /* strtoul(word, &end, 010). */
#define CFG_DULONG 0x0040 /* strtoul(word, &end, 10). */
#define CFG_XULONG 0x0080 /* strtoul(word, &end, 0x10). */
#define CFG_STRING 0x0100 /* The word is enclosed in quotes. */
#define CFG_SUBLIST 0x0200 /* This is a sublist, so no word. */
#define CFG_ESCAPED 0x0400 /* Escapes are still marked with \. */
config_t *config_read(const char *_file, int flags, config_t *_cfg);
void config_delete(config_t *_cfg);
int config_renewed(config_t *_cfg);
size_t config_length(config_t *_cfg);
#define config_issub(cfg) (!!((cfg)->flags & CFG_SUBLIST))
#define config_isatom(cfg) (!config_issub(cfg))
#define config_isstring(cfg) (!!((cfg)->flags & CFG_STRING))
#undef _c
#endif /* _CONFIGFILE_H */

54
include/ctype.h Executable file
View File

@@ -0,0 +1,54 @@
/* 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
#ifndef _ANSI_H
#include <ansi.h>
#endif
extern char __ctype[]; /* property array 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). */
_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)
#endif /* _CTYPE_H */

226
include/curses.h Executable file
View File

@@ -0,0 +1,226 @@
/* curses.h - defines macros and prototypes for curses */
#ifndef _CURSES_H
#define _CURSES_H
#include <termios.h>
#include <stdarg.h>
#include <stdio.h>
typedef int bool;
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef ERR
#define ERR (-1) /* general error flag */
#endif
#ifndef OK
#define OK 0 /* general OK flag */
#endif
/* Macros. */
#define box(win,vc,hc) wbox(win,0,0,0,0,vc,hc)
#define addch(ch) waddch(stdscr,ch)
#define mvaddch(y,x,ch) (wmove(stdscr,y,x)==ERR?ERR:waddch(stdscr,ch))
#define mvwaddch(win,y,x,ch) (wmove(win,y,x)==ERR?ERR:waddch(win,ch))
#define getch() wgetch(stdscr)
#define mvgetch(y,x) (wmove(stdscr,y,x)==ERR?ERR:wgetch(stdscr))
#define mvwgetch(win,y,x) (wmove(win,y,x)==ERR?ERR:wgetch(win))
#define addstr(str) waddstr(stdscr,str)
#define mvaddstr(y,x,str) (wmove(stdscr,y,x)==ERR?ERR:waddstr(stdscr,str))
#define mvwaddstr(win,y,x,str) (wmove(win,y,x)==ERR?ERR:waddstr(win,str))
#define getstr(str) wgetstr(stdscr,str)
#define mvgetstr(y,x,str) (wmove(stdscr,y,x)==ERR?ERR:wgetstr(stdscr,str))
#define mvwgetstr(win,y,x,str) (wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
#define move(y,x) wmove(stdscr,y,x)
#define clear() wclear(stdscr)
#define erase() werase(stdscr)
#define clrtobot() wclrtobot(stdscr)
#define mvclrtobot(y,x) (wmove(stdscr,y,x)==ERR?ERR:wclrtobot(stdscr))
#define mvwclrtobot(win,y,x) (wmove(win,y,x)==ERR?ERR:wclrtobot(win))
#define clrtoeol() wclrtoeol(stdscr)
#define mvclrtoeol(y,x) (wmove(stdscr,y,x)==ERR?ERR:wclrtoeol(stdscr))
#define mvwclrtoeol(win,y,x) (wmove(win,y,x)==ERR?ERR:wclrtoeol(win))
#define insertln() winsertln(stdscr)
#define mvinsertln(y,x) (wmove(stdscr,y,x)==ERR?ERR:winsertln(stdscr))
#define mvwinsertln(win,y,x) (wmove(win,y,x)==ERR?ERR:winsertln(win))
#define deleteln() wdeleteln(stdscr)
#define mvdeleteln(y,x) (wmove(stdscr,y,x)==ERR?ERR:wdeleteln(stdscr))
#define mvwdeleteln(win,y,x) (wmove(win,y,x)==ERR?ERR:wdeleteln(win))
#define refresh() wrefresh(stdscr)
#define inch() winch(stdscr)
#define insch(ch) winsch(stdscr,ch)
#define mvinsch(y,x,ch) (wmove(stdscr,y,x)==ERR?ERR:winsch(stdscr,ch))
#define mvwinsch(win,y,x,ch) (wmove(win,y,x)==ERR?ERR:winsch(win,ch))
#define delch() wdelch(stdscr)
#define mvdelch(y,x) (wmove(stdscr,y,x)==ERR?ERR:wdelch(stdscr))
#define mvwdelch(win,y,x) (wmove(win,y,x)==ERR?ERR:wdelch(win))
#define standout() wstandout(stdscr)
#define wstandout(win) ((win)->_attrs |= A_STANDOUT)
#define standend() wstandend(stdscr)
#define wstandend(win) ((win)->_attrs &= ~A_STANDOUT)
#define attrset(attrs) wattrset(stdscr, attrs)
#define wattrset(win, attrs) ((win)->_attrs = (attrs))
#define attron(attrs) wattron(stdscr, attrs)
#define wattron(win, attrs) ((win)->_attrs |= (attrs))
#define attroff(attrs) wattroff(stdscr,attrs)
#define wattroff(win, attrs) ((win)->_attrs &= ~(attrs))
#define resetty() tcsetattr(1, TCSANOW, &_orig_tty)
#define getyx(win,y,x) (y = (win)->_cury, x = (win)->_curx)
/* Video attribute definitions. */
#define A_BLINK 0x0100
#define A_BLANK 0
#define A_BOLD 0x0200
#define A_DIM 0
#define A_PROTECT 0
#define A_REVERSE 0x0400
#define A_STANDOUT 0x0800
#define A_UNDERLINE 0x1000
#define A_ALTCHARSET 0x2000
/* Type declarations. */
typedef struct {
int _cury; /* current pseudo-cursor */
int _curx;
int _maxy; /* max coordinates */
int _maxx;
int _begy; /* origin on screen */
int _begx;
int _flags; /* window properties */
int _attrs; /* attributes of written characters */
int _tabsize; /* tab character size */
bool _clear; /* causes clear at next refresh */
bool _leave; /* leaves cursor as it happens */
bool _scroll; /* allows window scrolling */
bool _nodelay; /* input character wait flag */
bool _keypad; /* flags keypad key mode active */
int **_line; /* pointer to line pointer array */
int *_minchng; /* First changed character in line */
int *_maxchng; /* Last changed character in line */
int _regtop; /* Top/bottom of scrolling region */
int _regbottom;
} WINDOW;
/* External variables */
extern int LINES; /* terminal height */
extern int COLS; /* terminal width */
extern bool NONL; /* \n causes CR too ? */
extern WINDOW *curscr; /* the current screen image */
extern WINDOW *stdscr; /* the default screen window */
extern struct termios _orig_tty, _tty;
extern unsigned int ACS_ULCORNER; /* terminal dependent block grafic */
extern unsigned int ACS_LLCORNER; /* charcters. Forget IBM, we are */
extern unsigned int ACS_URCORNER; /* independent of their charset. :-) */
extern unsigned int ACS_LRCORNER;
extern unsigned int ACS_RTEE;
extern unsigned int ACS_LTEE;
extern unsigned int ACS_BTEE;
extern unsigned int ACS_TTEE;
extern unsigned int ACS_HLINE;
extern unsigned int ACS_VLINE;
extern unsigned int ACS_PLUS;
extern unsigned int ACS_S1;
extern unsigned int ACS_S9;
extern unsigned int ACS_DIAMOND;
extern unsigned int ACS_CKBOARD;
extern unsigned int ACS_DEGREE;
extern unsigned int ACS_PLMINUS;
extern unsigned int ACS_BULLET;
extern unsigned int ACS_LARROW;
extern unsigned int ACS_RARROW;
extern unsigned int ACS_DARROW;
extern unsigned int ACS_UARROW;
extern unsigned int ACS_BOARD;
extern unsigned int ACS_LANTERN;
extern unsigned int ACS_BLOCK;
_PROTOTYPE( char *unctrl, (int _c) );
_PROTOTYPE( int baudrate, (void));
_PROTOTYPE( void beep, (void));
_PROTOTYPE( void cbreak, (void));
_PROTOTYPE( void clearok, (WINDOW *_win, bool _flag) );
_PROTOTYPE( void clrscr, (void));
_PROTOTYPE( void curs_set, (int _visibility) );
_PROTOTYPE( void delwin, (WINDOW *_win) );
_PROTOTYPE( void doupdate, (void));
_PROTOTYPE( void echo, (void));
_PROTOTYPE( int endwin, (void));
_PROTOTYPE( int erasechar, (void));
_PROTOTYPE( void fatal, (char *_s) );
_PROTOTYPE( int fixterm, (void));
_PROTOTYPE( void flash, (void));
_PROTOTYPE( void gettmode, (void));
_PROTOTYPE( void idlok, (WINDOW *_win, bool _flag) );
_PROTOTYPE( WINDOW *initscr, (void));
_PROTOTYPE( void keypad, (WINDOW *_win, bool _flag) );
_PROTOTYPE( int killchar, (void));
_PROTOTYPE( void leaveok, (WINDOW *_win, bool _flag) );
_PROTOTYPE( char *longname, (void));
_PROTOTYPE( void meta, (WINDOW *_win, bool _flag) );
_PROTOTYPE( int mvcur, (int _oldy, int _oldx, int _newy, int _newx) );
_PROTOTYPE( int mvinch, (int _y, int _x) );
_PROTOTYPE( int mvprintw, (int _y, int _x, const char *_fmt, ...) );
_PROTOTYPE( int mvscanw, (int _y, int _x, const char *_fmt, ...) );
_PROTOTYPE( int mvwin, (WINDOW *_win, int _begy, int _begx) );
_PROTOTYPE( int mvwinch, (WINDOW *_win, int _y, int _x) );
_PROTOTYPE( int mvwprintw, (WINDOW *_win, int _y, int _x, const char *_fmt,
...) );
_PROTOTYPE( int mvwscanw, (WINDOW *_win, int _y, int _x, const char *_fmt,
...) );
_PROTOTYPE( WINDOW *newwin, (int _num_lines, int _num_cols, int _y, int _x));
_PROTOTYPE( void nl, (void));
_PROTOTYPE( void nocbreak, (void));
_PROTOTYPE( void nodelay, (WINDOW *_win, bool _flag) );
_PROTOTYPE( void noecho, (void));
_PROTOTYPE( void nonl, (void));
_PROTOTYPE( void noraw, (void));
_PROTOTYPE( void outc, (int _c) );
_PROTOTYPE( void overlay, (WINDOW *_win1, WINDOW *_win2) );
_PROTOTYPE( void overwrite, (WINDOW *_win1, WINDOW *_win2) );
_PROTOTYPE( void poscur, (int _r, int _c) );
_PROTOTYPE( int printw, (const char *_fmt, ...) );
_PROTOTYPE( void raw, (void));
_PROTOTYPE( int resetterm, (void));
_PROTOTYPE( int saveoldterm, (void));
_PROTOTYPE( int saveterm, (void));
_PROTOTYPE( int savetty, (void));
_PROTOTYPE( int scanw, (const char *_fmt, ...) );
_PROTOTYPE( void scroll, (WINDOW *_win) );
_PROTOTYPE( void scrollok, (WINDOW *_win, bool _flag) );
_PROTOTYPE( int setscrreg, (int _top, int _bottom) );
_PROTOTYPE( int setterm, (char *_type) );
_PROTOTYPE( int setupterm, (void));
_PROTOTYPE( WINDOW *subwin, (WINDOW *_orig, int _nlines, int _ncols, int _y,
int _x));
_PROTOTYPE( int tabsize, (int _ts) );
_PROTOTYPE( void touchwin, (WINDOW *_win) );
_PROTOTYPE( int waddch, (WINDOW *_win, int _c) );
_PROTOTYPE( int waddstr, (WINDOW *_win, char *_str) );
_PROTOTYPE( int wbox, (WINDOW *_win, int _ymin, int _xmin, int _ymax,
int _xmax, unsigned int _v, unsigned int _h) );
_PROTOTYPE( void wclear, (WINDOW *_win) );
_PROTOTYPE( int wclrtobot, (WINDOW *_win) );
_PROTOTYPE( int wclrtoeol, (WINDOW *_win) );
_PROTOTYPE( int wdelch, (WINDOW *_win) );
_PROTOTYPE( int wdeleteln, (WINDOW *_win) );
_PROTOTYPE( void werase, (WINDOW *_win) );
_PROTOTYPE( int wgetch, (WINDOW *_win) );
_PROTOTYPE( int wgetstr, (WINDOW *_win, char *_str) );
_PROTOTYPE( int winch, (WINDOW *_win) );
_PROTOTYPE( int winsch, (WINDOW *_win, int _c) );
_PROTOTYPE( int winsertln, (WINDOW *_win) );
_PROTOTYPE( int wmove, (WINDOW *_win, int _y, int _x) );
_PROTOTYPE( void wnoutrefresh, (WINDOW *_win) );
_PROTOTYPE( int wprintw, (WINDOW *_win, const char *_fmt, ...));
_PROTOTYPE( void wrefresh, (WINDOW *_win) );
_PROTOTYPE( int wscanw, (WINDOW *_win, const char *_fmt, ...));
_PROTOTYPE( int wsetscrreg, (WINDOW *_win, int _top, int _bottom) );
_PROTOTYPE( int wtabsize, (WINDOW *_win, int _ts) );
#endif /* _CURSES_H */

81
include/dirent.h Executable file
View File

@@ -0,0 +1,81 @@
/* dirent.h - Declarations for directory reading routines.
* Author: Kees J. Bot
* 24 Apr 1989
*
* Note: The V7 format directory entries used under Minix must be transformed
* into a struct dirent with a d_name of at least 15 characters. Given that
* we have to transform V7 entries anyhow it is little trouble to let the
* routines understand the so-called "flex" directory format too.
*/
#ifndef _DIRENT_H
#define _DIRENT_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
#include <sys/dir.h>
/* _fl_direct is a flexible directory entry. Actually it's a union of 8
* characters and the 3 fields defined below.
*/
/* Flexible directory entry: */
struct _fl_direct { /* First slot in an entry */
ino_t d_ino;
unsigned char d_extent;
char d_name[3]; /* two characters for the shortest name */
};
/* Name of length len needs _EXTENT(len) extra slots. */
#define _EXTENT(len) (((len) + 5) >> 3)
/* Version 7 directory entry: */
struct _v7_direct {
ino_t d_ino;
char d_name[DIRSIZ];
};
/* The block size must be at least 1024 bytes, because otherwise
* the superblock (at 1024 bytes) overlaps with other filesystem data.
*/
#define MIN_BLOCK_SIZE 1024
#define MAX_BLOCK_SIZE 8192
/* This is the block size for the fixed versions of the filesystem (V1/V2) */
#define STATIC_BLOCK_SIZE 1024
#define STATIC_FLEX_PER_BLOCK (STATIC_BLOCK_SIZE/sizeof(struct _fl_direct))
#define FLEX_PER_V7 (_EXTENT(DIRSIZ) + 1)
#define FLEX_PER_BLOCK (STATIC_BLOCK_SIZE/sizeof(struct _fl_direct))
/* Definitions for the directory(3) routines: */
typedef struct {
char _fd; /* Filedescriptor of open directory */
char _v7; /* Directory is Version 7 */
short _count; /* This many objects in buf */
off_t _pos; /* Position in directory file */
struct _fl_direct *_ptr; /* Next slot in buf */
struct _fl_direct _buf[FLEX_PER_BLOCK]; /* One block of a directory file */
struct _fl_direct _v7f[FLEX_PER_V7]; /* V7 entry transformed to flex */
} DIR;
struct dirent { /* Largest entry (8 slots) */
ino_t d_ino; /* I-node number */
unsigned char d_extent; /* Extended with this many slots */
char d_name[61]; /* Null terminated name */
};
/* Function Prototypes. */
_PROTOTYPE( int closedir, (DIR *_dirp) );
_PROTOTYPE( DIR *opendir, (const char *_dirname) );
_PROTOTYPE( struct dirent *readdir, (DIR *_dirp) );
_PROTOTYPE( void rewinddir, (DIR *_dirp) );
#ifdef _MINIX
_PROTOTYPE( int seekdir, (DIR *_dirp, off_t _loc) );
_PROTOTYPE( off_t telldir, (DIR *_dirp) );
#endif
#endif /* _DIRENT_H */

4
include/env.h Normal file
View File

@@ -0,0 +1,4 @@
_PROTOTYPE( int env_parse, (char *env, char *fmt, int field,
long *param, long min, long max) );
_PROTOTYPE( void env_panic, (char *env) );
_PROTOTYPE( int env_prefix, (char *env, char *prefix) );

129
include/errno.h Executable file
View File

@@ -0,0 +1,129 @@
/* 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 70 /* number of errors */
#define EGENERIC (_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 errors relate to networking. */
#define EPACKSIZE (_SIGN 50) /* invalid packet size for some protocol */
#define EOUTOFBUFS (_SIGN 51) /* not enough buffers left */
#define EBADIOCTL (_SIGN 52) /* illegal ioctl for device */
#define EBADMODE (_SIGN 53) /* badmode in ioctl */
#define EWOULDBLOCK (_SIGN 54)
#define EBADDEST (_SIGN 55) /* not a valid destination address */
#define EDSTNOTRCH (_SIGN 56) /* destination not reachable */
#define EISCONN (_SIGN 57) /* all ready connected */
#define EADDRINUSE (_SIGN 58) /* address in use */
#define ECONNREFUSED (_SIGN 59) /* connection refused */
#define ECONNRESET (_SIGN 60) /* connection reset */
#define ETIMEDOUT (_SIGN 61) /* connection timed out */
#define EURG (_SIGN 62) /* urgent data present */
#define ENOURG (_SIGN 63) /* no urgent data present */
#define ENOTCONN (_SIGN 64) /* no connection (yet or anymore) */
#define ESHUTDOWN (_SIGN 65) /* a write call to a shutdown connection */
#define ENOCONN (_SIGN 66) /* no such connection */
#define EAFNOSUPPORT (_SIGN 67) /* address family not supported */
#define EPROTONOSUPPORT (_SIGN 68) /* protocol not supported by AF */
/* The following are not POSIX errors, but they can still happen.
* All of these are generated by the kernel and relate to message passing.
*/
#define ELOCKED (_SIGN 101) /* can't send message due to deadlock */
#define EBADCALL (_SIGN 102) /* illegal system call number */
#define EBADSRCDST (_SIGN 103) /* bad source or destination process */
#define ECALLDENIED (_SIGN 104) /* no permission for system call */
#define EDEADDST (_SIGN 105) /* send destination is not alive */
#define ENOTREADY (_SIGN 106) /* source or destination is not ready */
#define EBADREQUEST (_SIGN 107) /* destination cannot handle request */
#define EDONTREPLY (_SIGN 201) /* pseudo-code: don't send a reply */
/* The following error codes are generated by the kernel itself. */
#if DEAD_CODE /* replaced by above codes */
#ifdef _SYSTEM
#define E_TRY_AGAIN -1003 /* can't send -- tables full */
#define E_TASK -1006 /* can't send to task */
#define E_OVERRUN -1004 /* interrupt for task that is not waiting */
#define E_NO_PERM -1008 /* ordinary users can't send to tasks */
#define E_BAD_DEST -1001 /* destination address illegal */
#define E_BAD_BUF -1005 /* message buf outside caller's addr space */
#define E_BAD_FCN -1009 /* unknown (illegal) request type */
#define E_BAD_ADDR -1010 /* bad address given to utility routine */
#define E_BAD_PROC -1011 /* bad proc number given to utility */
#define E_BAD_REQUEST -1009 /* unknown (illegal) request type */
#define E_DONT_REPLY -2000 /* pseudo-code: do not send a reply message */
#endif /* DEAD_CODE */
#endif /* _SYSTEM */
#endif /* _ERRNO_H */

68
include/fcntl.h Executable file
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
#ifndef _TYPES_H
#include <sys/types.h>
#endif
/* 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 1 /* shared or read lock */
#define F_WRLCK 2 /* exclusive or write lock */
#define F_UNLCK 3 /* 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. */
_PROTOTYPE( int creat, (const char *_path, Mode_t _mode) );
_PROTOTYPE( int fcntl, (int _filedes, int _cmd, ...) );
_PROTOTYPE( int open, (const char *_path, int _oflag, ...) );
#endif /* _FCNTL_H */

42
include/float.h Executable file
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-07F
#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-16L
#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 */

28
include/grp.h Executable file
View File

@@ -0,0 +1,28 @@
/* The <grp.h> header is used for the getgrid() and getgrnam() calls. */
#ifndef _GRP_H
#define _GRP_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
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. */
_PROTOTYPE( struct group *getgrgid, (Gid_t _gid) );
_PROTOTYPE( struct group *getgrnam, (const char *_name) );
#ifdef _MINIX
_PROTOTYPE( void endgrent, (void) );
_PROTOTYPE( struct group *getgrent, (void) );
_PROTOTYPE( int setgrent, (void) );
_PROTOTYPE( void setgrfile, (const char *_file) );
#endif
#endif /* _GRP_H */

55
include/ibm/bios.h Normal file
View File

@@ -0,0 +1,55 @@
/* BIOS definitions. Each BIOS entry has an index that is to be used with the
* sys_bioscopy() system call. The raw addresses, sizes, and magic numbers
* are defined here as well. The values that are defined here were collected
* from various kernel files in MINIX 2.0.4.
*
* Author: Jorrit N. Herder
*/
#ifndef _BIOS_H
#define _BIOS_H
/* Memory check (is stopped on reboot). */
#define BIOS_MEM_CHECK 0 /* address to stop memory check */
#define ADR_MEM_CHECK 0x472L
#define LEN_MEM_CHECK 1L
#define STOP_MEM_CHECK 0x1234 /* magic number to stop memory check */
/* Centronics printers. */
#define BIOS_PRN_PORTBASE 1 /* base of printer ports */
#define ADR_PRN_PORTBASE 0x408L
#define LEN_PRN_PORTBASE 2L
/* Hard disk parameter vectors. */
#define BIOS_WINI_PARAMS 2 /* number of hard disk drives */
#define ADR_WINI_PARAMS 0x475L
#define LEN_WINI_PARAMS 1L
#define BIOS_WINI_0_PARM_VEC 3 /* disk 0 parameters */
#define ADR_WINI_0_PARM_VEC 0x41*4L
#define LEN_WINI_0_PARM_VEC 4L
#define BIOS_WINI_1_PARM_VEC 4 /* disk 1 parameters */
#define ADR_WINI_1_PARM_VEC 0x46*4L
#define LEN_WINI_1_PARM_VEC 4L
/* Video controller (VDU). */
#define BIOS_VDU_COLUMNS 5
#define ADR_VDU_COLUMNS 0x44AL
#define LEN_VDU_COLUMNS 2L
#define BIOS_VDU_CRTBASE 6
#define ADR_VDU_CRTBASE 0x463L
#define LEN_VDU_CRTBASE 2L
#define BIOS_VDU_ROWS 7
#define ADR_VDU_ROWS 0x484L
#define LEN_VDU_ROWS 1L
#define BIOS_VDU_FONTLINES 8
#define ADR_VDU_FONTLINES 0x485L
#define LEN_VDU_FONTLINES 2L
/* Machine ID. */
#define BIOS_MACHINE_ID 9
#define ADR_MACHINE_ID 0xFFFFEL
#define LEN_MACHINE_ID 1L
#define PS_386_MACHINE 0xF8 /* Machine ID byte for PS/2 model 80 */
#define PC_AT_MACHINE 0xFC /* PC/AT, PC/XT286, PS/2 models 50/60 */
#endif /* _BIOS_H */

86
include/ibm/cmos.h Executable file
View File

@@ -0,0 +1,86 @@
/*
ibm/cmos.h
Created: Dec 1998 by Philip Homburg <philip@cs.vu.nl>
Definitions for the CMOS/realtime clock. Based on the datasheet for the
Dallas DS12887, compatible with the Motorola MC146818
*/
#define RTC_INDEX 0x70 /* Bit 7 = NMI enable (1) / disable (0)
* bits 0..6 index
*/
#define RTC_IO 0x71 /* Data register,
* Note: the operation following a write to
* RTC_INDEX should an access (read or write)
* to RTC_IO
*/
#define RTC_SEC 0x0 /* Seconds register */
#define RTC_SEC_ALRM 0x1 /* Seconds register for alarm */
#define RTC_MIN 0x2 /* Minutes register */
#define RTC_MIN_ALRM 0x3 /* Minutes register for alarm */
#define RTC_HOUR 0x4 /* Hours register */
#define RTC_HOUR_ALRM 0x5 /* Hours register for alarm */
#define RTC_WDAY 0x6 /* Day of the week, 1..7, Sunday = 1 */
#define RTC_MDAY 0x7 /* Day of the month, 1..31 */
#define RTC_MONTH 0x8 /* Month, 1..12 */
#define RTC_YEAR 0x9 /* Year, 0..99 */
#define RTC_REG_A 0xA
#define RTC_A_UIP 0x80 /* Update in progress. When clear,
* no update will occur for 244
* micro seconds.
*/
#define RTC_A_DV 0x70 /* Divider bits, valid values are: */
#define RTC_A_DV_OK 0x20 /* Normal */
#define RTC_A_DV_STOP 0x70 /* Stop, a re-start starts
* halfway through a cycle,
* i.e. the update occurs after
* 500ms.
*/
#define RTC_A_RS 0x0F /* Int. freq */
/* 0 None
* 1 256 Hz
* 2 128 Hz
* 3 8192 Hz
* 4 4096 Hz
* 5 2048 Hz
* 6 1024 Hz
* 7 512 Hz
* 8 256 Hz
* 9 128 Hz
* 10 64 Hz
* 11 32 Hz
* 12 16 Hz
* 13 8 Hz
* 14 4 Hz
* 15 2 Hz
*/
#define RTC_A_RS_DEF 6 /* Default freq. */
#define RTC_REG_B 0xB
#define RTC_B_SET 0x80 /* Inhibit updates */
#define RTC_B_PIE 0x40 /* Enable periodic interrupts */
#define RTC_B_AIE 0x20 /* Enable alarm interrupts */
#define RTC_B_UIE 0x10 /* Enable update ended interrupts */
#define RTC_B_SQWE 0x08 /* Enable square wave output */
#define RTC_B_DM_BCD 0x04 /* Data is in BCD (otherwise binary) */
#define RTC_B_24 0x02 /* Count hours in 24-hour mode */
#define RTC_B_DSE 0x01 /* Automatic (wrong) daylight savings
* updates
*/
#define RTC_REG_C 0xC
/* Contents of the general purpose CMOS RAM (source IBM reference manual) */
#define CMOS_STATUS 0xE
#define CS_LOST_POWER 0x80 /* Chip lost power */
#define CS_BAD_CHKSUM 0x40 /* Checksum is incorrect */
#define CS_BAD_CONFIG 0x20 /* Bad configuration info */
#define CS_BAD_MEMSIZE 0x10 /* Wrong memory size of CMOS */
#define CS_BAD_HD 0x08 /* Harddisk failed */
#define CS_BAD_TIME 0x04 /* CMOS time is invalid */
/* bits 0 and 1 are reserved */
/*
* $PchId: cmos.h,v 1.1 1998/12/16 09:14:21 philip Exp $
*/

20
include/ibm/diskparm.h Executable file
View File

@@ -0,0 +1,20 @@
/* PC (and AT) BIOS structure to hold disk parameters. Under Minix, it is
* used mainly for formatting.
*/
#ifndef _DISKPARM_H
#define _DISKPARM_H
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;
};
#endif /* _DISKPARM_H */

63
include/ibm/int86.h Executable file
View File

@@ -0,0 +1,63 @@
/* int86.h - 8086 interrupt types Author: Kees J. Bot
* 3 May 2000
*/
/* Registers used in an PC real mode call for BIOS or DOS services. A
* driver is called through the vector if the interrupt number is zero.
*/
union reg86 {
struct l {
u32_t ef; /* 32 bit flags (output only) */
u32_t vec; /* Driver vector (input only) */
u32_t _ds_es[1];
u32_t eax; /* 32 bit general registers */
u32_t ebx;
u32_t ecx;
u32_t edx;
u32_t esi;
u32_t edi;
u32_t ebp;
} l;
struct w {
u16_t f, _ef[1]; /* 16 bit flags (output only) */
u16_t off, seg; /* Driver vector (input only) */
u16_t ds, es; /* DS and ES real mode segment regs */
u16_t ax, _eax[1]; /* 16 bit general registers */
u16_t bx, _ebx[1];
u16_t cx, _ecx[1];
u16_t dx, _edx[1];
u16_t si, _esi[1];
u16_t di, _edi[1];
u16_t bp, _ebp[1];
} w;
struct b {
u8_t intno, _intno[3]; /* Interrupt number (input only) */
u8_t _vec[4];
u8_t _ds_es[4];
u8_t al, ah, _eax[2]; /* 8 bit general registers */
u8_t bl, bh, _ebx[2];
u8_t cl, ch, _ecx[2];
u8_t dl, dh, _edx[2];
u8_t _esi[4];
u8_t _edi[4];
u8_t _ebp[4];
} b;
};
#ifdef _SYSTEM /* Kernel: Registers used in an 8086 interrupt */
EXTERN union reg86 reg86;
#endif
/* Parameters passed on ioctls to the memory task. */
struct mio_int86 { /* MIOCINT86 */
union reg86 reg86; /* x86 registers as above */
u16_t off, seg; /* Address of kernel buffer */
void *buf; /* User data buffer */
size_t len; /* Size of user buffer */
};
struct mio_ldt86 { /* MIOCGLDT86, MIOCSLDT86 */
size_t idx; /* Index in process' LDT */
u16_t entry[4]; /* One LDT entry to get or set. */
};

62
include/ibm/interrupt.h Normal file
View File

@@ -0,0 +1,62 @@
/* Interrupt numbers and hardware vectors. */
#ifndef _INTERRUPT_H
#define _INTERRUPT_H
#if (CHIP == INTEL)
/* 8259A interrupt controller ports. */
#define INT_CTL 0x20 /* I/O port for interrupt controller */
#define INT_CTLMASK 0x21 /* setting bits in this port disables ints */
#define INT2_CTL 0xA0 /* I/O port for second interrupt controller */
#define INT2_CTLMASK 0xA1 /* setting bits in this port disables ints */
/* Magic numbers for interrupt controller. */
#define ENABLE 0x20 /* code used to re-enable after an interrupt */
/* Interrupt vectors defined/reserved by processor. */
#define DIVIDE_VECTOR 0 /* divide error */
#define DEBUG_VECTOR 1 /* single step (trace) */
#define NMI_VECTOR 2 /* non-maskable interrupt */
#define BREAKPOINT_VECTOR 3 /* software breakpoint */
#define OVERFLOW_VECTOR 4 /* from INTO */
/* Fixed system call vector. */
#define SYS_VECTOR 32 /* system calls are made with int SYSVEC */
#define SYS386_VECTOR 33 /* except 386 system calls use this */
#define LEVEL0_VECTOR 34 /* for execution of a function at level 0 */
/* Suitable irq bases for hardware interrupts. Reprogram the 8259(s) from
* the PC BIOS defaults since the BIOS doesn't respect all the processor's
* reserved vectors (0 to 31).
*/
#define BIOS_IRQ0_VEC 0x08 /* base of IRQ0-7 vectors used by BIOS */
#define BIOS_IRQ8_VEC 0x70 /* base of IRQ8-15 vectors used by BIOS */
#define IRQ0_VECTOR 0x50 /* nice vectors to relocate IRQ0-7 to */
#define IRQ8_VECTOR 0x70 /* no need to move IRQ8-15 */
/* Hardware interrupt numbers. */
#define NR_IRQ_VECTORS 16
#define CLOCK_IRQ 0
#define KEYBOARD_IRQ 1
#define CASCADE_IRQ 2 /* cascade enable for 2nd AT controller */
#define ETHER_IRQ 3 /* default ethernet interrupt vector */
#define SECONDARY_IRQ 3 /* RS232 interrupt vector for port 2 */
#define RS232_IRQ 4 /* RS232 interrupt vector for port 1 */
#define XT_WINI_IRQ 5 /* xt winchester */
#define FLOPPY_IRQ 6 /* floppy disk */
#define PRINTER_IRQ 7
#define AT_WINI_0_IRQ 14 /* at winchester controller 0 */
#define AT_WINI_1_IRQ 15 /* at winchester controller 1 */
/* Interrupt number to hardware vector. */
#define BIOS_VECTOR(irq) \
(((irq) < 8 ? BIOS_IRQ0_VEC : BIOS_IRQ8_VEC) + ((irq) & 0x07))
#define VECTOR(irq) \
(((irq) < 8 ? IRQ0_VECTOR : IRQ8_VECTOR) + ((irq) & 0x07))
#endif /* (CHIP == INTEL) */
#endif /* _INTERRUPT_H */

26
include/ibm/partition.h Executable file
View File

@@ -0,0 +1,26 @@
/* Description of entry in partition table. */
#ifndef _PARTITION_H
#define _PARTITION_H
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 */
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 partition 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 NO_PART 0x00 /* unused entry */
#define MINIX_PART 0x81 /* Minix partition type */
#endif /* _PARTITION_H */

29
include/ibm/portio.h Executable file
View File

@@ -0,0 +1,29 @@
/*
ibm/portio.h
Created: Jan 15, 1992 by Philip Homburg
*/
#ifndef _PORTIO_H_
#define _PORTIO_H_
#ifndef _TYPES_H
#include <sys/types.h>
#endif
unsigned inb(U16_t _port);
unsigned inw(U16_t _port);
unsigned inl(U32_t _port);
void outb(U16_t _port, U8_t _value);
void outw(U16_t _port, U16_t _value);
void outl(U16_t _port, U32_t _value);
void insb(U16_t _port, void *_buf, size_t _count);
void insw(U16_t _port, void *_buf, size_t _count);
void insl(U16_t _port, void *_buf, size_t _count);
void outsb(U16_t _port, void *_buf, size_t _count);
void outsw(U16_t _port, void *_buf, size_t _count);
void outsl(U16_t _port, void *_buf, size_t _count);
void intr_disable(void);
void intr_enable(void);
#endif /* _PORTIO_H_ */

17
include/ibm/ports.h Normal file
View File

@@ -0,0 +1,17 @@
/* Addresses and magic numbers for miscellaneous ports. */
#ifndef _PORTS_H
#define _PORTS_H
#if (CHIP == INTEL)
/* Miscellaneous ports. */
#define PCR 0x65 /* Planar Control Register */
#define PORT_B 0x61 /* I/O port for 8255 port B (kbd, beeper...) */
#define TIMER0 0x40 /* I/O port for timer channel 0 */
#define TIMER2 0x42 /* I/O port for timer channel 2 */
#define TIMER_MODE 0x43 /* I/O port for timer mode control */
#endif /* (CHIP == INTEL) */
#endif /* _PORTS_H */

39
include/lib.h Executable file
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>
#include <minix/ipc.h>
#define MM 0
#define FS 1
_PROTOTYPE( int __execve, (const char *_path, char *const _argv[],
char *const _envp[], int _nargs, int _nenvps) );
_PROTOTYPE( int _syscall, (int _who, int _syscallnr, message *_msgptr) );
_PROTOTYPE( void _loadname, (const char *_name, message *_msgptr) );
_PROTOTYPE( int _len, (const char *_s) );
_PROTOTYPE( void panic, (const char *_message, int _errnum) );
#if 0
_PROTOTYPE( int _sendrec, (int _src_dest, message *_m_ptr) );
#endif
_PROTOTYPE( void _begsig, (int _dummy) );
#endif /* _LIB_H */

87
include/limits.h Executable file
View File

@@ -0,0 +1,87 @@
/* 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 0xFFFF /* maximum value of unsigned short */
/* _EM_WSIZE is a compiler-generated symbol giving the word size in bytes. */
#if _EM_WSIZE == 2
#define INT_MIN (-32767-1) /* minimum value of a 16-bit int */
#define INT_MAX 32767 /* maximum value of a 16-bit int */
#define UINT_MAX 0xFFFF /* maximum value of an unsigned 16-bit int */
#endif
#if _EM_WSIZE == 4
#define INT_MIN (-2147483647-1) /* minimum value of a 32-bit int */
#define INT_MAX 2147483647 /* maximum value of a 32-bit int */
#define UINT_MAX 0xFFFFFFFF /* maximum value of an unsigned 32-bit int */
#endif
/*Definitions about longs (32 bits in MINIX). */
#define LONG_MIN (-2147483647L-1)/* minimum value of a long */
#define LONG_MAX 2147483647L /* maximum value of a long */
#define ULONG_MAX 0xFFFFFFFFL /* maximum value of an unsigned long */
#include <sys/dir.h>
/* Minimum sizes required by the POSIX P1003.1 standard (Table 2-3). */
#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 DIRSIZ /* 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 must be atomic */
#define _POSIX_STREAM_MAX 8 /* at least 8 FILEs can be open at once */
#define _POSIX_TZNAME_MAX 3 /* time zone names can be at least 3 chars */
#define _POSIX_SSIZE_MAX 32767 /* read() must support 32767 byte reads */
/* Values actually implemented by MINIX (Tables 2-4, 2-5, 2-6, and 2-7). */
/* 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 */
#if _EM_WSIZE > 2
#define ARG_MAX 16384 /* # bytes of args + environ for exec() */
#else
#define ARG_MAX 4096 /* args + environ on small machines */
#endif
#define CHILD_MAX _NO_LIMIT /* MINIX does not limit children */
#define OPEN_MAX 20 /* # open files a process may have */
#if 0 /* V1 file system */
#define LINK_MAX CHAR_MAX /* # links a file may have */
#else /* V2 or better file system */
#define LINK_MAX SHRT_MAX /* # links a file may have */
#endif
#define MAX_CANON 255 /* size of the canonical input queue */
#define MAX_INPUT 255 /* size of the type-ahead buffer */
#define NAME_MAX DIRSIZ /* # chars in a file name */
#define PATH_MAX 255 /* # chars in a path name */
#define PIPE_BUF 7168 /* # bytes in atomic write to a pipe */
#define STREAM_MAX 20 /* must be the same as FOPEN_MAX in stdio.h */
#define TZNAME_MAX 3 /* maximum bytes in a time zone name is 3 */
#define SSIZE_MAX 32767 /* max defined byte count for read() */
#endif /* _POSIX_SOURCE */
#endif /* _LIMITS_H */

47
include/locale.h Executable file
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
#ifndef _ANSI_H
#include <ansi.h>
#endif
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. */
_PROTOTYPE( char *setlocale, (int _category, const char *_locale) );
_PROTOTYPE( struct lconv *localeconv, (void) );
#endif /* _LOCALE_H */

39
include/math.h Executable file
View File

@@ -0,0 +1,39 @@
/* The <math.h> header contains prototypes for mathematical functions. */
#ifndef _MATH_H
#define _MATH_H
#ifndef _ANSI_H
#include <ansi.h>
#endif
#define HUGE_VAL (__huge_val()) /* may be infinity */
/* Function Prototypes. */
_PROTOTYPE( double __huge_val, (void) );
_PROTOTYPE( int __IsNan, (double _x) );
_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 */

29
include/mathconst.h Executable file
View File

@@ -0,0 +1,29 @@
/*
* mathconst.h - mathematic constants
*/
/* $Header$ */
#ifndef _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 */

77
include/minix/callnr.h Executable file
View File

@@ -0,0 +1,77 @@
#define NCALLS 83 /* 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 WAITPID 11
#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
#define SETSID 62
#define GETPGRP 63
/* The following are not system calls, but are processed like them. */
#define UNPAUSE 65 /* to MM or FS: check for EINTR */
#define REVIVE 67 /* to FS: revive a sleeping process */
#define TASK_REPLY 68 /* to FS: reply code from tty task */
/* Posix signal handling. */
#define SIGACTION 71
#define SIGSUSPEND 72
#define SIGPENDING 73
#define SIGPROCMASK 74
#define SIGRETURN 75
#define REBOOT 76
/* MINIX specific calls to support system services. */
#define SVRCTL 77
#define CMOSTIME 78
#define GETSYSINFO 79 /* to MM or FS */
#if ENABLE_MESSAGE_STATS
#define MSTATS 80
#endif
#define SETCACHE 81
#define FSTATFS 82

42
include/minix/cdrom.h Executable file
View File

@@ -0,0 +1,42 @@
/* This file contains some structures used by the Mitsumi cdrom driver.
*
* Feb 13 1995 Author: Michel R. Prevenier
*/
/* Index into the mss arrays */
#define MINUTES 0
#define SECONDS 1
#define SECTOR 2
struct cd_play_mss
{
u8_t begin_mss[3];
u8_t end_mss[3];
};
struct cd_play_track
{
u8_t begin_track;
u8_t end_track;
};
struct cd_disk_info
{
u8_t first_track;
u8_t last_track;
u8_t disk_length_mss[3];
u8_t first_track_mss[3];
};
struct cd_toc_entry
{
u8_t control_address;
u8_t track_nr;
u8_t index_nr;
u8_t track_time_mss[3];
u8_t reserved;
u8_t position_mss[3];
};

400
include/minix/com.h Executable file
View File

@@ -0,0 +1,400 @@
/*===========================================================================*
* System calls and magic process numbers *
*===========================================================================*/
/* Masks and flags for system calls. */
#define SYSCALL_FUNC 0x0F /* mask for system call function */
#define SYSCALL_FLAGS 0xF0 /* mask for system call flags */
#define NON_BLOCKING 0x10 /* don't block, but return */
/* System calls (numbers passed when trapping to the kernel) */
#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 NB_SEND (SEND | NON_BLOCKING) /* non-blocking SEND */
#define NB_RECEIVE (RECEIVE | NON_BLOCKING) /* non-blocking RECEIVE */
/* Magic, invalid process numbers. */
#define ANY 0x7ace /* used to indicate 'any process' */
#define NONE 0x6ace /* used to indicate 'no process at all' */
#define SELF 0x8ace /* used to indicate 'own process' */
/*===========================================================================*
* Process numbers of processes in the system image *
*===========================================================================*/
/* The values of several task numbers depend on whether they or other tasks
* are enabled. They are defined as (PREVIOUS_TASK - ENABLE_TASK) in general.
* ENABLE_TASK is either 0 or 1, so a task either gets a new number, or gets
* the same number as the previous task and is further unused. Note that the
* order should correspond to the order in the task table defined in table.c.
*/
/* Kernel tasks. These all run in the same address space. */
#define RTL8139 IDLE - ENABLE_RTL8139 /* networking */
#define IDLE -4 /* runs when no one else can run */
#define CLOCK -3 /* alarms and other clock functions */
#define SYSTASK -2 /* request system functionality */
#define HARDWARE -1 /* used as source on notify() messages */
/* Number of tasks. Note that NR_PROCS is defined in <minix/config.h>. */
#define NR_TASKS (4 + ENABLE_RTL8139)
/* Magic numbers for controllers. Device driver mapping is dynamic. */
#define CTRLR(n) (NONE + (n))
/* User-level processes, that is, device drivers, servers, and INIT. */
#define MM_PROC_NR 0 /* memory manager */
#define FS_PROC_NR 1 /* file system */
#define IS_PROC_NR 5 /* information server */
#define TTY 6 /* terminal (TTY) driver */
#define MEMORY 8 /* memory driver (RAM disk, null, etc.) */
#define AT_WINI (MEMORY + ENABLE_AT_WINI) /* AT Winchester */
#define FLOPPY (AT_WINI + ENABLE_FLOPPY) /* floppy disk */
#define PRINTER (FLOPPY + ENABLE_PRINTER) /* Centronics */
#define INIT_PROC_NR (PRINTER + 1) /* init -- goes multiuser */
/* Number of first user process not part of the operating system. */
#define LOW_USER INIT_PROC_NR
/* The number of processes that are contained in the system image. */
#define IMAGE_SIZE (NR_TASKS + \
5 + ENABLE_AT_WINI + ENABLE_FLOPPY + \
ENABLE_PRINTER + 1 )
/*===========================================================================*
* Kernel notification types *
*===========================================================================*/
/* Kernel notification types. In principle, these can be sent to any process,
* so make sure that these types do not interfere with other message types.
* Notifications are prioritized because of the way they are unhold() and
* blocking notifications are delivered. The lowest numbers go first. The
* offset are used for the per-process notification bit maps.
*/
#define NR_NOTIFICATIONS 5 /* max. is # bits in notify_mask_t */
# define NOTIFICATION 333 /* offset for notification types */
# define HARD_INT NOTIFICATION + 0 /* hardware interrupt */
# define SYN_ALARM NOTIFICATION + 1 /* synchronous alarm */
# define KSIG_PENDING NOTIFICATION + 2 /* signal(s) pending */
# define NEW_KMESS NOTIFICATION + 3 /* new kernel message */
# define HARD_STOP NOTIFICATION + 4 /* system shutdown */
/*===========================================================================*
* Messages for BLOCK and CHARACTER device drivers *
*===========================================================================*/
#define CANCEL 0 /* general req to force a task to cancel */
#define DEV_READ 3 /* fcn code for reading from tty */
#define DEV_WRITE 4 /* fcn code for writing to tty */
#define DEV_IOCTL 5 /* fcn code for ioctl */
#define DEV_OPEN 6 /* fcn code for opening tty */
#define DEV_CLOSE 7 /* fcn code for closing tty */
#define DEV_SCATTER 8 /* fcn code for writing from a vector */
#define DEV_GATHER 9 /* fcn code for reading into a vector */
#define TTY_SETPGRP 10 /* fcn code for setpgroup */
#define TTY_EXIT 11 /* a process group leader has exited */
#define SUSPEND -998 /* used in interrupts when tty has no data */
/* Field names for messages to block and character device drivers. */
#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 REQUEST m2_i3 /* ioctl request code */
#define POSITION m2_l1 /* file offset */
#define ADDRESS m2_p1 /* core buffer address */
/* Field names 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 */
/* Field names for messages to TTY driver. */
#define TTY_LINE DEVICE /* message parameter: terminal line */
#define TTY_REQUEST COUNT /* message parameter: ioctl request code */
#define TTY_SPEK POSITION/* message parameter: ioctl speed, erasing */
#define TTY_FLAGS m2_l2 /* message parameter: ioctl tty mode */
#define TTY_PGRP m2_i3 /* message parameter: process group */
/* Field names for the QIC 02 status reply from tape driver */
#define TAPE_STAT0 m2_l1
#define TAPE_STAT1 m2_l2
/* Major and minor device numbers for MEMORY driver. */
# define MEMORY_MAJOR 1 /* major device for memory devices */
# 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 */
# define BOOT_DEV 4 /* minor device for /dev/boot */
# define DEV_RAM 0x0100 /* device number of /dev/ram */
# define DEV_BOOT 0x0104 /* device number of /dev/boot */
/*===========================================================================*
* Messages for networking layer *
*===========================================================================*/
/* Message types for network layer requests. */
#define NW_OPEN DEV_OPEN
#define NW_CLOSE DEV_CLOSE
#define NW_READ DEV_READ
#define NW_WRITE DEV_WRITE
#define NW_IOCTL DEV_IOCTL
#define NW_CANCEL CANCEL
/* Message types for data link layer requests. */
#define DL_WRITE 3
#define DL_WRITEV 4
#define DL_READ 5
#define DL_READV 6
#define DL_INIT 7
#define DL_STOP 8
#define DL_GETSTAT 9
/* Message type for data link layer replies. */
#define DL_INIT_REPLY 20
#define DL_TASK_REPLY 21
/* Field names for data link layer messages. */
#define DL_PORT m2_i1
#define DL_PROC m2_i2
#define DL_COUNT m2_i3
#define DL_MODE m2_l1
#define DL_CLCK m2_l2
#define DL_ADDR m2_p1
#define DL_STAT m2_l1
/* Bits in 'DL_STAT' field of DL replies. */
# define DL_PACK_SEND 0x01
# define DL_PACK_RECV 0x02
# define DL_READ_IP 0x04
/* Bits in 'DL_MODE' field of DL requests. */
# define DL_NOMODE 0x0
# define DL_PROMISC_REQ 0x2
# define DL_MULTI_REQ 0x4
# define DL_BROAD_REQ 0x8
/*===========================================================================*
* CLOCK request types and field names *
*===========================================================================*/
/* Clock library calls are dispatched via a call vector, so be careful when
* modifying the clock call numbers. The numbers here determine which call
* is made from the call vector.
*/
# define CLK_SIGNALRM 1 /* clk_signalrm(proc_nr, ticks) */
# define CLK_SYNCALRM 6 /* clk_syncalrm(proc_nr,exp_time,abs_time) */
# define CLK_FLAGALRM 7 /* clk_flagalrm(ticks, flag_ptr) */
/*===========================================================================*
* SYSTASK request types and field names *
*===========================================================================*/
/* System library calls are dispatched via a call vector, so be careful when
* modifying the system call numbers. The numbers here determine which call
* is made from the call vector.
*/
#define NR_SYS_CALLS 32 /* number of system calls */
# define SYS_TIMES 0 /* sys_times(proc_nr, bufptr) */
# define SYS_XIT 1 /* sys_xit(parent, proc) */
# define SYS_SIGCTL 3 /* sys_sigctl(req,pnr,sig,ctxt,flag,pnr,map) */
# define SYS_FORK 4 /* sys_fork(parent, child, pid) */
# define SYS_NEWMAP 5 /* sys_newmap(proc_nr, map_ptr) */
# define SYS_COPY 6 /* sys_copy(ptr) */
# define SYS_EXEC 7 /* sys_exec(proc_nr, new_sp) */
# define SYS_ABORT 9 /* sys_abort() */
# define SYS_KILL 10 /* sys_kill(proc_nr, sig) */
# define SYS_UMAP 11 /* sys_umap(proc_nr, etc) */
# define SYS_TRACE 13 /* sys_trace(req,pid,addr,data) */
# define SYS_VCOPY 14 /* sys_vcopy(src_p, dst_p, vcpy_s, vcpy_ptr) */
# define SYS_SIGNALRM 15 /* sys_signalrm(proc_nr, ticks) */
# define SYS_SYNCALRM 16 /* sys_syncalrm(proc_nr,exp_time,abs_time) */
# define SYS_FLAGALRM 17 /* sys_flagalrm(ticks, flag_ptr) */
# define SYS_SVRCTL 19 /* sys_svrctl(proc_nr, req, argp) */
# define SYS_SDEVIO 20 /* sys_sdevio(port, proc_nr, buf, count) */
# define SYS_GETINFO 22 /* sys_getinfo(what, whereto) */
# define SYS_DEVIO 23 /* sys_devio(port, value) */
# define SYS_VDEVIO 24 /* sys_vdevio(buf_ptr, nr_ports) */
# define SYS_IRQCTL 25 /* sys_irqctl() */
# define SYS_KMALLOC 26 /* sys_kmalloc(size, phys_base) */
# define SYS_IOPENABLE 27 /* sys_enable_iop() */
# define SYS_PHYS2SEG 28 /* sys_phys2seg(*seg, *off, phys) */
# define SYS_EXIT 29 /* sys_exit(status) */
# define SYS_VIRCOPY 30 /* sys_vircopy(src,seg,addr,dst,seg,addr,cnt) */
# define SYS_PHYSCOPY 31 /* sys_physcopy(src_addr,dst_addr,count) */
# define SYS_MSTATS 32
/* Field names for SYS_MEM, SYS_KMALLOC. */
#define MEM_CHUNK_BASE m4_l1 /* physical base address */
#define MEM_CHUNK_SIZE m4_l2 /* size of mem chunk */
#define MEM_TOT_SIZE m4_l3 /* total memory size */
#define MEM_CHUNK_TAG m4_l4 /* tag to identify chunk of mem */
/* Field names for SYS_DEVIO, SYS_VDEVIO, SYS_SDEVIO. */
#define DIO_REQUEST m2_i3 /* device in or output */
# define DIO_INPUT 0 /* input */
# define DIO_OUTPUT 1 /* output */
#define DIO_TYPE m2_i1 /* flag indicating byte, word, or long */
# define DIO_BYTE 'b' /* byte type values */
# define DIO_WORD 'w' /* word type values */
# define DIO_LONG 'l' /* long type values */
#define DIO_PORT m2_l1 /* single port address */
#define DIO_VALUE m2_l2 /* single I/O value */
#define DIO_VEC_ADDR m2_p1 /* address of buffer or (p,v)-pairs */
#define DIO_VEC_SIZE m2_l2 /* number of elements in vector */
#define DIO_VEC_PROC m2_i2 /* number of process where vector is */
/* Field names for SYS_SIGNARLM, SYS_FLAGARLM, SYS_SYNCALRM. */
#define ALRM_EXP_TIME m2_l1 /* expire time for the alarm call */
#define ALRM_ABS_TIME m2_i2 /* set to 1 to use absolute alarm time */
#define ALRM_TIME_LEFT m2_l1 /* how many ticks were remaining */
#define ALRM_PROC_NR m2_i1 /* which process wants the alarm? */
#define ALRM_FLAG_PTR m2_p1 /* virtual address of timeout flag */
/* Field names for SYS_IRQCTL. */
#define IRQ_REQUEST m5_c1 /* what to do? */
# define IRQ_SETPOLICY 1 /* manage a slot of the IRQ table */
# define IRQ_ENABLE 2 /* enable interrupts */
# define IRQ_DISABLE 3 /* disable interrupts */
#define IRQ_VECTOR m5_c2 /* irq vector */
#define IRQ_POLICY m5_i1 /* options for IRQCTL request */
# define IRQ_READ_PORT 0x001 /* read port and return value */
# define IRQ_WRITE_PORT 0x002 /* write given value to port */
# define IRQ_STROBE 0x010 /* write masked value back to port */
# define IRQ_ECHO_VAL 0x020 /* write value read back to port */
# define IRQ_REENABLE 0x040 /* reenable IRQ line after interrupt */
# define IRQ_BYTE 0x100 /* byte values */
# define IRQ_WORD 0x200 /* word values */
# define IRQ_LONG 0x400 /* long values */
#define IRQ_PROC_NR m5_i2 /* process number, SELF, NONE */
#define IRQ_PORT m5_l1 /* port to read or write */
#define IRQ_VIR_ADDR m5_l2 /* address to store value read */
#define IRQ_MASK_VAL m5_l3 /* value or strobe mask */
/* Names of message field and paramaters for SYS_EXIT request. */
#define EXIT_STATUS m2_i1 /* zero for normal exit, non-zero else */
/* Field names for SYS_PHYS2SEG. */
#define SEG_SELECT m4_l1 /* segment selector returned */
#define SEG_OFFSET m4_l2 /* offset in segment returned */
#define SEG_PHYS m4_l3 /* physical address of segment */
#define SEG_SIZE m4_l4 /* segment size */
/* Field names for SYS_VIDCOPY. */
#define VID_REQUEST m4_l1 /* what to do? */
# define VID_VID_COPY 1 /* request vid_vid_copy() */
# define MEM_VID_COPY 2 /* request mem_vid_copy() */
#define VID_SRC_ADDR m4_l2 /* virtual address in memory */
#define VID_SRC_OFFSET m4_l3 /* offset in video memory */
#define VID_DST_OFFSET m4_l4 /* offset in video memory */
#define VID_CP_COUNT m4_l5 /* number of words to be copied */
/* Field names for SYS_ABORT. */
#define ABRT_HOW m1_i1 /* RBT_REBOOT, RBT_HALT, etc. */
#define ABRT_MON_PROC m1_i2 /* process where monitor params are */
#define ABRT_MON_LEN m1_i3 /* length of monitor params */
#define ABRT_MON_ADDR m1_p1 /* virtual address of monitor params */
/* Field names for SYS_COPY, _UMAP, _VIRCOPY, _PHYSCOPY. */
#define CP_SRC_SPACE m5_c1 /* T or D space (stack is also D) */
#define CP_SRC_PROC_NR m5_i1 /* process to copy from */
#define CP_SRC_ADDR m5_l1 /* address where data come from */
#define CP_DST_SPACE m5_c2 /* T or D space (stack is also D) */
#define CP_DST_PROC_NR m5_i2 /* process to copy to */
#define CP_DST_ADDR m5_l2 /* address where data go to */
#define CP_NR_BYTES m5_l3 /* number of bytes to copy */
/* Field names for SYS_VCOPY and SYS_VVIRCOPY. */
#define VCP_SRC_PROC m1_i1 /* process to copy from */
#define VCP_DST_PROC m1_i2 /* process to copy to */
#define VCP_VEC_SIZE m1_i3 /* size of copy vector */
#define VCP_VEC_ADDR m1_p1 /* pointer to copy vector */
/* Field names for SYS_GETINFO. */
#define I_REQUEST m7_i3 /* what info to get */
# define GET_KENVIRON 0 /* get kernel environment variables */
# define GET_IMAGE 1 /* get system image table */
# define GET_PROCTAB 2 /* get (kernel) process table */
# define GET_PROCNR 3 /* find nr of process with name */
# define GET_MONPARAMS 4 /* get monitor parameters */
# define GET_KENV 5 /* get kernel environment string */
# define GET_IRQTAB 6 /* get the IRQ table */
# define GET_KMESSAGES 7 /* get kernel messages */
# define GET_MEMCHUNKS 8 /* get base+size of mem chunks */
# define GET_KADDRESSES 9 /* get various kernel addresses */
# define GET_SCHEDINFO 10 /* get scheduling queues */
# define GET_PROC 11 /* get process slot if given process */
#define I_PROC_NR m7_i4 /* calling process */
#define I_VAL_PTR m7_p1 /* virtual address at caller */
#define I_VAL_LEN m7_i1 /* max length of value */
#define I_KEY_PTR m7_p2 /* virtual address of key to lookup */
#define I_KEY_LEN m7_i2 /* length of key to lookup */
/* Field names for SYS_TIMES. */
#define T_PROC_NR m4_l1 /* process to request time info for */
#define T_USER_TIME m4_l1 /* user time consumed by process */
#define T_SYSTEM_TIME m4_l2 /* system time consumed by process */
#define T_CHILD_UTIME m4_l3 /* user time consumed by process' children */
#define T_CHILD_STIME m4_l4 /* sys time consumed by process' children */
#define T_BOOT_TICKS m4_l5 /* number of clock ticks since boot time */
/* Field names for SYS_TRACE, SYS_SVRCTL. */
#define CTL_PROC_NR m2_i1 /* process number of the caller */
#define CTL_REQUEST m2_i2 /* server control request */
#define CTL_MM_PRIV m2_i3 /* privilege as seen by MM */
#define CTL_ARG_PTR m2_p1 /* pointer to argument */
#define CTL_ADDRESS m2_l1 /* address at traced process' space */
#define CTL_DATA m2_l2 /* data field for tracing */
/* Field names for SYS_KILL, SYS_SIGCTL */
#define SIG_REQUEST m2_l2 /* MM signal control request */
#define S_GETSIG 0 /* get pending kernel signal */
#define S_ENDSIG 1 /* finish a kernel signal */
#define S_SENDSIG 2 /* POSIX style signal handling */
#define S_SIGRETURN 3 /* return from POSIX handling */
#define S_KILL 4 /* servers kills process with signal */
#define SIG_PROC m2_i1 /* process number for inform */
#define SIG_NUMBER m2_i2 /* signal number to send */
#define SIG_FLAGS m2_i3 /* signal flags field */
#define SIG_MAP m2_l1 /* used by kernel to pass signal bit map */
#define SIG_CTXT_PTR m2_p1 /* pointer to info to restore signal context */
/* Field names for SYS_FORK, _EXEC, _XIT, _GETSP, _GETMAP, _NEWMAP */
#define PR_PROC_NR m1_i1 /* indicates a (child) process */
#define PR_PPROC_NR m1_i2 /* indicates a (parent) process */
#define PR_STACK_PTR m1_p1 /* used for stack ptr in sys_exec, sys_getsp */
#define PR_TRACING m1_i3 /* flag to indicate tracing is on/ off */
#define PR_NAME_PTR m1_p2 /* tells where program name is for dmp */
#define PR_IP_PTR m1_p3 /* initial value for ip after exec */
#define PR_PID m1_i3 /* process id passed from MM to kernel */
#define PR_MEM_PTR m1_p1 /* tells where memory map is for sys_newmap */
/*===========================================================================*
* Miscellaneous messages, mainly used by IS *
*===========================================================================*/
/* Miscellaneous request types and field names, e.g. used by IS server. */
#define PANIC_DUMPS 97 /* debug dumps at the TTY on RBT_PANIC */
#define FKEY_CONTROL 98 /* control a function key at the TTY */
#define FKEY_PRESSED 99 /* notify process of function key event */
# define FKEY_NUM m2_l1 /* fkey number excluding modifiers */
# define FKEY_CODE m2_l2 /* fkey code including modifiers */
# define FKEY_ENABLE m2_i1 /* enable or disable mapping */
#define DIAGNOSTICS 100 /* output a string without FS in between */
# define DIAG_PRINT_BUF m1_p1
# define DIAG_BUF_COUNT m1_i1
# define DIAG_PROC_NR m1_i2

178
include/minix/config.h Executable file
View File

@@ -0,0 +1,178 @@
#ifndef _CONFIG_H
#define _CONFIG_H
/* Minix release and version numbers. */
#define OS_RELEASE "3"
#define OS_VERSION "0.1"
/* 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 *
*===========================================================================*/
#define MACHINE IBM_PC /* Must be one of the names listed below */
#define IBM_PC 1 /* any 8088 or 80x86-based system */
#define SUN_4 40 /* any Sun SPARC-based system */
#define SUN_4_60 40 /* Sun-4/60 (aka SparcStation 1 or Campus) */
#define ATARI 60 /* ATARI ST/STe/TT (68000/68030) */
#define AMIGA 61 /* Commodore Amiga (68000) */
#define MACINTOSH 62 /* Apple Macintosh (68000) */
/* Word size in bytes (a constant equal to sizeof(int)). */
#if __ACK__
#define _WORD_SIZE _EM_WSIZE
#endif
/* Number of slots in the process table for non-kernel processes. */
#define NR_PROCS 64
/* The buffer cache should be made as large as you can afford. */
#if (MACHINE == IBM_PC && _WORD_SIZE == 2)
#define NR_BUFS 40 /* # blocks in the buffer cache */
#define NR_BUF_HASH 64 /* size of buf hash table; MUST BE POWER OF 2*/
#endif
#if (MACHINE == IBM_PC && _WORD_SIZE == 4)
#define NR_BUFS 128 /* # blocks in the buffer cache */
#define NR_BUF_HASH 1024 /* size of buf hash table; MUST BE POWER OF 2*/
#endif
#if (MACHINE == SUN_4_60)
#define NR_BUFS 512 /* # blocks in the buffer cache (<=1536) */
#define NR_BUF_HASH 512 /* 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 LINEWRAP 1 /* console.c - wrap lines at column 80 */
#define ALLOW_GAP_MESSAGES 1 /* proc.c - allow messages in the gap between
* the end of bss and lowest stack address */
#define KMESS_BUF_SIZE 512 /* size in B for kernel messages */
/* Number of controller tasks (/dev/cN device classes). */
#define NR_CTRLRS 2
/* Enable or disable the second level file system cache on the RAM disk. */
#define ENABLE_CACHE2 0
/* Enable or disable swapping processes to disk. */
#define ENABLE_SWAP 1
/* Enable or disable kernel calls (allows for minimal kernel). */
#define ENABLE_K_TRACING 1 /* process tracing can be disabled */
#define ENABLE_K_DEBUGGING 1 /* kernel debugging calls */
/* Include or exclude device drivers. Set to 1 to include, 0 to exclude. */
#define ENABLE_BIOS_WINI 0 /* enable BIOS winchester driver */
#define ENABLE_ESDI_WINI 0 /* enable ESDI winchester driver */
#define ENABLE_XT_WINI 0 /* enable XT winchester driver */
#define ENABLE_AHA1540 0 /* enable Adaptec 1540 SCSI driver */
#define ENABLE_FATFILE 0 /* enable FAT file virtual disk driver */
#define ENABLE_DOSFILE 0 /* enable DOS file virtual disk driver */
#define ENABLE_SB16 0 /* enable Soundblaster audio driver */
#define ENABLE_PCI 1 /* enable PCI device recognition */
/* Include or exclude user-level device drivers (and supporting servers). */
#define ENABLE_PRINTER 1 /* user-level Centronics printer driver */
#define ENABLE_FLOPPY 1 /* enable floppy disk driver */
#define ENABLE_AT_WINI 1 /* enable AT winchester driver */
#define ENABLE_ATAPI 1 /* add ATAPI support to AT driver */
/* DMA_SECTORS may be increased to speed up DMA based drivers. */
#define DMA_SECTORS 1 /* DMA buffer size (must be >= 1) */
/* Enable or disable networking drivers. */
#define ENABLE_DP8390 0 /* enable DP8390 ethernet driver */
#define ENABLE_WDETH 0 /* add Western Digital WD80x3 */
#define ENABLE_NE2000 0 /* add Novell NE1000/NE2000 */
#define ENABLE_3C503 0 /* add 3Com Etherlink II (3c503) */
#define ENABLE_RTL8139 1 /* enable Realtek 8139 (rtl8139) */
/* Include or exclude backwards compatibility code. */
#define ENABLE_BINCOMPAT 0 /* for binaries using obsolete calls */
#define ENABLE_SRCCOMPAT 0 /* for sources using obsolete calls */
/* Include or exclude security sensitive code, i.e., enable or disable certain
* code sections that would allow special priviliges to user-level processes.
*/
#define ENABLE_USERPRIV 1 /* allow special user mode privileges */
/* User mode privileges. Be careful to set these security related features.
* USERBIOS allows user processes to perform INT86, GLDT86, and SLDT86 MIOC
* calls; USERIOPL set the CPU's I/O Protection Level bits so that user
* processes can access I/O on opening /dev/mem/ or /dev/kmem/. In normal
* operation, only the kernel should be trusted to do all this. Note that
* ENABLE_USERPRIV must be set to 1 to allow the features anyway.
*/
#define ENABLE_USERBIOS 0 /* enable user mode BIOS calls */
#define ENABLE_LOOSELDT 0 /* allow imprecise, page based LDT entries */
#define ENABLE_USERIOPL 1 /* enable CPU's IOPL bits for /dev/(k)mem */
/* NR_CONS, NR_RS_LINES, and NR_PTYS determine the number of terminals the
* system can handle.
*/
#define NR_CONS 4 /* # system consoles (1 to 8) */
#define NR_RS_LINES 0 /* # rs232 terminals (0 to 4) */
#define NR_PTYS 0 /* # pseudo terminals (0 to 64) */
#define ENABLE_MESSAGE_STATS 0
/*===========================================================================*
* 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) */
/* Set the FP_FORMAT type based on the machine selected, either hw or sw */
#define FP_NONE 0 /* no floating point support */
#define FP_IEEE 1 /* conform IEEE floating point standard */
#if (MACHINE == IBM_PC)
#define CHIP INTEL
#endif
#if (MACHINE == ATARI) || (MACHINE == AMIGA) || (MACHINE == MACINTOSH)
#define CHIP M68000
#endif
#if (MACHINE == SUN_4) || (MACHINE == SUN_4_60)
#define CHIP SPARC
#define FP_FORMAT FP_IEEE
#endif
#if (MACHINE == ATARI) || (MACHINE == SUN_4)
#define ASKDEV 1 /* ask for boot device */
#define FASTLOAD 1 /* use multiple block transfers to init ram */
#endif
#if (ATARI_TYPE == TT) /* and all other 68030's */
#define FPP
#endif
#ifndef FP_FORMAT
#define FP_FORMAT FP_NONE
#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
#endif /* _CONFIG_H */

115
include/minix/const.h Executable file
View File

@@ -0,0 +1,115 @@
/* Copyright (C) 2001 by Prentice-Hall, Inc. See the copyright notice in
* the file /usr/src/LICENSE.
*/
#ifndef CHIP
#error CHIP is not defined
#endif
#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 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 */
#define NULL ((void *)0) /* null pointer */
#define CPVEC_NR 16 /* max # of entries in a SYS_VCOPY request */
#define CPVVEC_NR 64 /* max # of entries in a SYS_VCOPY request */
#define NR_IOREQS MIN(NR_BUFS, 64)
/* maximum number of entries in an iorequest */
#define SEGMENT_TYPE 0xFF00 /* bit mask to get segment type */
#define SEGMENT_INDEX 0x00FF /* bit mask to get segment index */
#define LOCAL_SEG 0x0000 /* flags indicating local memory segment */
#define NR_LOCAL_SEGS 3 /* # local segments per process (fixed) */
#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 REMOTE_SEG 0x0100 /* flags indicating remote memory segment */
#define NR_REMOTE_SEGS 3 /* # remote memory regions (variable) */
#define BIOS_SEG 0x0200 /* flags indicating BIOS memory segment */
#define NR_BIOS_SEGS 3 /* # BIOS memory regions (variable) */
/* Labels used to disable code sections for different reasons. */
#define DEAD_CODE 0 /* unused code in normal configuration */
#define FUTURE_CODE 0 /* new code to be activated + tested later */
#define TEMP_CODE 1 /* active code to be removed later */
/* Process name length in the process table, including '\0'. */
#define PROC_NAME_LEN 16
/* Miscellaneous */
#define BYTE 0377 /* mask for 8 bits */
#define READING 0 /* copy data to user */
#define WRITING 1 /* copy data from user */
#define NO_NUM 0x8000 /* used as numerical argument to panic() */
#define NIL_PTR (char *) 0 /* generally useful expression */
#define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
/* Macros. */
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
/* Memory is allocated in clicks. */
#if (CHIP == INTEL)
#define CLICK_SIZE 1024 /* unit in which memory is allocated */
#define CLICK_SHIFT 10 /* log2 of CLICK_SIZE */
#endif
#if (CHIP == SPARC) || (CHIP == M68000)
#define CLICK_SIZE 4096 /* unit in which memory is allocated */
#define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
#endif
/* Click to byte conversions (and vice versa). */
#define HCLICK_SHIFT 4 /* log2 of HCLICK_SIZE */
#define HCLICK_SIZE 16 /* hardware segment conversion magic */
#if CLICK_SIZE >= HCLICK_SIZE
#define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
#else
#define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
#endif
#define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
#define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
#define ABS -999 /* this process means absolute memory */
/* 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 */
/* Some limits. */
#define MAX_BLOCK_NR ((block_t) 077777777) /* largest block number */
#define HIGHEST_ZONE ((zone_t) 077777777) /* largest zone number */
#define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */
#define MAX_FILE_POS ((off_t) 037777777777) /* largest legal file offset */
#define NO_BLOCK ((block_t) 0) /* absence of a block number */
#define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
#define NO_ZONE ((zone_t) 0) /* absence of a zone number */
#define NO_DEV ((dev_t) 0) /* absence of a device numb */

57
include/minix/devio.h Normal file
View File

@@ -0,0 +1,57 @@
/* This file provides basic types and some constants for the
* SYS_DEVIO and SYS_VDEVIO system calls, which allow user-level
* processes to perform device I/O.
*
* Created:
* Apr 08, 2004 by Jorrit N. Herder
*/
#ifndef _DEVIO_H
#define _DEVIO_H
#include <minix/config.h> /* needed to include <minix/type.h> */
#include <sys/types.h> /* u8_t, u16_t, u32_t needed */
/* We have different granularities of port I/O: 8, 16, 32 bits.
* Also see <ibm/portio.h>, which has functions for bytes, words,
* and longs. Hence, we need different (port,value)-pair types.
*/
typedef struct { u16_t port; u8_t value; } pvb_pair_t;
typedef struct { u16_t port; u16_t value; } pvw_pair_t;
typedef struct { u16_t port; u32_t value; } pvl_pair_t;
/* Macro shorthand to set (port,value)-pair. */
#define pv_set(pv, p, v) ((pv).port = (p), (pv).value = (v))
#define pv_ptr_set(pv_ptr, p, v) ((pv_ptr)->port = (p), (pv_ptr)->value = (v))
#if 0 /* no longer in use !!! */
/* Define a number of flags to indicate granularity we are using. */
#define MASK_GRANULARITY 0x000F /* not in use! does not match flags */
#define PVB_FLAG 'b'
#define PVW_FLAG 'w'
#define PVL_FLAG 'l'
/* Flags indicating whether request wants to do input or output. */
#define MASK_IN_OR_OUT 0x00F0
#define DEVIO_INPUT 0x0010
#define DEVIO_OUTPUT 0x0020
#endif /* 0 */
#if 0 /* no longer used !!! */
/* Define how large the (port,value)-pair buffer in the kernel is.
* This buffer is used to copy the (port,value)-pairs in kernel space.
*/
#define PV_BUF_SIZE 64 /* creates char pv_buf[PV_BUF_SIZE] */
/* Note that SYS_VDEVIO sends a pointer to a vector of (port,value)-pairs,
* whereas SYS_DEVIO includes a single (port,value)-pair in the messages.
* Calculate maximum number of (port,value)-pairs that can be handled
* in a single SYS_VDEVIO system call with above struct definitions.
*/
#define MAX_PVB_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvb_pair_t))
#define MAX_PVW_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvw_pair_t))
#define MAX_PVL_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvl_pair_t))
#endif /* 0 */
#endif /* _DEVIO_H */

26
include/minix/dl_eth.h Executable file
View File

@@ -0,0 +1,26 @@
/* The eth_stat struct is used in a DL_GETSTAT request the the ehw_task. */
#ifndef _ETH_HW_H
#define _ETH_HW_H
typedef struct eth_stat
{
unsigned long ets_recvErr, /* # receive errors */
ets_sendErr, /* # send error */
ets_OVW, /* # buffer overwrite warnings */
ets_CRCerr, /* # crc errors of read */
ets_frameAll, /* # frames not alligned (# bits % 8 != 0) */
ets_missedP, /* # packets missed due to slow processing */
ets_packetR, /* # packets received */
ets_packetT, /* # packets transmitted */
ets_transDef, /* # transmission defered (Tx was busy) */
ets_collision, /* # collissions */
ets_transAb, /* # Tx aborted due to excess collisions */
ets_carrSense, /* # carrier sense lost */
ets_fifoUnder, /* # FIFO underruns (processor too busy) */
ets_fifoOver, /* # FIFO overruns (processor too busy) */
ets_CDheartbeat, /* # times unable to transmit collision sig*/
ets_OWC; /* # times out of window collision */
} eth_stat_t;
#endif /* _ETH_HW_H */

11
include/minix/fslib.h Executable file
View File

@@ -0,0 +1,11 @@
/* V1 and V2 file system disk to/from memory support functions. */
_PROTOTYPE( int bitmapsize, (bit_t _nr_bits, int block_size) );
_PROTOTYPE( unsigned conv2, (int _norm, int _w) );
_PROTOTYPE( long conv4, (int _norm, long _x) );
_PROTOTYPE( void conv_inode, (struct inode *_rip, d1_inode *_dip,
d2_inode *_dip2, int _rw_flag, int _magic) );
_PROTOTYPE( void old_icopy, (struct inode *_rip, d1_inode *_dip,
int _direction, int _norm));
_PROTOTYPE( void new_icopy, (struct inode *_rip, d2_inode *_dip,
int _direction, int _norm));

44
include/minix/ioctl.h Executable file
View File

@@ -0,0 +1,44 @@
/* minix/ioctl.h - Ioctl helper definitions. Author: Kees J. Bot
* 23 Nov 2002
*
* This file is included by every header file that defines ioctl codes.
*/
#ifndef _M_IOCTL_H
#define _M_IOCTL_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
#if _EM_WSIZE >= 4
/* Ioctls have the command encoded in the low-order word, and the size
* of the parameter in the high-order word. The 3 high bits of the high-
* order word are used to encode the in/out/void status of the parameter.
*/
#define _IOCPARM_MASK 0x1FFF
#define _IOC_VOID 0x20000000
#define _IOCTYPE_MASK 0xFFFF
#define _IOC_IN 0x40000000
#define _IOC_OUT 0x80000000
#define _IOC_INOUT (_IOC_IN | _IOC_OUT)
#define _IO(x,y) ((x << 8) | y | _IOC_VOID)
#define _IOR(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
_IOC_OUT)
#define _IOW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
_IOC_IN)
#define _IORW(x,y,t) ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
_IOC_INOUT)
#else
/* No fancy encoding on a 16-bit machine. */
#define _IO(x,y) ((x << 8) | y)
#define _IOR(x,y,t) _IO(x,y)
#define _IOW(x,y,t) _IO(x,y)
#define _IORW(x,y,t) _IO(x,y)
#endif
int ioctl(int _fd, int _request, void *_data);
#endif /* _M_IOCTL_H */

107
include/minix/ipc.h Normal file
View File

@@ -0,0 +1,107 @@
#ifndef _IPC_H
#define _IPC_H
/*==========================================================================*
* 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, m4l5;} mess_4;
typedef struct {short m5c1, m5c2; int m5i1, m5i2; long m5l1, m5l2, m5l3;}mess_5;
#if 0
typedef struct {int m6i1, m6i2, m6i3; long m6l1; char *m6c1;} mess_6;
#endif
typedef struct {int m7i1, m7i2, m7i3, m7i4; char *m7p1, *m7p2;} mess_7;
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;
#if 0
mess_6 m_m6;
#endif
mess_7 m_m7;
} m_u;
} message;
/* 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 m4_l5 m_u.m_m4.m4l5
#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
#if 0
#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_c1 m_u.m_m6.m6c1
#endif
#define m7_i1 m_u.m_m7.m7i1
#define m7_i2 m_u.m_m7.m7i2
#define m7_i3 m_u.m_m7.m7i3
#define m7_i4 m_u.m_m7.m7i4
#define m7_p1 m_u.m_m7.m7p1
#define m7_p2 m_u.m_m7.m7p2
/*==========================================================================*
* Minix run-time system (IPC). *
*==========================================================================*/
/* Hide names to avoid name space pollution. */
#define sendrec _sendrec
#define receive _receive
#define send _send
#define nb_receive _nb_receive
#define nb_send _nb_send
_PROTOTYPE( int sendrec, (int src_dest, message *m_ptr) );
_PROTOTYPE( int receive, (int src, message *m_ptr) );
_PROTOTYPE( int send, (int dest, message *m_ptr) );
_PROTOTYPE( int nb_receive, (int src, message *m_ptr) );
_PROTOTYPE( int nb_send, (int dest, message *m_ptr) );
#endif /* _IPC_H */

87
include/minix/jmp_buf.h Executable file
View File

@@ -0,0 +1,87 @@
/* This file is intended for use by assembly language programs that
* need to manipulate a jmp_buf. It may only be used by those systems
* for which a jmp_buf is identical to a struct sigcontext.
*/
#ifndef _JMP_BUF_H
#define _JMP_BUF_H
#if !defined(CHIP)
#include "error, configuration is not known"
#endif
#if (CHIP == INTEL)
#if _WORD_SIZE == 4
#define JB_FLAGS 0
#define JB_MASK 4
#define JB_GS 8
#define JB_FS 10
#define JB_ES 12
#define JB_DS 14
#define JB_DI 16
#define JB_SI 20
#define JB_BP 24
#define JB_ST 28
#define JB_BX 32
#define JB_DX 36
#define JB_CX 40
#define JB_AX 44
#define JB_RETADR 48
#define JB_IP 52
#define JB_CS 56
#define JB_PSW 60
#define JB_SP 64
#define JB_SS 68
#else /* _WORD_SIZE == 2 */
#define JB_FLAGS 0
#define JB_MASK 2
#define JB_ES 6
#define JB_DS 8
#define JB_DI 10
#define JB_SI 12
#define JB_BP 14
#define JB_ST 16
#define JB_BX 18
#define JB_DX 20
#define JB_CX 22
#define JB_AX 24
#define JB_RETADR 26
#define JB_IP 28
#define JB_CS 30
#define JB_PSW 32
#define JB_SP 34
#define JB_SS 36
#endif /* _WORD_SIZE == 2 */
#else /* !(CHIP == INTEL) */
#if (CHIP == M68000)
#define JB_FLAGS 0
#define JB_MASK 2
#define JB_RETREG 6
#define JB_D1 10
#define JB_D2 14
#define JB_D3 18
#define JB_D4 22
#define JB_D5 26
#define JB_D6 20
#define JB_D7 34
#define JB_A0 38
#define JB_A1 42
#define JB_A2 46
#define JB_A3 50
#define JB_A4 54
#define JB_A5 58
#define JB_A6 62
#define JB_SP 66
#define JB_PC 70
#define JB_PSW 74
#else /* !(CHIP == INTEL) && !(CHIP == M68000) */
#include "error, CHIP is not supported"
#endif /* (CHIP == INTEL) */
/* Defines from C headers needed in assembly code. The headers have too
* much C stuff to used directly.
*/
#define SIG_BLOCK 0 /* must agree with <signal.h> */
#define SC_SIGCONTEXT 2 /* must agree with <sys/sigcontext.h> */
#define SC_NOREGLOCALS 4 /* must agree with <sys/sigcontext.h> */
#endif /* _JMP_BUF_H */

146
include/minix/keymap.h Executable file
View File

@@ -0,0 +1,146 @@
/* keymap.h - defines for keymapping Author: Marcus Hampel
*/
#ifndef _SYS__KEYMAP_H
#define _SYS__KEYMAP_H
#define C(c) ((c) & 0x1F) /* Map to control code */
#define A(c) ((c) | 0x80) /* Set eight bit (ALT) */
#define CA(c) A(C(c)) /* Control-Alt */
#define L(c) ((c) | HASCAPS) /* Add "Caps Lock has effect" attribute */
#define EXT 0x0100 /* Normal function keys */
#define CTRL 0x0200 /* Control key */
#define SHIFT 0x0400 /* Shift key */
#define ALT 0x0800 /* Alternate key */
#define EXTKEY 0x1000 /* extended keycode */
#define HASCAPS 0x8000 /* Caps Lock has effect */
/* Scan code conversion. */
#define KEY_RELEASE 0200
#define ASCII_MASK 0177
/* Numeric keypad */
#define HOME (0x01 + EXT)
#define END (0x02 + EXT)
#define UP (0x03 + EXT)
#define DOWN (0x04 + EXT)
#define LEFT (0x05 + EXT)
#define RIGHT (0x06 + EXT)
#define PGUP (0x07 + EXT)
#define PGDN (0x08 + EXT)
#define MID (0x09 + EXT)
#define NMIN (0x0A + EXT)
#define PLUS (0x0B + EXT)
#define INSRT (0x0C + EXT)
/* Alt + Numeric keypad */
#define AHOME (0x01 + ALT)
#define AEND (0x02 + ALT)
#define AUP (0x03 + ALT)
#define ADOWN (0x04 + ALT)
#define ALEFT (0x05 + ALT)
#define ARIGHT (0x06 + ALT)
#define APGUP (0x07 + ALT)
#define APGDN (0x08 + ALT)
#define AMID (0x09 + ALT)
#define ANMIN (0x0A + ALT)
#define APLUS (0x0B + ALT)
#define AINSRT (0x0C + ALT)
/* Ctrl + Numeric keypad */
#define CHOME (0x01 + CTRL)
#define CEND (0x02 + CTRL)
#define CUP (0x03 + CTRL)
#define CDOWN (0x04 + CTRL)
#define CLEFT (0x05 + CTRL)
#define CRIGHT (0x06 + CTRL)
#define CPGUP (0x07 + CTRL)
#define CPGDN (0x08 + CTRL)
#define CMID (0x09 + CTRL)
#define CNMIN (0x0A + CTRL)
#define CPLUS (0x0B + CTRL)
#define CINSRT (0x0C + CTRL)
/* Lock keys */
#define CALOCK (0x0D + EXT) /* caps lock */
#define NLOCK (0x0E + EXT) /* number lock */
#define SLOCK (0x0F + EXT) /* scroll lock */
/* Function keys */
#define F1 (0x10 + EXT)
#define F2 (0x11 + EXT)
#define F3 (0x12 + EXT)
#define F4 (0x13 + EXT)
#define F5 (0x14 + EXT)
#define F6 (0x15 + EXT)
#define F7 (0x16 + EXT)
#define F8 (0x17 + EXT)
#define F9 (0x18 + EXT)
#define F10 (0x19 + EXT)
#define F11 (0x1A + EXT)
#define F12 (0x1B + EXT)
/* Alt+Fn */
#define AF1 (0x10 + ALT)
#define AF2 (0x11 + ALT)
#define AF3 (0x12 + ALT)
#define AF4 (0x13 + ALT)
#define AF5 (0x14 + ALT)
#define AF6 (0x15 + ALT)
#define AF7 (0x16 + ALT)
#define AF8 (0x17 + ALT)
#define AF9 (0x18 + ALT)
#define AF10 (0x19 + ALT)
#define AF11 (0x1A + ALT)
#define AF12 (0x1B + ALT)
/* Ctrl+Fn */
#define CF1 (0x10 + CTRL)
#define CF2 (0x11 + CTRL)
#define CF3 (0x12 + CTRL)
#define CF4 (0x13 + CTRL)
#define CF5 (0x14 + CTRL)
#define CF6 (0x15 + CTRL)
#define CF7 (0x16 + CTRL)
#define CF8 (0x17 + CTRL)
#define CF9 (0x18 + CTRL)
#define CF10 (0x19 + CTRL)
#define CF11 (0x1A + CTRL)
#define CF12 (0x1B + CTRL)
/* Shift+Fn */
#define SF1 (0x10 + SHIFT)
#define SF2 (0x11 + SHIFT)
#define SF3 (0x12 + SHIFT)
#define SF4 (0x13 + SHIFT)
#define SF5 (0x14 + SHIFT)
#define SF6 (0x15 + SHIFT)
#define SF7 (0x16 + SHIFT)
#define SF8 (0x17 + SHIFT)
#define SF9 (0x18 + SHIFT)
#define SF10 (0x19 + SHIFT)
#define SF11 (0x1A + SHIFT)
#define SF12 (0x1B + SHIFT)
/* Alt+Shift+Fn */
#define ASF1 (0x10 + ALT + SHIFT)
#define ASF2 (0x11 + ALT + SHIFT)
#define ASF3 (0x12 + ALT + SHIFT)
#define ASF4 (0x13 + ALT + SHIFT)
#define ASF5 (0x14 + ALT + SHIFT)
#define ASF6 (0x15 + ALT + SHIFT)
#define ASF7 (0x16 + ALT + SHIFT)
#define ASF8 (0x17 + ALT + SHIFT)
#define ASF9 (0x18 + ALT + SHIFT)
#define ASF10 (0x19 + ALT + SHIFT)
#define ASF11 (0x1A + ALT + SHIFT)
#define ASF12 (0x1B + ALT + SHIFT)
#define MAP_COLS 6 /* Number of columns in keymap */
#define NR_SCAN_CODES 0x80 /* Number of scan codes (rows in keymap) */
typedef unsigned short keymap_t[NR_SCAN_CODES * MAP_COLS];
#define KEY_MAGIC "KMAZ" /* Magic number of keymap file */
#endif /* _SYS__KEYMAP_H */

23
include/minix/minlib.h Executable file
View File

@@ -0,0 +1,23 @@
#ifndef _MINLIB
#define _MINLIB
#ifndef _ANSI_H
#include <ansi.h>
#endif
/* Miscellaneous BSD. */
_PROTOTYPE(void swab, (char *_from, char *_to, int _count));
_PROTOTYPE(char *itoa, (int _n));
_PROTOTYPE(char *getpass, (const char *_prompt));
/* Miscellaneous MINIX. */
_PROTOTYPE(void std_err, (char *_s));
_PROTOTYPE(void prints, (const char *_s, ...));
_PROTOTYPE(int fsversion, (char *_dev, char *_prog));
_PROTOTYPE(int getprocessor, (void));
_PROTOTYPE(int load_mtab, (char *_prog_name));
_PROTOTYPE(int rewrite_mtab, (char *_prog_name));
_PROTOTYPE(int get_mtab_entry, (char *_s1, char *_s2, char *_s3, char *_s4));
_PROTOTYPE(int put_mtab_entry, (char *_s1, char *_s2, char *_s3, char *_s4));
#endif

21
include/minix/partition.h Executable file
View File

@@ -0,0 +1,21 @@
/* minix/partition.h Author: Kees J. Bot
* 7 Dec 1995
* Place of a partition on disk and the disk geometry,
* for use with the DIOCGETP and DIOCSETP ioctl's.
*/
#ifndef _MINIX__PARTITION_H
#define _MINIX__PARTITION_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
struct partition {
u64_t base; /* byte offset to the partition start */
u64_t size; /* number of bytes in the partition */
unsigned cylinders; /* disk geometry */
unsigned heads;
unsigned sectors;
};
#endif /* _MINIX__PARTITION_H */

View File

@@ -0,0 +1,36 @@
#ifndef __SERVERASSERT_H
#define __SERVERASSERT_H
/* This file contains functions and macros used for debugging within
* system servers. Also see <assert.h> which is used in regular programs.
*/
#ifndef NDEBUG /* 8086 must do without training wheels. */
#define NDEBUG (_WORD_SIZE == 2)
#endif
#if !NDEBUG
#define INIT_SERVER_ASSERT static char *server_assert_file= __FILE__;
void server_assert_failed(char *file, int line, char *what);
void server_compare_failed(char *file, int line, int lhs, char *what, int rhs);
#define server_assert(x) (!(x) ? server_assert_failed( \
server_assert_file, __LINE__, #x) : (void) 0)
#define server_compare(a,t,b) (!((a) t (b)) ? server_compare_failed( \
server_assert_file, __LINE__, (a), #a " " #t " " #b, (b)) : (void) 0)
#else /* NDEBUG */
#define INIT_SERVER_ASSERT /* nothing */
#define server_assert(x) (void) 0
#define server_compare(a,t,b) (void) 0
#endif /* NDEBUG */
#endif /* __SERVERASSERT_H */

46
include/minix/sound.h Executable file
View File

@@ -0,0 +1,46 @@
/* Definitions used by /dev/audio and /dev/mixer.
*
* Feb 13 1995 Author: Michel R. Prevenier
*/
#ifndef SOUND_H
#define SOUND_H
/* ------- Mixer stuff ------- */
/* Available devices */
enum Device
{
Master, /* Master volume */
Dac, /* DSP, digitized sound */
Fm, /* Fm synthesized sound */
Cd, /* Compact */
Line, /* Line in */
Mic, /* Microphone */
Speaker, /* Pc speaker */
Treble, /* Treble */
Bass /* Bass */
};
enum InputState
{
ON, OFF
};
/* Volume levels range from 0 to 31, bass & treble range from 0 to 15 */
struct volume_level
{
enum Device device;
int left;
int right;
};
struct inout_ctrl
{
enum Device device;
enum InputState left;
enum InputState right;
};
#endif /* SOUND_H */

48
include/minix/swap.h Executable file
View File

@@ -0,0 +1,48 @@
/*
minix/swap.h
Defines the super block of swap partitions and some useful constants.
Created: Aug 2, 1992 by Philip Homburg
*/
#ifndef _MINIX__SWAP_H
#define _MINIX__SWAP_H
/* Two possible layouts for a partition with swapspace:
*
* Sector Swap partition FS+swap partition
*
* 0 - 1 bootblock bootblock
* 2 swap header FS header
* 3 blank swap header
* 4 - m swapspace file system
* m+1 - n - swapspace
*/
#define SWAP_MAGIC0 0x9D
#define SWAP_MAGIC1 0xC3
#define SWAP_MAGIC2 0x01
#define SWAP_MAGIC3 0x82
typedef struct swap_hdr
{
u8_t sh_magic[4];
u8_t sh_version;
u8_t sh_dummy[3];
u32_t sh_offset;
u32_t sh_swapsize;
i32_t sh_priority;
} swap_hdr_t;
#define SWAP_BOOTOFF 1024
#define SWAP_OFFSET 2048
#define OPTSWAP_BOOTOFF (1024+512)
#define SH_VERSION 1
#define SH_PRIORITY 0
#endif /* _MINIX__SWAP_H */
/*
* $PchId: swap.h,v 1.6 1996/04/10 20:25:48 philip Exp $
*/

169
include/minix/syslib.h Executable file
View File

@@ -0,0 +1,169 @@
/* Prototypes for system library functions.
*
* Changes:
* Nov 15, 2004 unified sys_sigctl calls (Jorrit N. Herder)
* Oct 28, 2004 added nb_send, nb_receive (Jorrit N. Herder)
* Oct 26, 2004 added sys_sdevio (Jorrit N. Herder)
* Oct 18, 2004 added sys_irqctl (Jorrit N. Herder)
* Oct 10, 2004 removed sys_findproc (Jorrit N. Herder)
* Sep 23, 2004 added sys_getsig (Jorrit N. Herder)
* Sep 09, 2004 added sys_physcopy, sys_vircopy (Jorrit N. Herder)
* Sep 02, 2004 added sys_exit (Jorrit N. Herder)
* Aug 15, 2004 added sys_getinfo (Jorrit N. Herder)
* Jul 23, 2004 added sys_umap (Jorrit N. Herder)
* Jul 13, 2004 added sys_enable_iop, sys_phys2seg (Jorrit N. Herder)
* Mar 20, 2004 added sys_devio, sys_vdevio (Jorrit N. Herder)
*/
#ifndef _SYSLIB_H
#define _SYSLIB_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
#ifndef _IPC_H
#include <minix/ipc.h>
#endif
#ifndef _DEVIO_H
#include <minix/devio.h>
#endif
/*==========================================================================*
* Minix system library. *
*==========================================================================*/
_PROTOTYPE( int printf, (const char *fmt, ...) );
_PROTOTYPE( void kputc, (int c) );
_PROTOTYPE( int _taskcall, (int who, int syscallnr, message *msgptr) );
_PROTOTYPE( int sys_abort, (int how, ...) );
_PROTOTYPE( int sys_adjmap, (int proc, struct mem_map *ptr,
vir_clicks data_clicks, vir_clicks sp) );
_PROTOTYPE( int sys_copy, (int src_proc, int src_seg, phys_bytes src_vir,
int dst_proc, int dst_seg, phys_bytes dst_vir, phys_bytes bytes));
_PROTOTYPE( int sys_exec, (int proc, char *ptr, int traced,
char *aout, vir_bytes initpc) );
_PROTOTYPE( int sys_execmap, (int proc, struct mem_map *ptr) );
_PROTOTYPE( int sys_fork, (int parent, int child, int pid) );
_PROTOTYPE( int sys_getsp, (int proc, vir_bytes *newsp) );
_PROTOTYPE( int sys_newmap, (int proc, struct mem_map *ptr) );
_PROTOTYPE( int sys_getmap, (int proc, struct mem_map *ptr) );
_PROTOTYPE( int sys_times, (int proc_nr, clock_t *ptr) );
_PROTOTYPE( int sys_getuptime, (clock_t *ticks) );
_PROTOTYPE( int sys_trace, (int req, int proc, long addr, long *data_p) );
_PROTOTYPE( int sys_xit, (int parent, int proc) );
_PROTOTYPE( int sys_kill, (int proc, int sig) );
_PROTOTYPE( int sys_svrctl, (int proc, int req, int priv,vir_bytes argp));
/*==========================================================================*
* New prototypes since MINIX release 2 (Jorrit N. Herder) *
*==========================================================================*/
/* Shorthands for sys_sdevio() system call. */
#define sys_insb(port, proc_nr, buffer, count) \
sys_sdevio(DIO_INPUT, port, DIO_BYTE, proc_nr, buffer, count)
#define sys_insw(port, proc_nr, buffer, count) \
sys_sdevio(DIO_INPUT, port, DIO_WORD, proc_nr, buffer, count)
#define sys_outsb(port, proc_nr, buffer, count) \
sys_sdevio(DIO_OUTPUT, port, DIO_BYTE, proc_nr, buffer, count)
#define sys_outsw(port, proc_nr, buffer, count) \
sys_sdevio(DIO_OUTPUT, port, DIO_WORD, proc_nr, buffer, count)
_PROTOTYPE( int sys_sdevio, (int req, long port, int type, int proc_nr,
void *buffer, int count) );
/* Clock functionality: (un)schedule an alarm call. */
_PROTOTYPE(int sys_flagalrm, (clock_t ticks, int *flag_ptr) );
_PROTOTYPE(int sys_signalrm, (int proc_nr, clock_t *ticks) );
_PROTOTYPE(int sys_syncalrm, (int proc_nr, clock_t exp_time, int abs_time) );
/* Shorthands for sys_irqctl() system call. */
#define sys_irqdisable(irq_vec) \
sys_irqctl(IRQ_DISABLE, irq_vec, 0, 0, 0, 0, 0)
#define sys_irqenable(irq_vec) \
sys_irqctl(IRQ_ENABLE, irq_vec, 0, 0, 0, 0, 0)
#define sys_irqsetpolicy(irq_vec, policy, proc_nr, port, val_ptr, mask_val) \
sys_irqctl(IRQ_SETPOLICY, irq_vec, policy, proc_nr, port, val_ptr, mask_val)
_PROTOTYPE ( int sys_irqctl, (int request, int irq_vec, int policy,
int proc_nr, long port, void *val_ptr, long mask_val) );
/* Shorthands for sys_vircopy() system call. */
#define sys_biosin(bios_vir, dst_vir, bytes) \
sys_vircopy(SELF, BIOS_SEG, bios_vir, SELF, D, dst_vir, bytes)
#define sys_biosout(src_vir, bios_vir, bytes) \
sys_vircopy(SELF, D, src_vir, SELF, BIOS_SEG, bios_vir, bytes)
#define sys_datacopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
sys_vircopy(src_proc, D, src_vir, dst_proc, D, dst_vir, bytes)
#define sys_textcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
sys_vircopy(src_proc, T, src_vir, dst_proc, T, dst_vir, bytes)
#define sys_stackcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
sys_vircopy(src_proc, S, src_vir, dst_proc, S, dst_vir, bytes)
_PROTOTYPE(int sys_vircopy, (int src_proc, int src_seg, vir_bytes src_vir,
int dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes) );
_PROTOTYPE(int sys_physcopy, (phys_bytes src_phys, phys_bytes dst_phys,
phys_bytes bytes) );
_PROTOTYPE(int sys_umap, (int proc_nr, int seg, vir_bytes vir_addr,
vir_bytes bytes, phys_bytes *phys_addr) );
_PROTOTYPE(int sys_phys2seg, (u16_t *seg,vir_bytes *off,phys_bytes phys, vir_bytes size));
_PROTOTYPE(int sys_enable_iop, (int proc_nr) );
_PROTOTYPE(int sys_kmalloc, (size_t size, phys_bytes *phys_base) );
/* Shorthands for sys_getinfo() system call. */
#define sys_getkmessages(dst) sys_getinfo(GET_KMESSAGES, dst, 0,0,0)
#define sys_getkenviron(dst) sys_getinfo(GET_KENVIRON, dst, 0,0,0)
#define sys_getproctab(dst) sys_getinfo(GET_PROCTAB, dst, 0,0,0)
#define sys_getproc(dst,nr) sys_getinfo(GET_PROC, dst, 0,0, nr)
#define sys_getprocnr(dst,k,kl) sys_getinfo(GET_PROCNR, dst, 0,k,kl)
#define sys_getimage(dst) sys_getinfo(GET_IMAGE, dst, 0,0,0)
#define sys_getirqtab(dst) sys_getinfo(GET_IRQTAB, dst, 0,0,0)
#define sys_getmemchunks(dst) sys_getinfo(GET_MEMCHUNKS, dst, 0,0,0)
#define sys_getmonparams(v,vl) sys_getinfo(GET_MONPARAMS, v,vl, 0,0)
#define sys_getkenv(k,kl,v,vl) sys_getinfo(GET_KENV, v,vl, k,kl)
#define sys_getschedinfo(v1,v2) sys_getinfo(GET_SCHEDINFO, v1,0, v2,0)
#define sys_getkaddr(dst) sys_getinfo(GET_KADDRESSES, dst, 0,0,0)
_PROTOTYPE(int sys_getinfo, (int request, void *val_ptr, int val_len,
void *key_ptr, int key_len) );
_PROTOTYPE(int sys_exit, (int status) );
/* Shorthands for sys_sigctl() system call. */
#define sys_getsig(proc_nr, sig_map) \
sys_sigctl(S_GETSIG, 0,0,0, proc_nr, sig_map)
#define sys_endsig(proc_nr) \
sys_sigctl(S_ENDSIG, proc_nr, 0,0,0,0)
#define sys_sendsig(proc_nr, sig_ctxt) \
sys_sigctl(S_SENDSIG, proc_nr, sig_ctxt, 0,0,0)
#define sys_sigreturn(proc_nr, sig_ctxt, flags) \
sys_sigctl(S_SIGRETURN, proc_nr, sig_ctxt, flags, 0,0)
_PROTOTYPE(int sys_sigctl, (int request, int proc_nr, struct sigmsg *sig_ctxt,
int flags, int *k_proc_nr, sigset_t *k_sig_map) );
/* NOTE: two different approaches were used to distinguish the device I/O
* types 'byte', 'word', 'long': the latter uses #define and results in a
* smaller implementation, but looses the static type checking.
*/
_PROTOTYPE(int sys_voutb, (pvb_pair_t *pvb_pairs, int nr_ports) );
_PROTOTYPE(int sys_voutw, (pvw_pair_t *pvw_pairs, int nr_ports) );
_PROTOTYPE(int sys_voutl, (pvl_pair_t *pvl_pairs, int nr_ports) );
_PROTOTYPE(int sys_vinb, (pvb_pair_t *pvb_pairs, int nr_ports) );
_PROTOTYPE(int sys_vinw, (pvw_pair_t *pvw_pairs, int nr_ports) );
_PROTOTYPE(int sys_vinl, (pvl_pair_t *pvl_pairs, int nr_ports) );
/* Shorthands for sys_out() system call. */
#define sys_outb(p,v) sys_out((p), (unsigned long) (v), DIO_BYTE)
#define sys_outw(p,v) sys_out((p), (unsigned long) (v), DIO_WORD)
#define sys_outl(p,v) sys_out((p), (unsigned long) (v), DIO_LONG)
_PROTOTYPE(int sys_out, (int port, unsigned long value, int type) );
/* Shorthands for sys_in() system call. */
#define sys_inb(p,v) sys_in((p), (unsigned long*) (v), DIO_BYTE)
#define sys_inw(p,v) sys_in((p), (unsigned long*) (v), DIO_WORD)
#define sys_inl(p,v) sys_in((p), (unsigned long*) (v), DIO_LONG)
_PROTOTYPE(int sys_in, (int port, unsigned long *value, int type) );
#endif /* _SYSLIB_H */

103
include/minix/type.h Executable file
View File

@@ -0,0 +1,103 @@
#ifndef _TYPE_H
#define _TYPE_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
/* Type definitions. */
typedef unsigned int vir_clicks; /* virtual addresses and lengths in clicks */
typedef unsigned long phys_bytes;/* physical addresses and lengths in bytes */
typedef unsigned int phys_clicks;/* physical addresses and lengths in clicks */
#if (CHIP == INTEL)
typedef unsigned int vir_bytes; /* virtual addresses and lengths in bytes */
#endif
#if (CHIP == M68000)
typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
#endif
#if (CHIP == SPARC)
typedef unsigned long vir_bytes;/* virtual addresses and lengths in bytes */
#endif
struct mem_map {
vir_clicks mem_vir; /* virtual address */
phys_clicks mem_phys; /* physical address */
vir_clicks mem_len; /* length */
};
struct far_mem {
phys_clicks mem_phys; /* physical address */
vir_clicks mem_len; /* length */
};
typedef struct {
vir_bytes iov_addr; /* address of an I/O buffer */
vir_bytes iov_size; /* sizeof an I/O buffer */
} iovec_t;
typedef struct {
vir_bytes cpv_src; /* src address of data */
vir_bytes cpv_dst; /* dst address of data */
vir_bytes cpv_size; /* size of data */
} cpvec_t;
/* virtual copy vector */
typedef struct {
int cpvv_src_seg, cpvv_dst_seg; /* src & dst segments */
vir_bytes cpvv_src; /* src address of data */
vir_bytes cpvv_dst; /* dst address of data */
vir_bytes cpvv_size; /* size of data */
} cpvvec_t;
/* MM passes the address of a structure of this type to KERNEL when
* do_sendsig() is invoked as part of the signal catching mechanism.
* The structure contain all the information that KERNEL needs to build
* the signal stack.
*/
struct sigmsg {
int sm_signo; /* signal number being caught */
unsigned long sm_mask; /* mask to restore when handler returns */
vir_bytes sm_sighandler; /* address of handler */
vir_bytes sm_sigreturn; /* address of _sigreturn in C library */
vir_bytes sm_stkptr; /* user stack pointer */
};
#define MESS_SIZE (sizeof(message)) /* might need usizeof from fs here */
#define NIL_MESS ((message *) 0)
struct psinfo { /* information for the ps(1) program */
u16_t nr_tasks, nr_procs; /* NR_TASKS and NR_PROCS constants. */
vir_bytes proc, mproc, fproc; /* addresses of the main process tables. */
};
/* This is used to obtain system information through SYS_GETINFO. */
struct kenviron {
int pc_at;
int ps_mca;
int processor;
int protected;
int ega;
int vga;
vir_bytes proc_addr; /* virtual address of process table */
phys_bytes kmem_base; /* kernel memory layout (/dev/kmem) */
phys_bytes kmem_size;
phys_bytes bootfs_base; /* FS image from boot image (/dev/boot) */
phys_bytes bootfs_size;
phys_bytes params_base; /* parameters passed by boot monitor */
phys_bytes params_size;
};
/* The kernel outputs messages in a local buffer, which can be requested and
* printed by the TTY driver. The buffer structure is defined here.
*/
struct kmessages {
int km_next; /* next index to write */
int km_size; /* current size in buffer */
char km_buf[KMESS_BUF_SIZE]; /* buffer for messages */
};
#endif /* _TYPE_H */

33
include/minix/u64.h Executable file
View File

@@ -0,0 +1,33 @@
/* minix/u64.h Author: Kees J. Bot
* 7 Dec 1995
* Functions to manipulate 64 bit disk addresses.
*/
#ifndef _MINIX__U64_H
#define _MINIX__U64_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
u64_t add64(u64_t i, u64_t j);
u64_t add64u(u64_t i, unsigned j);
u64_t add64ul(u64_t i, unsigned long j);
u64_t sub64(u64_t i, u64_t j);
u64_t sub64u(u64_t i, unsigned j);
u64_t sub64ul(u64_t i, unsigned long j);
unsigned diff64(u64_t i, u64_t j);
u64_t cvu64(unsigned i);
u64_t cvul64(unsigned long i);
unsigned cv64u(u64_t i);
unsigned long cv64ul(u64_t i);
unsigned long div64u(u64_t i, unsigned j);
unsigned rem64u(u64_t i, unsigned j);
u64_t mul64u(unsigned long i, unsigned j);
int cmp64(u64_t i, u64_t j);
int cmp64u(u64_t i, unsigned j);
int cmp64ul(u64_t i, unsigned long j);
unsigned long ex64lo(u64_t i);
unsigned long ex64hi(u64_t i);
u64_t make64(unsigned long lo, unsigned long hi);
#endif /* _MINIX__U64_H */

52
include/minix/utils.h Normal file
View File

@@ -0,0 +1,52 @@
#ifndef _EXTRALIB_H
#define _EXTRALIB_H
/* Extra system library definitions to support device drivers and servers.
*
* Created:
* Mar 15, 2004 by Jorrit N. Herder
*
* Changes:
* Mar 18, 2005: added tick_delay
* Mar 15, 2005: added get_proc_nr
* Oct 01, 2004: added env_parse, env_prefix, env_panic
* Jul 13, 2004: added fkey_ctl
* Apr 28, 2004: added server_report, server_panic, server_assert
* Mar 31, 2004: setup like other libraries, such as syslib
*/
/*==========================================================================*
* Miscellaneous helper functions.
*==========================================================================*/
#include <minix/serverassert.h>
/* Environment parsing return values. */
#define EP_BUF_SIZE 128 /* local buffer for env value */
#define EP_UNSET 0 /* variable not set */
#define EP_OFF 1 /* var = off */
#define EP_ON 2 /* var = on (or field left blank) */
#define EP_SET 3 /* var = 1:2:3 (nonblank field) */
#define EP_EGETKENV 4 /* sys_getkenv() failed ... */
_PROTOTYPE(int get_mon_param, (char *key, char *value, int max_size) );
_PROTOTYPE(int env_prefix, (char *env, char *prefix) );
_PROTOTYPE(void env_panic, (char *key) );
_PROTOTYPE(int env_parse, (char *env, char *fmt, int field, long *param,
long min, long max) );
#define fkey_enable(fkey) fkey_ctl(fkey, 1)
#define fkey_disable(fkey) fkey_ctl(fkey, 0)
_PROTOTYPE(int fkey_ctl, (int fkey_code, int enable_disable) );
_PROTOTYPE(void server_report, (char *who, char *mess, int num) );
_PROTOTYPE(void server_panic, (char *who, char *mess, int num) );
#define get_own_proc_nr(where) get_proc_nr((where), NULL)
_PROTOTYPE(int get_proc_nr, (int *proc_nr, char *proc_name) );
_PROTOTYPE(int tick_delay, (clock_t ticks));
#endif /* _EXTRALIB_H */

73
include/net/gen/dhcp.h Executable file
View File

@@ -0,0 +1,73 @@
/* net/gen/dhcp.h - DHCP packet format Author: Kees J. Bot
* 1 Dec 2000
*/
#ifndef __NET__GEN__DHCP_H__
#define __NET__GEN__DHCP_H__
typedef struct dhcp {
u8_t op; /* Message opcode/type. */
u8_t htype; /* Hardware address type. */
u8_t hlen; /* Hardware address length. */
u8_t hops; /* Hop count when relaying. */
u32_t xid; /* Transaction ID. */
u16_t secs; /* Seconds past since client began. */
u16_t flags; /* Flags. */
ipaddr_t ciaddr; /* Client IP address. */
ipaddr_t yiaddr; /* "Your" IP address. */
ipaddr_t siaddr; /* Boot server IP address. */
ipaddr_t giaddr; /* Relay agent (gateway) IP address. */
u8_t chaddr[16]; /* Client hardware address. */
u8_t sname[64]; /* Server host name. */
u8_t file[128]; /* Boot file. */
u32_t magic; /* Magic number. */
u8_t options[308]; /* Optional parameters. */
} dhcp_t;
/* DHCP operations and stuff: */
#define DHCP_BOOTREQUEST 1 /* Boot request message. */
#define DHCP_BOOTREPLY 2 /* Boot reply message. */
#define DHCP_HTYPE_ETH 1 /* Ethernet hardware type. */
#define DHCP_HLEN_ETH 6 /* Ethernet hardware address length. */
#define DHCP_FLAGS_BCAST 0x8000U /* Reply must be broadcast to client. */
/* "Magic" first four option bytes. */
#define DHCP_MAGIC HTONL(0x63825363UL)
/* DHCP common tags: */
#define DHCP_TAG_NETMASK 1 /* Netmask. */
#define DHCP_TAG_GATEWAY 3 /* Gateway list. */
#define DHCP_TAG_DNS 6 /* DNS Nameserver list. */
#define DHCP_TAG_HOSTNAME 12 /* Host name. */
#define DHCP_TAG_DOMAIN 15 /* Domain. */
#define DHCP_TAG_IPMTU 26 /* Interface MTU. */
/* DHCP protocol tags: */
#define DHCP_TAG_REQIP 50 /* Request this IP. */
#define DHCP_TAG_LEASE 51 /* Lease time requested/offered. */
#define DHCP_TAG_OVERLOAD 52 /* Options continued in file/sname. */
#define DHCP_TAG_TYPE 53 /* DHCP message (values below). */
#define DHCP_TAG_SERVERID 54 /* Server identifier. */
#define DHCP_TAG_REQPAR 55 /* Parameters requested. */
#define DHCP_TAG_MESSAGE 56 /* Error message. */
#define DHCP_TAG_MAXDHCP 57 /* Max DHCP packet size. */
#define DHCP_TAG_RENEWAL 58 /* Time to go into renewal state. */
#define DHCP_TAG_REBINDING 59 /* Time to go into rebinding state. */
#define DHCP_TAG_CLASSID 60 /* Class identifier. */
#define DHCP_TAG_CLIENTID 61 /* Client identifier. */
/* DHCP messages: */
#define DHCP_DISCOVER 1 /* Locate available servers. */
#define DHCP_OFFER 2 /* Parameters offered to client. */
#define DHCP_REQUEST 3 /* (Re)request offered parameters. */
#define DHCP_DECLINE 4 /* Client declines offer. */
#define DHCP_ACK 5 /* Server acknowlegdes request. */
#define DHCP_NAK 6 /* Server denies request. */
#define DHCP_RELEASE 7 /* Client relinguishes address. */
#define DHCP_INFORM 8 /* Client requests just local config. */
void dhcp_init(dhcp_t *_dp);
int dhcp_settag(dhcp_t *_dp, int _tag, void *_data, size_t _len);
int dhcp_gettag(dhcp_t *_dp, int _searchtag, u8_t **_pdata, size_t *_plen);
#endif /* __NET__GEN__DHCP_H__ */

59
include/net/gen/emu.h Normal file
View File

@@ -0,0 +1,59 @@
/*
emu.h - bsd sockets lookalike interface
*/
#ifndef __EMU_H__
#define __EMU_H__
typedef int socklen_t;
typedef int sa_family_t;
typedef int in_port_t;
typedef unsigned long sin_addr_t;
typedef unsigned long in_addr_t;
/* generic socket address */
struct sockaddr {
unsigned char sa_len; /* total address size */
sa_family_t sa_family; /* address type (family) */
char sa_data[14]; /* family-dependent addr (may be longer) */
};
struct in_addr {
in_addr_t s_addr;
};
/* internet-domain (AF_INET) socket address */
struct sockaddr_in {
unsigned char sin_len;
sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
/* type argument to socket() */
#define SOCK_STREAM 2
#define SOCK_DGRAM 3
/* protocol argument to socket() */
#define IPPROTO_ICMP 1
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
/* 2nd args to shutdown() */
#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2
/* bsd-lookalike functions */
int socket(int, int, int);
int bind(int, struct sockaddr *, socklen_t);
int listen(int, int);
int shutdown(int, int);
int connect(int, struct sockaddr *, socklen_t);
int recv(int s, void *buf, size_t len, int flags);
int send(int s, void *buf, size_t len, int flags);
#endif /* __EMU_H__ */

15
include/net/gen/eth_hdr.h Executable file
View File

@@ -0,0 +1,15 @@
/*
server/ip/gen/eth_hdr.h
*/
#ifndef __SERVER__IP__GEN__ETH_HDR_H__
#define __SERVER__IP__GEN__ETH_HDR_H__
typedef struct eth_hdr
{
ether_addr_t eh_dst;
ether_addr_t eh_src;
ether_type_t eh_proto;
} eth_hdr_t;
#endif /* __SERVER__IP__GEN__ETH_HDR_H__ */

79
include/net/gen/eth_io.h Executable file
View File

@@ -0,0 +1,79 @@
/*
server/gen/ip/eth_io.h
*/
#ifndef __SERVER__IP__GEN__ETH_IO_H__
#define __SERVER__IP__GEN__ETH_IO_H__
typedef struct nwio_ethopt
{
u32_t nweo_flags;
ether_addr_t nweo_multi, nweo_rem;
ether_type_t nweo_type;
} nwio_ethopt_t;
#define NWEO_NOFLAGS 0x0000L
#define NWEO_ACC_MASK 0x0003L
# define NWEO_EXCL 0x00000001L
# define NWEO_SHARED 0x00000002L
# define NWEO_COPY 0x00000003L
#define NWEO_LOC_MASK 0x0010L
# define NWEO_EN_LOC 0x00000010L
# define NWEO_DI_LOC 0x00100000L
#define NWEO_BROAD_MASK 0x0020L
# define NWEO_EN_BROAD 0x00000020L
# define NWEO_DI_BROAD 0x00200000L
#define NWEO_MULTI_MASK 0x0040L
# define NWEO_EN_MULTI 0x00000040L
# define NWEO_DI_MULTI 0x00400000L
#define NWEO_PROMISC_MASK 0x0080L
# define NWEO_EN_PROMISC 0x00000080L
# define NWEO_DI_PROMISC 0x00800000L
#define NWEO_REM_MASK 0x0100L
# define NWEO_REMSPEC 0x00000100L
# define NWEO_REMANY 0x01000000L
#define NWEO_TYPE_MASK 0x0200L
# define NWEO_TYPESPEC 0x00000200L
# define NWEO_TYPEANY 0x02000000L
#define NWEO_RW_MASK 0x1000L
# define NWEO_RWDATONLY 0x00001000L
# define NWEO_RWDATALL 0x10000000L
typedef struct eth_stat
{
unsigned long ets_recvErr, /* # receive errors */
ets_sendErr, /* # send error */
ets_OVW, /* # buffer overwrite warnings,
(packets arrive faster than
can be processed) */
ets_CRCerr, /* # crc errors of read */
ets_frameAll, /* # frames not alligned (# bits
not a mutiple of 8) */
ets_missedP, /* # packets missed due to too
slow packet processing */
ets_packetR, /* # packets received */
ets_packetT, /* # packets transmitted */
ets_transDef, /* # transmission defered (there
was a transmission of an
other station in progress */
ets_collision, /* # collissions */
ets_transAb, /* # transmissions aborted due
to accesive collisions */
ets_carrSense, /* # carrier sense lost */
ets_fifoUnder, /* # fifo underruns (processor
is too busy) */
ets_fifoOver, /* # fifo overruns (processor is
too busy) */
ets_CDheartbeat, /* # times unable to transmit
collision signal */
ets_OWC; /* # times out of window
collision */
} eth_stat_t;
typedef struct nwio_ethstat
{
ether_addr_t nwes_addr;
eth_stat_t nwes_stat;
} nwio_ethstat_t;
#endif /* __SERVER__IP__GEN__ETH_IO_H__ */

25
include/net/gen/ether.h Executable file
View File

@@ -0,0 +1,25 @@
/*
server/ip/gen/ether.h
*/
#ifndef __SERVER__IP__GEN__ETHER_H__
#define __SERVER__IP__GEN__ETHER_H__
#define ETH_MIN_PACK_SIZE 60
#define ETH_MAX_PACK_SIZE 1514
#define ETH_MAX_PACK_SIZE_TAGGED 1518
#define ETH_HDR_SIZE 14
#define ETH_CRC_SIZE 4
typedef struct ether_addr
{
u8_t ea_addr[6];
} ether_addr_t;
typedef u16_t ether_type_t;
typedef U16_t Ether_type_t;
#define ETH_ARP_PROTO 0x806
#define ETH_IP_PROTO 0x800
#endif /* __SERVER__IP__GEN__ETHER_H__ */

40
include/net/gen/icmp.h Executable file
View File

@@ -0,0 +1,40 @@
/*
server/ip/gen/icmp.h
*/
#ifndef __SERVER__IP__GEN__ICMP_H__
#define __SERVER__IP__GEN__ICMP_H__
#define ICMP_MIN_HDR_LEN 4
#define ICMP_TYPE_ECHO_REPL 0
#define ICMP_TYPE_DST_UNRCH 3
# define ICMP_NET_UNRCH 0
# define ICMP_HOST_UNRCH 1
# define ICMP_PROTOCOL_UNRCH 2
# define ICMP_PORT_UNRCH 3
# define ICMP_FRAGM_AND_DF 4
# define ICMP_SOURCE_ROUTE_FAILED 5
#define ICMP_TYPE_SRC_QUENCH 4
#define ICMP_TYPE_REDIRECT 5
# define ICMP_REDIRECT_NET 0
# define ICMP_REDIRECT_HOST 1
# define ICMP_REDIRECT_TOS_AND_NET 2
# define ICMP_REDIRECT_TOS_AND_HOST 3
#define ICMP_TYPE_ECHO_REQ 8
#define ICMP_TYPE_ROUTER_ADVER 9
#define ICMP_TYPE_ROUTE_SOL 10
#define ICMP_TYPE_TIME_EXCEEDED 11
# define ICMP_TTL_EXC 0
# define ICMP_FRAG_REASSEM 1
#define ICMP_TYPE_PARAM_PROBLEM 12
#define ICMP_TYPE_TS_REQ 13
#define ICMP_TYPE_TS_REPL 14
#define ICMP_TYPE_INFO_REQ 15
#define ICMP_TYPE_INFO_REPL 16
#endif /* __SERVER__IP__GEN__ICMP_H__ */
/*
* $PchId: icmp.h,v 1.5 1995/11/17 22:38:46 philip Exp $
*/

55
include/net/gen/icmp_hdr.h Executable file
View File

@@ -0,0 +1,55 @@
/*
server/ip/gen/icmp_hdr.h
*/
#ifndef __SERVER__IP__GEN__ICMP_HDR_H__
#define __SERVER__IP__GEN__ICMP_HDR_H__
typedef struct icmp_id_seq
{
u16_t iis_id, iis_seq;
} icmp_id_seq_t;
typedef struct icmp_ip_id
{
ip_hdr_t iii_hdr;
/* ip_hdr_options and 64 bytes of data */
} icmp_ip_id_t;
typedef struct icmp_ram /* RFC 1256 */
{
u8_t iram_na;
u8_t iram_aes;
u16_t iram_lt;
} icmp_ram_t;
typedef struct icmp_pp
{
u8_t ipp_ptr;
u8_t ipp_unused[3];
} icmp_pp_t;
typedef struct icmp_hdr
{
u8_t ih_type, ih_code;
u16_t ih_chksum;
union
{
u32_t ihh_unused;
icmp_id_seq_t ihh_idseq;
ipaddr_t ihh_gateway;
icmp_ram_t ihh_ram;
icmp_pp_t ihh_pp;
} ih_hun;
union
{
icmp_ip_id_t ihd_ipid;
u8_t uhd_data[1];
} ih_dun;
} icmp_hdr_t;
#endif /* __SERVER__IP__GEN__ICMP_HDR_H__ */
/*
* $PchId: icmp_hdr.h,v 1.4 1995/11/17 22:28:58 philip Exp $
*/

18
include/net/gen/if_ether.h Executable file
View File

@@ -0,0 +1,18 @@
/*
server/ip/gen/if_ether.h
*/
#ifndef __SERVER__IP__GEN__IF_ETHER_H__
#define __SERVER__IP__GEN__IF_ETHER_H__
struct ether_addr;
#define _PATH_ETHERS "/etc/ethers"
char *ether_ntoa _ARGS(( struct ether_addr *e ));
struct ether_addr *ether_aton _ARGS(( const char *s ));
int ether_ntohost _ARGS(( char *hostname, struct ether_addr *e ));
int ether_hostton _ARGS(( char *hostname, struct ether_addr *e ));
int ether_line _ARGS(( char *l, struct ether_addr *e, char *hostname ));
#endif /* __SERVER__IP__GEN__IF_ETHER_H__ */

33
include/net/gen/in.h Executable file
View File

@@ -0,0 +1,33 @@
/*
server/ip/gen/in.h
*/
#ifndef __SERVER__IP__GEN__IN_H__
#define __SERVER__IP__GEN__IN_H__
#define IP_MIN_HDR_SIZE 20
#define IP_MAX_HDR_SIZE 60 /* 15 * 4 */
#define IP_VERSION 4
#define IP_MAX_TTL 255
#define IP_DEF_MSS 576
#define IP_MAX_PACKSIZE 40000 /* 8192 */
/* Note: this restriction is not part of the IP-protocol but
introduced by this implementation. */
#define IPPROTO_ICMP 1
#define IPPROTO_TCP 6
#define IPPROTO_UDP 17
typedef u32_t ipaddr_t;
typedef u8_t ipproto_t;
typedef struct ip_hdropt
{
u8_t iho_opt_siz;
u8_t iho_data[IP_MAX_HDR_SIZE-IP_MIN_HDR_SIZE];
} ip_hdropt_t;
#endif /* __SERVER__IP__GEN__IN_H__ */
/*
* $PchId: in.h,v 1.3 1995/11/17 22:27:50 philip Exp $
*/

13
include/net/gen/inet.h Executable file
View File

@@ -0,0 +1,13 @@
/*
server/ip/gen/inet.h
*/
#ifndef __SERVER__IP__GEN__INET_H__
#define __SERVER__IP__GEN__INET_H__
ipaddr_t inet_addr _ARGS(( const char *addr ));
ipaddr_t inet_network _ARGS(( const char *addr ));
char *inet_ntoa _ARGS(( ipaddr_t addr ));
int inet_aton _ARGS(( const char *cp, ipaddr_t *pin ));
#endif /* __SERVER__IP__GEN__INET_H__ */

42
include/net/gen/ip_hdr.h Executable file
View File

@@ -0,0 +1,42 @@
/*
server/ip/gen/ip_hdr.h
*/
#ifndef __SERVER__IP__GEN__HDR_H__
#define __SERVER__IP__GEN__HDR_H__
typedef struct ip_hdr
{
u8_t ih_vers_ihl,
ih_tos;
u16_t ih_length,
ih_id,
ih_flags_fragoff;
u8_t ih_ttl,
ih_proto;
u16_t ih_hdr_chk;
ipaddr_t ih_src,
ih_dst;
} ip_hdr_t;
#define IH_IHL_MASK 0xf
#define IH_VERSION_MASK 0xf
#define IH_FRAGOFF_MASK 0x1fff
#define IH_MORE_FRAGS 0x2000
#define IH_DONT_FRAG 0x4000
#define IH_FLAGS_UNUSED 0x8000
#define IP_OPT_COPIED 0x80
#define IP_OPT_NUMBER 0x1f
#define IP_OPT_EOL 0x00
#define IP_OPT_NOP 0x01
#define IP_OPT_LSRR 0x83
#define IP_OPT_RR 0x07
#define IP_OPT_RR_MIN 4
#endif /* __SERVER__IP__GEN__HDR_H__ */
/*
* $PchId: ip_hdr.h,v 1.4 1995/11/17 22:26:00 philip Exp $
*/

55
include/net/gen/ip_io.h Executable file
View File

@@ -0,0 +1,55 @@
/*
server/ip/gen/ip_io.h
*/
#ifndef __SERVER__IP__GEN__IP_IO_H__
#define __SERVER__IP__GEN__IP_IO_H__
typedef struct nwio_ipconf
{
u32_t nwic_flags;
ipaddr_t nwic_ipaddr;
ipaddr_t nwic_netmask;
} nwio_ipconf_t;
#define NWIC_NOFLAGS 0x0
#define NWIC_FLAGS 0x3
# define NWIC_IPADDR_SET 0x1
# define NWIC_NETMASK_SET 0x2
typedef struct nwio_ipopt
{
u32_t nwio_flags;
ipaddr_t nwio_rem;
ip_hdropt_t nwio_hdropt;
u8_t nwio_tos;
u8_t nwio_ttl;
u8_t nwio_df;
ipproto_t nwio_proto;
} nwio_ipopt_t;
#define NWIO_NOFLAGS 0x0000l
#define NWIO_ACC_MASK 0x0003l
# define NWIO_EXCL 0x00000001l
# define NWIO_SHARED 0x00000002l
# define NWIO_COPY 0x00000003l
#define NWIO_LOC_MASK 0x0010l
# define NWIO_EN_LOC 0x00000010l
# define NWIO_DI_LOC 0x00100000l
#define NWIO_BROAD_MASK 0x0020l
# define NWIO_EN_BROAD 0x00000020l
# define NWIO_DI_BROAD 0x00200000l
#define NWIO_REM_MASK 0x0100l
# define NWIO_REMSPEC 0x00000100l
# define NWIO_REMANY 0x01000000l
#define NWIO_PROTO_MASK 0x0200l
# define NWIO_PROTOSPEC 0x00000200l
# define NWIO_PROTOANY 0x02000000l
#define NWIO_HDR_O_MASK 0x0400l
# define NWIO_HDR_O_SPEC 0x00000400l
# define NWIO_HDR_O_ANY 0x04000000l
#define NWIO_RW_MASK 0x1000l
# define NWIO_RWDATONLY 0x00001000l
# define NWIO_RWDATALL 0x10000000l
#endif /* __SERVER__IP__GEN__IP_IO_H__ */

124
include/net/gen/nameser.h Executable file
View File

@@ -0,0 +1,124 @@
/*
* Copyright (c) 1983, 1989 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that: (1) source distributions retain this entire copyright
* notice and comment, and (2) distributions including binaries display
* the following acknowledgement: ``This product includes software
* developed by the University of California, Berkeley and its contributors''
* in the documentation or other materials provided with the distribution
* and in all advertising materials mentioning features or use of this
* software. Neither the name of the University nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#)nameser.h 5.24 (Berkeley) 6/1/90
*/
/*
server/ip/gen/nameser.h
Created Sept 18, 1991 by Philip Homburg
*/
#ifndef __SERVER__IP__GEN__NAEMSER_H__
#define __SERVER__IP__GEN__NAEMSER_H__
typedef struct dns_hdr
{
u16_t dh_id;
u8_t dh_flag1;
u8_t dh_flag2;
u16_t dh_qdcount;
u16_t dh_ancount;
u16_t dh_nscount;
u16_t dh_arcount;
} dns_hdr_t;
#define DHF_QR 0x80
#define DHF_OPCODE 0x78
#define DHF_AA 0x04
#define DHF_TC 0x02
#define DHF_RD 0x01
#define DHF_RA 0x80
#define DHF_PR 0x40
#define DHF_UNUSED 0x30
#define DHF_RCODE 0x0F
/*
Define constants based on rfc883
*/
#define PACKETSZ 512 /* maximum packet size */
#define MAXDNAME 256 /* maximum domain name */
#define MAXCDNAME 255 /* maximum compressed domain name */
#define MAXLABEL 63 /* maximum length of domain label */
/* Number of bytes of fixed size data in query structure */
#define QFIXEDSZ 4
/* number of bytes of fixed size data in resource record */
#define RRFIXEDSZ 10
#define INDIR_MASK 0xc0
/* Defines for handling compressed domain names */
/*
Opcodes for DNS
*/
#define QUERY 0x0 /* standard query */
#define IQUERY 0x1 /* inverse query */
/*
Error codes
*/
#define NOERROR 0 /* no error */
#define FORMERR 1 /* format error */
#define SERVFAIL 2 /* server failure */
#define NXDOMAIN 3 /* non existent domain */
#define NOTIMP 4 /* not implemented */
#define REFUSED 5 /* query refused */
/* non standard */
#define NOCHANGE 0xf /* update failed to change db */
/* Valid types */
#define T_A 1 /* host address */
#define T_NS 2 /* authoritative server */
#define T_MD 3 /* mail destination */
#define T_MF 4 /* mail forwarder */
#define T_CNAME 5 /* connonical name */
#define T_SOA 6 /* start of authority zone */
#define T_MB 7 /* mailbox domain name */
#define T_MG 8 /* mail group member */
#define T_MR 9 /* mail rename name */
#define T_NULL 10 /* null resource record */
#define T_WKS 11 /* well known service */
#define T_PTR 12 /* domain name pointer */
#define T_HINFO 13 /* host information */
#define T_MINFO 14 /* mailbox information */
#define T_MX 15 /* mail routing information */
#define T_TXT 16 /* text strings */
/* non standard */
#define T_UINFO 100 /* user (finger) information */
#define T_UID 101 /* user ID */
#define T_GID 102 /* group ID */
#define T_UNSPEC 103 /* Unspecified format (binary data) */
/* Query type values which do not appear in resource records */
#define T_AXFR 252 /* transfer zone of authority */
#define T_MAILB 253 /* transfer mailbox records */
#define T_MAILA 254 /* transfer mail agent records */
#define T_ANY 255 /* wildcard match */
/* Valid classes */
#define C_IN 1 /* the internet */
#define C_CHAOS 3 /* for chaos net (MIT) */
#define C_HS 4 /* for Hesiod name server at MIT */
#define C_ANY 255 /* wildcard */
#endif /* __SERVER__IP__GEN__NAEMSER_H__ */

128
include/net/gen/netdb.h Executable file
View File

@@ -0,0 +1,128 @@
/*-
* Copyright (c) 1980, 1983, 1988 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)netdb.h 5.15 (Berkeley) 4/3/91
*/
#ifndef _NETDB_H_
#define _NETDB_H_
#define _PATH_HEQUIV "/etc/hosts.equiv"
#define _PATH_HOSTS "/etc/hosts"
#define _PATH_NETWORKS "/etc/networks"
#define _PATH_PROTOCOLS "/etc/protocols"
#define _PATH_SERVICES "/etc/services"
#define _PATH_SERVACCES "/etc/serv.access"
/*
* Structures returned by network data base library. All addresses are
* supplied in host order, and returned in network order (suitable for
* use in system calls).
*/
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
};
/*
* Assumption here is that a network number
* fits in 32 bits -- probably a poor one.
*/
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
unsigned long n_net; /* network # */
};
struct servent {
char *s_name; /* official service name */
char **s_aliases; /* alias list */
int s_port; /* port # */
char *s_proto; /* protocol to use */
};
struct protoent {
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
int p_proto; /* protocol # */
};
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in extern int h_errno).
*/
extern int h_errno;
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
#ifndef _ANSI_H
#include <ansi.h>
#endif
void endhostent _ARGS((void));
void endnetent _ARGS((void));
void endprotoent _ARGS((void));
void endservent _ARGS((void));
struct hostent *gethostbyaddr _ARGS((const char *, int, int));
struct hostent *gethostbyname _ARGS((const char *));
struct hostent *gethostent _ARGS((void));
struct netent *getnetbyaddr _ARGS((long, int)); /* u_long? */
struct netent *getnetbyname _ARGS((const char *));
struct netent *getnetent _ARGS((void));
struct protoent *getprotobyname _ARGS((const char *));
struct protoent *getprotobynumber _ARGS((int));
struct protoent *getprotoent _ARGS((void));
struct servent *getservbyname _ARGS((const char *, const char *));
struct servent *getservbyport _ARGS((int, const char *));
struct servent *getservent _ARGS((void));
void herror _ARGS((const char *));
void sethostent _ARGS((int));
/* void sethostfile _ARGS((const char *)); */
void setnetent _ARGS((int));
void setprotoent _ARGS((int));
void setservent _ARGS((int));
#ifdef _MINIX
int servxcheck _ARGS((unsigned long _peer, const char *_service,
void (*_logf) _ARGS((int _pass, const char *_name))));
char *servxfile _ARGS((const char *_file));
#endif
#endif /* !_NETDB_H_ */

10
include/net/gen/oneCsum.h Executable file
View File

@@ -0,0 +1,10 @@
/*
server/ip/gen/oneCsum.h
*/
#ifndef __SERVER__IP__GEN__ONECSUM_H__
#define __SERVER__IP__GEN__ONECSUM_H__
u16_t oneC_sum _ARGS(( U16_t prev, void *data, size_t data_len ));
#endif /* __SERVER__IP__GEN__ONECSUM_H__ */

22
include/net/gen/psip_hdr.h Executable file
View File

@@ -0,0 +1,22 @@
/*
server/ip/gen/psip_hdr.h
*/
#ifndef __SERVER__IP__GEN__PSIP_HDR_H__
#define __SERVER__IP__GEN__PSIP_HDR_H__
typedef struct psip_io_hdr
{
u8_t pih_flags;
u8_t pih_dummy[3];
} psip_io_hdr_t;
#define PF_LOC_REM_MASK 1
#define PF_LOC2REM 0
#define PF_REM2LOC 1
#endif /* __SERVER__IP__GEN__PSIP_HDR_H__ */
/*
* $PchId: psip_hdr.h,v 1.2 1995/11/17 22:22:35 philip Exp $
*/

21
include/net/gen/psip_io.h Executable file
View File

@@ -0,0 +1,21 @@
/*
server/ip/gen/psip_io.h
*/
#ifndef __SERVER__IP__GEN__PSIP_IO_H__
#define __SERVER__IP__GEN__PSIP_IO_H__
typedef struct nwio_psipopt
{
unsigned long nwpo_flags;
} nwio_psipopt_t;
#define NWPO_PROMISC_MASK 0x0001L
#define NWPO_EN_PROMISC 0x00000001L
#define NWUO_DI_PROMISC 0x00010000L
#endif /* __SERVER__IP__GEN__PSIP_IO_H__ */
/*
* $PchId: psip_io.h,v 1.2 1995/11/17 22:22:16 philip Exp $
*/

107
include/net/gen/resolv.h Executable file
View File

@@ -0,0 +1,107 @@
/*
* Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that: (1) source distributions retain this entire copyright
* notice and comment, and (2) distributions including binaries display
* the following acknowledgement: ``This product includes software
* developed by the University of California, Berkeley and its contributors''
* in the documentation or other materials provided with the distribution
* and in all advertising materials mentioning features or use of this
* software. Neither the name of the University nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* @(#)resolv.h 5.10 (Berkeley) 6/1/90
*/
#ifndef _NET__GEN__RESOLV_H
#define _NET__GEN__RESOLV_H
/*
* Resolver configuration file.
* Normally not present, but may contain the address of the
* inital name server(s) to query and the domain search list.
*/
#ifndef _PATH_RESCONF
#define _PATH_RESCONF "/etc/resolv.conf"
#endif
/*
* Global defines and variables for resolver stub.
*/
#define MAXNS 3 /* max # name servers we'll track */
#define MAXDFLSRCH 3 /* # default domain levels to try */
#define MAXDNSRCH 6 /* max # domains in search path */
#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */
#define RES_TIMEOUT 5 /* min. seconds between retries */
#define NAMESERVER_PORT 53
struct state {
int retrans; /* retransmition time interval */
int retry; /* number of times to retransmit */
long options; /* option flags - see below. */
int nscount; /* number of name servers */
ipaddr_t nsaddr_list[MAXNS]; /* address of name server */
#define nsaddr nsaddr_list[0] /* for backward compatibility */
u16_t nsport_list[MAXNS]; /* port of name server */
u16_t id; /* current packet id */
char defdname[MAXDNAME]; /* default domain */
char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */
};
/*
* Resolver options
*/
#define RES_INIT 0x0001 /* address initialized */
#define RES_DEBUG 0x0002 /* print debug messages */
#define RES_AAONLY 0x0004 /* authoritative answers only */
#define RES_USEVC 0x0008 /* use virtual circuit */
#define RES_PRIMARY 0x0010 /* query primary server only */
#define RES_IGNTC 0x0020 /* ignore trucation errors */
#define RES_RECURSE 0x0040 /* recursion desired */
#define RES_DEFNAMES 0x0080 /* use default domain name */
#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */
#define RES_DNSRCH 0x0200 /* search up local domain tree */
#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH )
extern struct state _res;
struct rrec;
int res_init _ARGS(( void ));
int res_mkquery _ARGS(( int op, const char *dname, int class, int type,
const char *data, int datalen, const struct rrec *newrr,
char *buf, int buflen ));
int res_query _ARGS(( char *name, int class, int type, u8_t *answer,
int anslen ));
int res_querydomain _ARGS(( char *name, char *domain, int class, int type,
u8_t *answer, int anslen ));
int res_search _ARGS(( char *name, int class, int type, u8_t *answer,
int anslen ));
int res_send _ARGS(( const char *buf, int buflen, char *answer, int anslen ));
void _res_close _ARGS(( void ));
int dn_comp _ARGS(( const u8_t *exp_dn, u8_t *comp_dn, int length,
u8_t **dnptrs, u8_t **lastdnptr ));
int dn_expand _ARGS(( const u8_t *msg, const u8_t *eomorig,
const u8_t *comp_dn, u8_t *exp_dn, int length ));
int dn_skipname _ARGS(( const u8_t *comp_dn, const u8_t *eom ));
char *__hostalias _ARGS(( const char *name ));
u16_t _getshort _ARGS(( const u8_t *msgp ));
u32_t _getlong _ARGS(( const u8_t *msgp ));
void __putshort _ARGS(( U16_t s, u8_t *msgp ));
void __putlong _ARGS(( u32_t l, u8_t *msgp ));
void p_query _ARGS(( char *msg ));
#endif /* _NET__GEN__RESOLV_H */

77
include/net/gen/rip.h Executable file
View File

@@ -0,0 +1,77 @@
/*
net/gen/rip.h
Definitions for the Routing Information Protocol (RFC-1058).
Created: Aug 16, 1993 by Philip Homburg <philip@cs.vu.nl>
*/
#ifndef NET__GEN__RIP_H
#define NET__GEN__RIP_H
typedef struct rip_hdr
{
u8_t rh_command;
u8_t rh_version;
u16_t rh_zero;
} rip_hdr_t;
#define RHC_REQUEST 1
#define RHC_RESPONSE 2
#define RIP_ENTRY_MAX 25
typedef struct rip_entry
{
union
{
struct rip_entry_v1
{
u16_t re_family;
u16_t re_zero0;
u32_t re_address;
u32_t re_zero1;
u32_t re_zero2;
u32_t re_metric;
} v1;
struct rip_entry_v2
{
u16_t re_family;
u16_t re_tag;
u32_t re_address;
u32_t re_mask;
u32_t re_nexthop;
u32_t re_metric;
} v2;
} u;
} rip_entry_t;
#define RIP_FAMILY_IP 2
#define RIP_INFINITY 16
#define RIP_UDP_PORT 520
#define RIP_PERIOD 30 /* A responce is sent once every
* RIP_PERIOD seconds
*/
#define RIP_FUZZ 10 /* The actual value used is RIP_FREQUENCE -
* a random number of at most RIP_FUZZ.
*/
#define RIP_TIMEOUT 180 /* A route is dead after RIP_TIMEOUT seconds */
#define RIP_DELETE_TO 120 /* A dead route is removed after RIP_DELETE_TO
* seconds
*/
#ifdef __RIP_DEBUG
#undef RIP_PERIOD
#define RIP_PERIOD 15
#undef RIP_TIMEOUT
#define RIP_TIMEOUT 10
#undef RIP_DELETE_TO
#define RIP_DELETE_TO 10
#endif /* __RIP_DEBUG */
#endif /* NET__GEN__RIP_H */
/*
* $PchId: rip.h,v 1.3 1995/11/17 22:21:16 philip Exp $
*/

31
include/net/gen/route.h Executable file
View File

@@ -0,0 +1,31 @@
/*
server/ip/gen/route.h
*/
#ifndef __SERVER__IP__GEN__ROUTE_H__
#define __SERVER__IP__GEN__ROUTE_H__
typedef struct nwio_route
{
u32_t nwr_ent_no;
u32_t nwr_ent_count;
ipaddr_t nwr_dest;
ipaddr_t nwr_netmask;
ipaddr_t nwr_gateway;
u32_t nwr_dist;
u32_t nwr_flags;
u32_t nwr_pref;
u32_t nwr_mtu; /* Ignored, compatibility with VMD */
ipaddr_t nwr_ifaddr;
} nwio_route_t;
#define NWRF_EMPTY 0
#define NWRF_INUSE 1
#define NWRF_STATIC 2
#define NWRF_UNREACHABLE 4
#endif /* __SERVER__IP__GEN__ROUTE_H__ */
/*
* $PchId: route.h,v 1.3 1995/11/17 22:19:50 philip Exp $
*/

41
include/net/gen/socket.h Executable file
View File

@@ -0,0 +1,41 @@
/*
server/ip/gen/socket.h
*/
#ifndef __SERVER__IP__GEN__SOCKET_H__
#define __SERVER__IP__GEN__SOCKET_H__
/* From SunOS: /usr/include/sys/socketh */
/*
* Address families.
*/
#define AF_UNSPEC 0 /* unspecified */
#define AF_UNIX 1 /* local to host (pipes, portals) */
#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
#define AF_IMPLINK 3 /* arpanet imp addresses */
#define AF_PUP 4 /* pup protocols: e.g. BSP */
#define AF_CHAOS 5 /* mit CHAOS protocols */
#define AF_NS 6 /* XEROX NS protocols */
#define AF_NBS 7 /* nbs protocols */
#define AF_ECMA 8 /* european computer manufacturers */
#define AF_DATAKIT 9 /* datakit protocols */
#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
#define AF_SNA 11 /* IBM SNA */
#define AF_DECnet 12 /* DECnet */
#define AF_DLI 13 /* Direct data link interface */
#define AF_LAT 14 /* LAT */
#define AF_HYLINK 15 /* NSC Hyperchannel */
#define AF_APPLETALK 16 /* Apple Talk */
#define AF_NIT 17 /* Network Interface Tap */
#define AF_802 18 /* IEEE 802.2, also ISO 8802 */
#define AF_OSI 19 /* umbrella for all families used
* by OSI (e.g. protosw lookup) */
#define AF_X25 20 /* CCITT X.25 in particular */
#define AF_OSINET 21 /* AFI = 47, IDI = 4 */
#define AF_GOSIP 22 /* U.S. Government OSI */
#define AF_MAX 21
#endif /* __SERVER__IP__GEN__SOCKET_H__ */

19
include/net/gen/tcp.h Executable file
View File

@@ -0,0 +1,19 @@
/*
server/ip/gen/tcp.h
*/
#ifndef __SERVER__IP__GEN__TCP_H__
#define __SERVER__IP__GEN__TCP_H__
#define TCP_MIN_HDR_SIZE 20
#define TCP_MAX_HDR_SIZE 60
#define TCPPORT_TELNET 23
#define TCPPORT_FINGER 79
#define TCPPORT_RESERVED 1024
typedef u16_t tcpport_t;
typedef U16_t Tcpport_t; /* for use in prototypes */
#endif /* __SERVER__IP__GEN__TCP_H__ */

45
include/net/gen/tcp_hdr.h Executable file
View File

@@ -0,0 +1,45 @@
/*
server/ip/gen/tcp_hdr.h
*/
#ifndef __SERVER__IP__GEN__TCP_HDR_H__
#define __SERVER__IP__GEN__TCP_HDR_H__
typedef struct tcp_hdr
{
tcpport_t th_srcport;
tcpport_t th_dstport;
u32_t th_seq_nr;
u32_t th_ack_nr;
u8_t th_data_off;
u8_t th_flags;
u16_t th_window;
u16_t th_chksum;
u16_t th_urgptr;
} tcp_hdr_t;
#define TH_DO_MASK 0xf0
#define TH_FLAGS_MASK 0x3f
#define THF_FIN 0x1
#define THF_SYN 0x2
#define THF_RST 0x4
#define THF_PSH 0x8
#define THF_ACK 0x10
#define THF_URG 0x20
typedef struct tcp_hdropt
{
int tho_opt_siz;
u8_t tho_data[TCP_MAX_HDR_SIZE-TCP_MIN_HDR_SIZE];
} tcp_hdropt_t;
#define TCP_OPT_EOL 0
#define TCP_OPT_NOP 1
#define TCP_OPT_MSS 2
#endif /* __SERVER__IP__GEN__TCP_HDR_H__ */
/*
* $PchId: tcp_hdr.h,v 1.3 1995/11/17 22:18:13 philip Exp $
*/

66
include/net/gen/tcp_io.h Executable file
View File

@@ -0,0 +1,66 @@
/*
server/ip/gen/tcp_io.h
*/
#ifndef __SERVER__IP__GEN__TCP_IO_H__
#define __SERVER__IP__GEN__TCP_IO_H__
typedef struct nwio_tcpconf
{
u32_t nwtc_flags;
ipaddr_t nwtc_locaddr;
ipaddr_t nwtc_remaddr;
tcpport_t nwtc_locport;
tcpport_t nwtc_remport;
} nwio_tcpconf_t;
#define NWTC_NOFLAGS 0x0000L
#define NWTC_ACC_MASK 0x0003L
# define NWTC_EXCL 0x00000001L
# define NWTC_SHARED 0x00000002L
# define NWTC_COPY 0x00000003L
#define NWTC_LOCPORT_MASK 0x0030L
# define NWTC_LP_UNSET 0x00000010L
# define NWTC_LP_SET 0x00000020L
# define NWTC_LP_SEL 0x00000030L
#define NWTC_REMADDR_MASK 0x0100L
# define NWTC_SET_RA 0x00000100L
# define NWTC_UNSET_RA 0x01000000L
#define NWTC_REMPORT_MASK 0x0200L
# define NWTC_SET_RP 0x00000200L
# define NWTC_UNSET_RP 0x02000000L
typedef struct nwio_tcpcl
{
long nwtcl_flags;
long nwtcl_ttl;
} nwio_tcpcl_t;
typedef struct nwio_tcpatt
{
long nwta_flags;
} nwio_tcpatt_t;
typedef struct nwio_tcpopt
{
u32_t nwto_flags;
} nwio_tcpopt_t;
#define NWTO_NOFLAG 0x0000L
#define NWTO_SND_URG_MASK 0x0001L
# define NWTO_SND_URG 0x00000001L
# define NWTO_SND_NOTURG 0x00010000L
#define NWTO_RCV_URG_MASK 0x0002L
# define NWTO_RCV_URG 0x00000002L
# define NWTO_RCV_NOTURG 0x00020000L
#define NWTO_BSD_URG_MASK 0x0004L
# define NWTO_BSD_URG 0x00000004L
# define NWTO_NOTBSD_URG 0x00040000L
#define NWTO_DEL_RST_MASK 0x0008L
# define NWTO_DEL_RST 0x00000008L
#endif /* __SERVER__IP__GEN__TCP_IO_H__ */
/*
* $PchId: tcp_io.h,v 1.4 1995/11/17 22:17:47 philip Exp $
*/

14
include/net/gen/udp.h Executable file
View File

@@ -0,0 +1,14 @@
/*
server/ip/gen/udp.h
*/
#ifndef __SERVER__IP__GEN__UDP_H__
#define __SERVER__IP__GEN__UDP_H__
typedef u16_t udpport_t;
typedef U16_t Udpport_t;
#define UDP_HDR_SIZE 8
#define UDP_IO_HDR_SIZE 16
#endif /* __SERVER__IP__GEN__UDP_H__ */

26
include/net/gen/udp_hdr.h Executable file
View File

@@ -0,0 +1,26 @@
/*
server/ip/gen/udp_hdr.h
*/
#ifndef __SERVER__IP__GEN__UDP_HDR_H__
#define __SERVER__IP__GEN__UDP_HDR_H__
typedef struct udp_hdr
{
udpport_t uh_src_port;
udpport_t uh_dst_port;
u16_t uh_length;
u16_t uh_chksum;
} udp_hdr_t;
typedef struct udp_io_hdr
{
ipaddr_t uih_src_addr;
ipaddr_t uih_dst_addr;
udpport_t uih_src_port;
udpport_t uih_dst_port;
u16_t uih_ip_opt_len;
u16_t uih_data_len;
} udp_io_hdr_t;
#endif /* __SERVER__IP__GEN__UDP_HDR_H__ */

45
include/net/gen/udp_io.h Executable file
View File

@@ -0,0 +1,45 @@
/*
server/ip/gen/udp_io.h
*/
#ifndef __SERVER__IP__GEN__UDP_IO_H__
#define __SERVER__IP__GEN__UDP_IO_H__
typedef struct nwio_udpopt
{
unsigned long nwuo_flags;
udpport_t nwuo_locport;
udpport_t nwuo_remport;
ipaddr_t nwuo_locaddr;
ipaddr_t nwuo_remaddr;
} nwio_udpopt_t;
#define NWUO_NOFLAGS 0x0000L
#define NWUO_ACC_MASK 0x0003L
#define NWUO_EXCL 0x00000001L
#define NWUO_SHARED 0x00000002L
#define NWUO_COPY 0x00000003L
#define NWUO_LOCPORT_MASK 0x000CL
#define NWUO_LP_SEL 0x00000004L
#define NWUO_LP_SET 0x00000008L
#define NWUO_LP_ANY 0x0000000CL
#define NWUO_LOCADDR_MASK 0x0010L
#define NWUO_EN_LOC 0x00000010L
#define NWUO_DI_LOC 0x00100000L
#define NWUO_BROAD_MASK 0x0020L
#define NWUO_EN_BROAD 0x00000020L
#define NWUO_DI_BROAD 0x00200000L
#define NWUO_REMPORT_MASK 0x0100L
#define NWUO_RP_SET 0x00000100L
#define NWUO_RP_ANY 0x01000000L
#define NWUO_REMADDR_MASK 0x0200L
#define NWUO_RA_SET 0x00000200L
#define NWUO_RA_ANY 0x02000000L
#define NWUO_RW_MASK 0x1000L
#define NWUO_RWDATONLY 0x00001000L
#define NWUO_RWDATALL 0x10000000L
#define NWUO_IPOPT_MASK 0x2000L
#define NWUO_EN_IPOPT 0x00002000L
#define NWUO_DI_IPOPT 0x20000000L
#endif /* __SERVER__IP__GEN__UDP_IO_H__ */

85
include/net/gen/vjhc.h Executable file
View File

@@ -0,0 +1,85 @@
/*
net/gen/vjhc.h
Defines for Van Jacobson TCP/IP Header Compression as defined in RFC-1144
Created: Nov 15, 1993 by Philip Homburg <philip@cs.vu.nl>
*/
#ifndef __NET__GEN__VJHC_H__
#define __NET__GEN__VJHC_H__
#define VJHC_FLAG_U 0x01
#define VJHC_FLAG_W 0x02
#define VJHC_FLAG_A 0x04
#define VJHC_FLAG_S 0x08
#define VJHC_FLAG_P 0x10
#define VJHC_FLAG_I 0x20
#define VJHC_FLAG_C 0x40
#define VJHC_SPEC_I (VJHC_FLAG_S | VJHC_FLAG_W | VJHC_FLAG_U)
#define VJHC_SPEC_D (VJHC_FLAG_S | VJHC_FLAG_A | VJHC_FLAG_W | VJHC_FLAG_U)
#define VJHC_SPEC_MASK (VJHC_FLAG_S | VJHC_FLAG_A | VJHC_FLAG_W | VJHC_FLAG_U)
#define VJHC_ENCODE(cp, n) \
{ \
if ((u16_t)(n) >= 256) \
{ \
*(cp)++= 0; \
*(cp)++= (n >> 8); \
*(cp)++= (n); \
} \
else \
*(cp)++= (n); \
}
#define VJHC_ENCODEZ(cp, n) \
{ \
if ((u16_t)(n) == 0 || (u16_t)(n) >= 256) \
{ \
*(cp)++= 0; \
*(cp)++= (n >> 8); \
*(cp)++= (n); \
} \
else \
*(cp)++= (n); \
}
#define VJHC_DECODEL(cp, l) \
{ \
if (*(cp) == 0) \
{ \
(l)= htonl(ntohl((l)) + (((cp)[1] << 8) | (cp)[2])); \
(cp) += 3; \
} \
else \
(l)= htonl(ntohl((l)) + (u32_t)*(cp)++); \
}
#define VJHC_DECODES(cp, s) \
{ \
if (*(cp) == 0) \
{ \
(s)= htons(ntohs((s)) + (((cp)[1] << 8) | (cp)[2])); \
(cp) += 3; \
} \
else \
(s)= htons(ntohs((s)) + (u16_t)*(cp)++); \
}
#define VJHC_DECODEU(cp, s) \
{ \
if (*(cp) == 0) \
{ \
(s)= htons(((cp)[1] << 8) | (cp)[2]); \
(cp) += 3; \
} \
else \
(s)= htons((u16_t)*(cp)++); \
}
#endif /* __NET__GEN__VJHC_H__ */
/*
* $PchId: vjhc.h,v 1.2 1995/11/17 22:14:46 philip Exp $
*/

83
include/net/hton.h Executable file
View File

@@ -0,0 +1,83 @@
/*
The following macro definitions convert to and from the network standard byte
order. The macros with their name in lower case guarantee to evaluate their
argument exactly once. The function of the macros is encoded in their names;
htons means convert a (unsigned) short in host byte order to network byte order.
*/
#ifndef _NET__HTON_H
#define _NET__HTON_H
#include <minix/config.h>
extern u16_t _tmp;
extern u32_t _tmp_l;
/* Find out about the byte order. */
/* assume <minix/config.h> is included, let's check */
#if (CHIP == 0)
#include "CHIP macro not set, include <minix/config.h>"
#endif
#if (CHIP == INTEL)
#define LITTLE_ENDIAN 1
#endif
#if (CHIP == M68000 || CHIP == SPARC)
#define BIG_ENDIAN 1
#endif
#if (LITTLE_ENDIAN) && (BIG_ENDIAN)
#include "both LITTLE_ENDIAN and BIG_ENDIAN are defined"
/* LITTLE_ENDIAN and BIG_ENDIAN are both defined */
#endif
#if !(LITTLE_ENDIAN) && !(BIG_ENDIAN)
#include "neither LITTLE_ENDIAN nor BIG_ENDIAN is defined"
/* LITTLE_ENDIAN and BIG_ENDIAN are both NOT defined */
#endif
#if LITTLE_ENDIAN
#define HTONS(x) ( ( (((unsigned short)(x)) >>8) & 0xff) | \
((((unsigned short)(x)) & 0xff)<<8) )
#define NTOHS(x) ( ( (((unsigned short)(x)) >>8) & 0xff) | \
((((unsigned short)(x)) & 0xff)<<8) )
#define HTONL(x) ((((x)>>24) & 0xffL) | (((x)>>8) & 0xff00L) | \
(((x)<<8) & 0xff0000L) | (((x)<<24) & 0xff000000L))
#define NTOHL(x) ((((x)>>24) & 0xffL) | (((x)>>8) & 0xff00L) | \
(((x)<<8) & 0xff0000L) | (((x)<<24) & 0xff000000L))
#if _WORD_SIZE > 2
#define htons(x) (_tmp=(x), ((_tmp>>8) & 0xff) | ((_tmp<<8) & 0xff00))
#define ntohs(x) (_tmp=(x), ((_tmp>>8) & 0xff) | ((_tmp<<8) & 0xff00))
#define htonl(x) (_tmp_l=(x), ((_tmp_l>>24) & 0xffL) | \
((_tmp_l>>8) & 0xff00L) | \
((_tmp_l<<8) & 0xff0000L) | ((_tmp_l<<24) & 0xff000000L))
#define ntohl(x) (_tmp_l=(x), ((_tmp_l>>24) & 0xffL) \
| ((_tmp_l>>8) & 0xff00L) | \
((_tmp_l<<8) & 0xff0000L) | ((_tmp_l<<24) & 0xff000000L))
#else /* _WORD_SIZE == 2 */
/* The above macros are too unwieldy for a 16-bit machine. */
u16_t htons(u16_t x);
u16_t ntohs(u16_t x);
u32_t htonl(u32_t x);
u32_t ntohl(u32_t x);
#endif /* _WORD_SIZE == 2 */
#endif /* LITTLE_ENDIAN */
#if BIG_ENDIAN
#define htons(x) (x)
#define HTONS(x) (x)
#define ntohs(x) (x)
#define NTOHS(x) (x)
#define htonl(x) (x)
#define HTONL(x) (x)
#define ntohl(x) (x)
#define NTOHL(x) (x)
#endif /* BIG_ENDIAN */
#endif /* _NET__HTON_H */

44
include/net/ioctl.h Executable file
View File

@@ -0,0 +1,44 @@
/* net/ioctl.h - Network ioctl() command codes. Author: Kees J. Bot
* 23 Nov 2002
*
*/
#ifndef _NET__IOCTL_H
#define _NET__IOCTL_H
#include <minix/ioctl.h>
/* Network ioctls. */
#define NWIOSETHOPT _IOW('n', 16, struct nwio_ethopt)
#define NWIOGETHOPT _IOR('n', 17, struct nwio_ethopt)
#define NWIOGETHSTAT _IOR('n', 18, struct nwio_ethstat)
#define NWIOSIPCONF _IOW('n', 32, struct nwio_ipconf)
#define NWIOGIPCONF _IOR('n', 33, struct nwio_ipconf)
#define NWIOSIPOPT _IOW('n', 34, struct nwio_ipopt)
#define NWIOGIPOPT _IOR('n', 35, struct nwio_ipopt)
#define NWIOGIPOROUTE _IORW('n', 40, struct nwio_route)
#define NWIOSIPOROUTE _IOW ('n', 41, struct nwio_route)
#define NWIODIPOROUTE _IOW ('n', 42, struct nwio_route)
#define NWIOGIPIROUTE _IORW('n', 43, struct nwio_route)
#define NWIOSIPIROUTE _IOW ('n', 44, struct nwio_route)
#define NWIODIPIROUTE _IOW ('n', 45, struct nwio_route)
#define NWIOSTCPCONF _IOW('n', 48, struct nwio_tcpconf)
#define NWIOGTCPCONF _IOR('n', 49, struct nwio_tcpconf)
#define NWIOTCPCONN _IOW('n', 50, struct nwio_tcpcl)
#define NWIOTCPLISTEN _IOW('n', 51, struct nwio_tcpcl)
#define NWIOTCPATTACH _IOW('n', 52, struct nwio_tcpatt)
#define NWIOTCPSHUTDOWN _IO ('n', 53)
#define NWIOSTCPOPT _IOW('n', 54, struct nwio_tcpopt)
#define NWIOGTCPOPT _IOR('n', 55, struct nwio_tcpopt)
#define NWIOSUDPOPT _IOW('n', 64, struct nwio_udpopt)
#define NWIOGUDPOPT _IOR('n', 65, struct nwio_udpopt)
#define NWIOSPSIPOPT _IOW('n', 80, struct nwio_psipopt)
#define NWIOGPSIPOPT _IOR('n', 81, struct nwio_psipopt)
#endif /* _NET__IOCTL_H */

22
include/net/netlib.h Executable file
View File

@@ -0,0 +1,22 @@
/*
net/netlib.h
*/
#ifndef _NET__NETLIB_H_
#define _NET__NETLIB_H_
#ifndef _ANSI
#include <ansi.h>
#endif
_PROTOTYPE (int iruserok, (unsigned long raddr, int superuser,
const char *ruser, const char *luser) );
_PROTOTYPE (int rcmd, (char **ahost, int rport, const char *locuser,
const char *remuser, const char *cmd, int *fd2p) );
#define ETH_DEVICE "/dev/eth"
#define IP_DEVICE "/dev/ip"
#define TCP_DEVICE "/dev/tcp"
#define UDP_DEVICE "/dev/udp"
#endif /* _NET__NETLIB_H_ */

13
include/net/socket.h Normal file
View File

@@ -0,0 +1,13 @@
#ifndef __NET_SOCKET_H__
#define __NET_SOCKET_H__ 1
#include <sys/types.h>
#include <net/hton.h>
#include <net/gen/in.h>
#include <net/gen/socket.h>
#include <net/gen/emu.h>
#include <net/gen/netdb.h>
#endif

34
include/pwd.h Executable file
View File

@@ -0,0 +1,34 @@
/* The <pwd.h> header defines the items in the password file. */
#ifndef _PWD_H
#define _PWD_H
#ifndef _TYPES_H
#include <sys/types.h>
#endif
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. */
_PROTOTYPE( struct passwd *getpwnam, (const char *_name) );
_PROTOTYPE( struct passwd *getpwuid, (Uid_t _uid) );
#ifdef _MINIX
_PROTOTYPE( void endpwent, (void) );
_PROTOTYPE( struct passwd *getpwent, (void) );
_PROTOTYPE( int setpwent, (void) );
_PROTOTYPE( void setpwfile, (const char *_file) );
#endif
#endif /* _PWD_H */

105
include/regex.h Executable file
View File

@@ -0,0 +1,105 @@
/*-
* Copyright (c) 1992 Henry Spencer.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Henry Spencer of the University of Toronto.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)regex.h 8.2 (Berkeley) 1/3/94
*/
#ifndef _REGEX_H_
#define _REGEX_H_
#ifndef _TYPES_H
#include <sys/types.h>
#endif
/* types */
typedef off_t regoff_t;
typedef struct {
int re_magic;
size_t re_nsub; /* number of parenthesized subexpressions */
const char *re_endp; /* end pointer for REG_PEND */
struct re_guts *re_g; /* none of your business :-) */
} regex_t;
typedef struct {
regoff_t rm_so; /* start of match */
regoff_t rm_eo; /* end of match */
} regmatch_t;
/* regcomp() flags */
#define REG_BASIC 0000
#define REG_EXTENDED 0001
#define REG_ICASE 0002
#define REG_NOSUB 0004
#define REG_NEWLINE 0010
#define REG_NOSPEC 0020
#define REG_PEND 0040
#define REG_DUMP 0200
/* regerror() flags */
#define REG_NOMATCH 1
#define REG_BADPAT 2
#define REG_ECOLLATE 3
#define REG_ECTYPE 4
#define REG_EESCAPE 5
#define REG_ESUBREG 6
#define REG_EBRACK 7
#define REG_EPAREN 8
#define REG_EBRACE 9
#define REG_BADBR 10
#define REG_ERANGE 11
#define REG_ESPACE 12
#define REG_BADRPT 13
#define REG_EMPTY 14
#define REG_ASSERT 15
#define REG_INVARG 16
#define REG_ATOI 255 /* convert name to number (!) */
#define REG_ITOA 0400 /* convert number to name (!) */
/* regexec() flags */
#define REG_NOTBOL 00001
#define REG_NOTEOL 00002
#define REG_STARTEND 00004
#define REG_TRACE 00400 /* tracing of execution */
#define REG_LARGE 01000 /* force large representation */
#define REG_BACKR 02000 /* force use of backref code */
int regcomp(regex_t *, const char *, int);
size_t regerror(int, const regex_t *, char *, size_t);
int regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
void regfree(regex_t *);
#endif /* !_REGEX_H_ */

39
include/regexp.h Executable file
View File

@@ -0,0 +1,39 @@
/* The <regexp.h> header is used by the (V8-compatible) regexp(3) routines. */
/* NOTE: Obsoleted by the POSIX regex(3) library. */
#ifndef _REGEXP_H
#define _REGEXP_H
#ifndef _ANSI_H
#include <ansi.h>
#endif
#define CHARBITS 0377
#define NSUBEXP 10
typedef struct regexp {
const char *startp[NSUBEXP];
const 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;
/* Keep these functions away from the POSIX versions. */
#define regcomp _v8_regcomp
#define regexec _v8_regexec
#define regsub _v8_regsub
#define regerror _v8_regerror
/* Function Prototypes. */
regexp *regcomp(const char *_exp);
int regexec(regexp *_prog, const char *_string, int _bolflag);
void regsub(regexp *_prog, char *_source, char *_dest);
void regerror(const char *_message) ;
#endif /* _REGEXP_H */
/*
* $PchId: regexp.h,v 1.4 1996/04/10 21:43:17 philip Exp $
*/

148
include/setjmp.h Executable file
View File

@@ -0,0 +1,148 @@
/* 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, though care has to be
* taken when the DEL occurs while executing a library function, since
* some of them are not reentrant.
*
* POSIX does not require the process signal mask to be saved and restored
* during setjmp/longjmp. However, the current implementation does this
* in order to agree with OSF/1 and other BSD derived systems.
*
* The pair of functions _setjmp/_longjmp may be used when the signal
* mask is not to be saved/restored. These functions are traditional
* in BSD systems.
*
* There are different ways of implementing setjmp/longjmp. Probably
* the best way is to unify it with signal handling. This is true for the
* following reasons: Both setjmp/longjmp and signal delivery must save
* a context so that it may be restored later. The jmp_buf necessarily
* contains signal information, namely the signal mask to restore. Both
* longjmp and the return of a signal handler must trap to the operating
* system to restore the previous signal mask. Finally, the jmp_buf
* and the sigcontext structure contain the registers to restore.
*
* Some compilers, namely ACK, will not enregister any variables inside a
* function containing a call to setjmp, even if those variables are
* explicitly declared as register variables. Thus for ACK, the
* identification of the jmp_buf with a sigcontext structure would cause
* unnecessary overhead: the jmp_buf has room for all the registers, but
* the only registers that need to be saved are the stack pointer,
* frame pointer, and program counter.
*
* So, for ACK a jmp_buf is much smaller than a sigcontext structure, and
* longjmp does not directly call sigreturn. Instead, longjmp calls a
* front-end function which initializes the appropriate fields of a
* sigcontext structure, marks this structure as containing no valid
* general purpose registers, and then calls sigreturn.
*
* The POSIX sigjmp_buf is identical to the jmp_buf in all cases.
*
* Different compilers have different symbols that they recognize as
* setjmp symbols. ACK recognizes __setjmp, the GNU C compiler
* recognizes setjmp and _setjmp, and BCC recognizes all three.
* When these symbols occur within a function, the compiler may keep
* all local variables on the stack, avoid certain optimizations, or
* pass hidden arguments to the setjmp function.
*
* Thus, setjmp implementations vary in two independent ways which may
* be identified through the following preprocessor tokens:
*
* _SETJMP_SYMBOL -- If 0, this means the compiler treats setjmp and _setjmp
* specially. If 1, this means the compiler treats __setjmp specially.
*
* _SETJMP_SAVES_REGS -- If 1, this means setjmp/longjmp must explicitly
* save and restore all registers. This also implies that a jmp_buf is
* different than a sigcontext structure. If 0, this means that the compiler
* will not use register variables within a function that calls one of
* its SETJMP_SYMBOLs.
*
* When _SETJMP_SYMBOL = 1, the implementation has a few dozen bytes of
* unnecessary overhead. This happens in the following manner: a program uses
* _setjmp/_longjmp because it is not interested in saving and restoring the
* signal mask. Nevertheless, because _setjmp expands to the general purpose
* function __setjmp, code for sigprocmask(2) is linked into the program.
*/
#ifndef _SETJMP_H
#define _SETJMP_H
#ifndef _ANSI_H
#include <ansi.h>
#endif
#if !defined(__ACK__) && !defined(__BCC__) && !defined(__GNUC__)
#define __ACK__
#endif
#ifdef __ACK__
#define _SETJMP_SYMBOL 1
#define _SETJMP_SAVES_REGS 0
#endif
#ifdef __BCC__
#define _SETJMP_SYMBOL 0
#define _SETJMP_SAVES_REGS 1
#endif
#ifdef __GNUC__
#define _SETJMP_SYMBOL 0
#define _SETJMP_SAVES_REGS 1
#endif
/* The jmp_buf data type. Do not change the order of these fields -- some
* C library code refers to these fields by name. When _SETJMP_SAVES_REGS
* is 1, the file <sys/jmp_buf.h> gives the usage of the sixteen registers.
*/
typedef struct {
int __flags; /* XXX - long might give better alignment */
long __mask; /* must have size >= sizeof(sigset_t) */
#if (_SETJMP_SAVES_REGS == 0)
_PROTOTYPE(void (*__pc),(void)); /* program counter */
void *__sp; /* stack pointer */
void *__lb; /* local base (ACKspeak for frame pointer) */
#else
void *__regs[16]; /* size is machine dependent */
#endif
} jmp_buf[1];
#if (_SETJMP_SYMBOL == 1)
_PROTOTYPE( int __setjmp, (jmp_buf _env, int _savemask) );
_PROTOTYPE( void longjmp, (jmp_buf _env, int _val) );
_PROTOTYPE(int sigjmp, (jmp_buf _jb, int _retval) );
#define setjmp(env) __setjmp((env), 1)
#ifdef _MINIX
#define _setjmp(env) __setjmp((env), 0)
_PROTOTYPE(void _longjmp, (jmp_buf _env, int _val) );
#endif
#ifdef _POSIX_SOURCE
typedef jmp_buf sigjmp_buf;
_PROTOTYPE( void siglongjmp, (sigjmp_buf _env, int _val) );
#define sigsetjmp(env, savemask) __setjmp((env), (savemask))
#endif /* _POSIX_SOURCE */
#endif /* _SETJMP_SYMBOL == 1 */
#if (_SETJMP_SYMBOL == 0)
_PROTOTYPE( int setjmp, (jmp_buf _env) );
_PROTOTYPE( void longjmp, (jmp_buf _env, int _val) );
#ifdef _MINIX
_PROTOTYPE( int _setjmp, (jmp_buf _env) );
_PROTOTYPE( void _longjmp, (jmp_buf _env, int _val) );
#endif
#ifdef _POSIX_SOURCE
#define sigjmp_buf jmp_buf
_PROTOTYPE( void siglongjmp, (sigjmp_buf _env, int _val) );
/* XXX - the name _setjmp is no good - that's why ACK used __setjmp. */
#define sigsetjmp(env, savemask) ((savemask) ? setjmp(env) : _setjmp(env))
#endif /* _POSIX_SOURCE */
#endif /* _SETJMP_SYMBOL == 0 */
#endif /* _SETJMP_H */

92
include/sgtty.h Executable file
View File

@@ -0,0 +1,92 @@
/* The <sgtty.h> header contains data structures for ioctl(). */
#ifndef _SGTTY_H
#define _SGTTY_H
/* Should not be used, nor extended. Termios.h is the replacement for
* sgtty.h for tty functions, and ioctl replaced code should be moved to
* sys/ioctl.h and specific header files in the sys, or minix directory.
*/
#include <sys/ioctl.h> /* Ouch. */
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) */
};
#if !_SYSTEM /* the kernel doesn't want to see the rest */
/* 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 B19200 192
#define B38400 195
#define B57600 194
#define B115200 193
/* 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
/* Copied from termios.h: */
struct winsize
{
unsigned short ws_row; /* rows, in characters */
unsigned short ws_col; /* columns, in characters */
unsigned short ws_xpixel; /* horizontal size, pixels */
unsigned short ws_ypixel; /* vertical size, pixels */
};
#endif /* !_SYSTEM */
#endif /* _SGTTY_H */

112
include/signal.h Executable file
View File

@@ -0,0 +1,112 @@
/* 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
#ifndef _ANSI_H
#include <ansi.h>
#endif
#ifdef _POSIX_SOURCE
#ifndef _TYPES_H
#include <sys/types.h>
#endif
#endif
/* Here are types that are closely associated with signal handling. */
typedef int sig_atomic_t;
#ifdef _POSIX_SOURCE
#ifndef _SIGSET_T
#define _SIGSET_T
typedef unsigned long sigset_t;
#endif
#endif
#define _NSIG 17 /* 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 SIGCHLD 17 /* child process terminated or stopped */
#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 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 */
/* The sighandler_t type is not allowed unless _POSIX_SOURCE is defined. */
typedef void _PROTOTYPE( (*__sighandler_t), (int) );
/* Macros used as function pointers. */
#define SIG_ERR ((__sighandler_t) -1) /* error return */
#define SIG_DFL ((__sighandler_t) 0) /* default signal handling */
#define SIG_IGN ((__sighandler_t) 1) /* ignore signal */
#define SIG_HOLD ((__sighandler_t) 2) /* block signal */
#define SIG_CATCH ((__sighandler_t) 3) /* catch signal */
#ifdef _POSIX_SOURCE
struct sigaction {
__sighandler_t 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 */
};
/* Fields for sa_flags. */
#define SA_ONSTACK 0x0001 /* deliver signal on alternate stack */
#define SA_RESETHAND 0x0002 /* reset signal handler when signal caught */
#define SA_NODEFER 0x0004 /* don't block signal while catching it */
#define SA_RESTART 0x0008 /* automatic system call restart */
#define SA_SIGINFO 0x0010 /* extended signal handling */
#define SA_NOCLDWAIT 0x0020 /* don't create zombies */
#define SA_NOCLDSTOP 0x0040 /* don't receive SIGCHLD when child stops */
/* POSIX requires these values for use with sigprocmask(2). */
#define SIG_BLOCK 0 /* for blocking signals */
#define SIG_UNBLOCK 1 /* for unblocking signals */
#define SIG_SETMASK 2 /* for setting the signal mask */
#define SIG_INQUIRE 4 /* for internal use only */
#endif /* _POSIX_SOURCE */
/* POSIX and ANSI function prototypes. */
_PROTOTYPE( int raise, (int _sig) );
_PROTOTYPE( __sighandler_t signal, (int _sig, __sighandler_t _func) );
#ifdef _POSIX_SOURCE
_PROTOTYPE( int kill, (pid_t _pid, int _sig) );
_PROTOTYPE( int sigaction,
(int _sig, const struct sigaction *_act, struct sigaction *_oact) );
_PROTOTYPE( int sigaddset, (sigset_t *_set, int _sig) );
_PROTOTYPE( int sigdelset, (sigset_t *_set, int _sig) );
_PROTOTYPE( int sigemptyset, (sigset_t *_set) );
_PROTOTYPE( int sigfillset, (sigset_t *_set) );
_PROTOTYPE( int sigismember, (const sigset_t *_set, int _sig) );
_PROTOTYPE( int sigpending, (sigset_t *_set) );
_PROTOTYPE( int sigprocmask,
(int _how, const sigset_t *_set, sigset_t *_oset) );
_PROTOTYPE( int sigsuspend, (const sigset_t *_sigmask) );
#endif
#endif /* _SIGNAL_H */

90
include/stdarg.h Executable file
View File

@@ -0,0 +1,90 @@
/* 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
*
* Ken Thompson's famous line from V6 UNIX is equally applicable to this file:
*
* "You are not expected to understand this"
*
*/
#ifndef _STDARG_H
#define _STDARG_H
#ifdef __GNUC__
/* The GNU C-compiler uses its own, but similar varargs mechanism. */
typedef char *va_list;
/* Amount of space required in an argument list for an arg of type TYPE.
* TYPE may alternatively be an expression whose type is used.
*/
#define __va_rounded_size(TYPE) \
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#if __GNUC__ < 2
#ifndef __sparc__
#define va_start(AP, LASTARG) \
(AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
#else
#define va_start(AP, LASTARG) \
(__builtin_saveregs (), \
AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
#endif
void va_end (va_list); /* Defined in gnulib */
#define va_end(AP)
#define va_arg(AP, TYPE) \
(AP += __va_rounded_size (TYPE), \
*((TYPE *) (AP - __va_rounded_size (TYPE))))
#else /* __GNUC__ >= 2 */
#ifndef __sparc__
#define va_start(AP, LASTARG) \
(AP = ((char *) __builtin_next_arg ()))
#else
#define va_start(AP, LASTARG) \
(__builtin_saveregs (), AP = ((char *) __builtin_next_arg ()))
#endif
void va_end (va_list); /* Defined in libgcc.a */
#define va_end(AP)
#define va_arg(AP, TYPE) \
(AP = ((char *) (AP)) += __va_rounded_size (TYPE), \
*((TYPE *) ((char *) (AP) - __va_rounded_size (TYPE))))
#endif /* __GNUC__ >= 2 */
#else /* not __GNUC__ */
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 /* __GNUC__ */
#endif /* _STDARG_H */

27
include/stddef.h Executable file
View File

@@ -0,0 +1,27 @@
/* 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) (unsigned long) &((type *)0)->ident)
#if _EM_PSIZE == _EM_WSIZE
typedef int ptrdiff_t; /* result of subtracting two pointers */
#else /* _EM_PSIZE == _EM_LSIZE */
typedef long ptrdiff_t;
#endif
#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 */

155
include/stdio.h Executable file
View File

@@ -0,0 +1,155 @@
/*
* 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$ */
#ifndef _STDIO_H
#define _STDIO_H
#ifndef _ANSI_H
#include <ansi.h>
#endif
/*
* Focus point of all stdio activity.
*/
typedef struct __iobuf {
int _count;
int _fd;
int _flags;
int _bufsiz;
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
#include <sys/dir.h>
#define FILENAME_MAX DIRSIZ
#define TMP_MAX 999
#define L_tmpnam (sizeof("/tmp/") + FILENAME_MAX)
#define __STDIO_VA_LIST__ void *
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;
_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 printf, (const char *_format, ...) );
_PROTOTYPE( int sprintf, (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 fscanf, (FILE *_stream, const char *_format, ...) );
_PROTOTYPE( int scanf, (const char *_format, ...) );
_PROTOTYPE( int sscanf, (const char *_s, const char *_format, ...) );
#define vfscanf _doscan
_PROTOTYPE( int vfscanf, (FILE *_stream, const char *_format, char *_arg));
_PROTOTYPE( int vscanf, (const char *_format, char *_arg) );
_PROTOTYPE( int vsscanf, (const 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)
#define clearerr(p) ((p)->_flags &= ~(_IOERR|_IOEOF))
#ifdef _POSIX_SOURCE
_PROTOTYPE( int fileno, (FILE *_stream) );
_PROTOTYPE (FILE *fdopen, (int _fildes, const char *_types) );
#define fileno(stream) ((stream)->_fd)
#define L_ctermid 255 /* required by POSIX */
#define L_cuserid 255 /* required by POSIX */
#endif
#ifdef _MINIX
_PROTOTYPE(FILE *popen, (const char *_command, const char *_type));
_PROTOTYPE(int pclose, (FILE *_stream));
_PROTOTYPE(int snprintf, (char *_s, size_t _n, const char *_format, ...));
_PROTOTYPE(int vsnprintf, (char *_s, size_t _n, const char *_format,
char *_arg) );
#endif
#endif /* _STDIO_H */

73
include/stdlib.h Executable file
View File

@@ -0,0 +1,73 @@
/* The <stdlib.h> header defines certain common macros, types, and functions.*/
#ifndef _STDLIB_H
#define _STDLIB_H
#ifndef _ANSI_H
#include <ansi.h>
#endif
/* 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. */
_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, wchar_t _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) );
#ifdef _MINIX
_PROTOTYPE( int putenv, (const char *_name) );
_PROTOTYPE(int getopt, (int _argc, char **_argv, char *_opts));
extern char *optarg;
extern int optind, opterr, optopt;
#endif /* _MINIX */
#endif /* STDLIB_H */

59
include/string.h Executable file
View File

@@ -0,0 +1,59 @@
/* 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 /*_SIZE_T */
/* Function Prototypes. */
#ifndef _ANSI_H
#include <ansi.h>
#endif
_PROTOTYPE( void *memchr, (const void *_s, int _c, size_t _n) );
_PROTOTYPE( int memcmp, (const void *_s1, const void *_s2, size_t _n) );
_PROTOTYPE( void *memcpy, (void *_s1, const void *_s2, size_t _n) );
_PROTOTYPE( void *memmove, (void *_s1, const void *_s2, size_t _n) );
_PROTOTYPE( void *memset, (void *_s, int _c, size_t _n) );
_PROTOTYPE( char *strcat, (char *_s1, const char *_s2) );
_PROTOTYPE( char *strchr, (const char *_s, int _c) );
_PROTOTYPE( int strncmp, (const char *_s1, const char *_s2, size_t _n) );
_PROTOTYPE( int strcmp, (const char *_s1, const char *_s2) );
_PROTOTYPE( int strcoll, (const char *_s1, const char *_s2) );
_PROTOTYPE( char *strcpy, (char *_s1, const char *_s2) );
_PROTOTYPE( size_t strcspn, (const char *_s1, const char *_s2) );
_PROTOTYPE( char *strerror, (int _errnum) );
_PROTOTYPE( size_t strlen, (const char *_s) );
_PROTOTYPE( char *strncat, (char *_s1, const char *_s2, size_t _n) );
_PROTOTYPE( char *strncpy, (char *_s1, const char *_s2, size_t _n) );
_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( size_t strxfrm, (char *_s1, const char *_s2, size_t _n) );
#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 void *_src, void *_dst, size_t _length) );
_PROTOTYPE( int bcmp, (const void *_s1, const void *_s2, size_t _length));
_PROTOTYPE( void bzero, (void *_dst, size_t _length) );
_PROTOTYPE( void *memccpy, (char *_dst, const char *_src, int _ucharstop,
size_t _size) );
/* Misc. extra functions */
_PROTOTYPE( int strcasecmp, (const char *_s1, const char *_s2) );
_PROTOTYPE( int strncasecmp, (const char *_s1, const char *_s2,
size_t _len) );
_PROTOTYPE( size_t strnlen, (const char *_s, size_t _n) );
#endif
#endif /* _STRING_H */

40
include/sys/asynchio.h Executable file
View File

@@ -0,0 +1,40 @@
/* asynchio.h - Asynchronous I/O Author: Kees J. Bot
* 26 Jan 1995
* This is just a fake async I/O library to be used for programs
* written for Minix-vmd that must also run under standard Minix.
* This limits the number of ugly #ifdefs somewhat. The programs must
* be restricted to performing just one service, of course.
*/
#ifndef _SYS__ASYNCHIO_H
#define _SYS__ASYNCHIO_H
#ifndef _ANSI_H
#include <ansi.h>
#endif
typedef struct {
char state;
char op;
char fd;
char req;
void *data;
ssize_t count;
int errno;
} asynchio_t;
#define ASYN_NONBLOCK 0x01
struct timeval { long tv_sec, tv_usec; };
#define EINPROGRESS EINTR
#define ASYN_INPROGRESS EINPROGRESS
void asyn_init(asynchio_t *_asyn);
ssize_t asyn_read(asynchio_t *_asyn, int _fd, void *_buf, size_t _len);
ssize_t asyn_write(asynchio_t *_asyn, int _fd, const void *_buf, size_t _len);
int asyn_ioctl(asynchio_t *_asyn, int _fd, unsigned long _request, void *_data);
int asyn_wait(asynchio_t *_asyn, int _flags, struct timeval *to);
int asyn_synch(asynchio_t *_asyn, int _fd);
int asyn_close(asynchio_t *_asyn, int _fd);
#endif /* _SYS__ASYNCHIO_H */

19
include/sys/dir.h Executable file
View File

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

15
include/sys/ioc_disk.h Executable file
View File

@@ -0,0 +1,15 @@
/* sys/ioc_disk.h - Disk ioctl() command codes. Author: Kees J. Bot
* 23 Nov 2002
*
*/
#ifndef _S_I_DISK_H
#define _S_I_DISK_H
#include <minix/ioctl.h>
#define DIOCSETP _IOW('d', 3, struct partition)
#define DIOCGETP _IOR('d', 4, struct partition)
#define DIOCEJECT _IO ('d', 5)
#endif /* _S_I_DISK_H */

19
include/sys/ioc_memory.h Executable file
View File

@@ -0,0 +1,19 @@
/* sys/ioc_memory.h - Memory ioctl() command codes.
* Author: Kees J. Bot
* 23 Nov 2002
*
*/
#ifndef _S_I_MEMORY_H
#define _S_I_MEMORY_H
#include <minix/ioctl.h>
#define MIOCRAMSIZE _IOW('m', 3, u32_t)
#define MIOCSPSINFO _IOW('m', 4, void *)
#define MIOCGPSINFO _IOR('m', 5, struct psinfo)
#define MIOCINT86 _IORW('m', 6, struct mio_int86)
#define MIOCGLDT86 _IORW('m', 7, struct mio_ldt86)
#define MIOCSLDT86 _IOW('m', 8, struct mio_ldt86)
#endif /* _S_I_MEMORY_H */

13
include/sys/ioc_scsi.h Executable file
View File

@@ -0,0 +1,13 @@
/* sys/ioc_scsi.h - SCSI ioctl() command codes. Author: Kees J. Bot
* 23 Nov 2002
*
*/
#ifndef _S_I_SCSI_H
#define _S_I_SCSI_H
#include <minix/ioctl.h>
#define SCIOCCMD _IOW('S', 1, struct scsicmd)
#endif /* _S_I_SCSI_H */

30
include/sys/ioc_sound.h Executable file
View File

@@ -0,0 +1,30 @@
/* sys/ioc_sound.h - Sound ioctl() command codes. Author: Kees J. Bot
* 23 Nov 2002
*
*/
#ifndef _S_I_SOUND_H
#define _S_I_SOUND_H
#include <minix/ioctl.h>
/* Soundcard DSP ioctls. */
#define DSPIORATE _IOR('s', 1, unsigned int)
#define DSPIOSTEREO _IOR('s', 2, unsigned int)
#define DSPIOSIZE _IOR('s', 3, unsigned int)
#define DSPIOBITS _IOR('s', 4, unsigned int)
#define DSPIOSIGN _IOR('s', 5, unsigned int)
#define DSPIOMAX _IOW('s', 6, unsigned int)
#define DSPIORESET _IO ('s', 7)
/* Soundcard mixer ioctls. */
#define MIXIOGETVOLUME _IORW('s', 10, struct volume_level)
#define MIXIOGETINPUTLEFT _IORW('s', 11, struct inout_ctrl)
#define MIXIOGETINPUTRIGHT _IORW('s', 12, struct inout_ctrl)
#define MIXIOGETOUTPUT _IORW('s', 13, struct inout_ctrl)
#define MIXIOSETVOLUME _IORW('s', 20, struct volume_level)
#define MIXIOSETINPUTLEFT _IORW('s', 21, struct inout_ctrl)
#define MIXIOSETINPUTRIGHT _IORW('s', 22, struct inout_ctrl)
#define MIXIOSETOUTPUT _IORW('s', 23, struct inout_ctrl)
#endif /* _S_I_SOUND_H */

15
include/sys/ioc_tape.h Executable file
View File

@@ -0,0 +1,15 @@
/* sys/ioc_tape.h - Magnetic Tape ioctl() command codes.
* Author: Kees J. Bot
* 23 Nov 2002
*
*/
#ifndef _S_I_TAPE_H
#define _S_I_TAPE_H
#include <minix/ioctl.h>
#define MTIOCTOP _IOW('M', 1, struct mtop)
#define MTIOCGET _IOR('M', 2, struct mtget)
#endif /* _S_I_TAPE_H */

36
include/sys/ioc_tty.h Executable file
View File

@@ -0,0 +1,36 @@
/* sys/ioc_tty.h - Terminal ioctl() command codes.
* Author: Kees J. Bot
* 23 Nov 2002
*
*/
#ifndef _S_I_TTY_H
#define _S_I_TTY_H
#include <minix/ioctl.h>
/* Terminal ioctls. */
#define TCGETS _IOR('T', 8, struct termios) /* tcgetattr */
#define TCSETS _IOW('T', 9, struct termios) /* tcsetattr, TCSANOW */
#define TCSETSW _IOW('T', 10, struct termios) /* tcsetattr, TCSADRAIN */
#define TCSETSF _IOW('T', 11, struct termios) /* tcsetattr, TCSAFLUSH */
#define TCSBRK _IOW('T', 12, int) /* tcsendbreak */
#define TCDRAIN _IO ('T', 13) /* tcdrain */
#define TCFLOW _IOW('T', 14, int) /* tcflow */
#define TCFLSH _IOW('T', 15, int) /* tcflush */
#define TIOCGWINSZ _IOR('T', 16, struct winsize)
#define TIOCSWINSZ _IOW('T', 17, struct winsize)
#define TIOCGPGRP _IOW('T', 18, int)
#define TIOCSPGRP _IOW('T', 19, int)
#define TIOCSFON _IOW('T', 20, u8_t [8192])
/* Legacy <sgtty.h> */
#define TIOCGETP _IOR('t', 1, struct sgttyb)
#define TIOCSETP _IOW('t', 2, struct sgttyb)
#define TIOCGETC _IOR('t', 3, struct tchars)
#define TIOCSETC _IOW('t', 4, struct tchars)
/* Keyboard ioctls. */
#define KIOCSMAP _IOW('k', 3, keymap_t)
#endif /* _S_I_TTY_H */

24
include/sys/ioctl.h Executable file
View File

@@ -0,0 +1,24 @@
/* sys/ioctl.h - All ioctl() command codes. Author: Kees J. Bot
* 23 Nov 2002
*
* This header file includes all other ioctl command code headers.
*/
#ifndef _S_IOCTL_H
#define _S_IOCTL_H
/* A driver that uses ioctls claims a character for its series of commands.
* For instance: #define TCGETS _IOR('T', 8, struct termios)
* This is a terminal ioctl that uses the character 'T'. The character(s)
* used in each header file are shown in the comment following.
*/
#include <sys/ioc_tty.h> /* 'T' 't' 'k' */
#include <net/ioctl.h> /* 'n' */
#include <sys/ioc_disk.h> /* 'd' */
#include <sys/ioc_memory.h> /* 'm' */
#include <sys/ioc_tape.h> /* 'M' */
#include <sys/ioc_scsi.h> /* 'S' */
#include <sys/ioc_sound.h> /* 's' */
#endif /* _S_IOCTL_H */

Some files were not shown because too many files have changed in this diff Show More