More cleaning up

This commit is contained in:
Antoine Leca 2012-02-14 19:58:27 +01:00 committed by Ben Gras
parent 1ead18e447
commit 3fb8cb760c
54 changed files with 24 additions and 4200 deletions

View file

@ -2,7 +2,7 @@
.include <bsd.own.mk>
SUBDIR= add_route arp ash at autil awk \
SUBDIR= add_route arp ash at awk \
backup badblocks banner basename \
btrace cal calendar \
cat cawf cd cdprobe checkhier \

View file

@ -1,10 +0,0 @@
# Makefile for commands/autil
PROGS= anm asize
SRCS.anm= anm.c rd.c rd_arhdr.c rd_bytes.c rd_unsig2.c
SRCS.asize= asize.c
CPPFLAGS+= -I${.CURDIR}
MAN.anm=
MAN.asize=
.include <bsd.prog.mk>

View file

@ -1,340 +0,0 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/*
** print symbol tables for
** ACK object files
**
** anm [-gopruns] [name ...]
*/
#include "out.h"
#include "arch.h"
#include "ranlib.h"
#include <stdio.h>
#include <ctype.h>
int numsort_flg;
int sectsort_flg;
int undef_flg;
int revsort_flg = 1;
int globl_flg;
int nosort_flg;
int arch_flg;
int prep_flg;
int read_error;
struct outhead hbuf;
struct outsect sbuf;
long off;
char *malloc();
char *realloc();
long s_base[S_MAX]; /* for specially encoded bases */
char *filename;
int narg;
main(argc, argv)
char **argv;
{
if (--argc>0 && argv[1][0]=='-' && argv[1][1]!=0) {
argv++;
while (*++*argv) switch (**argv) {
case 'n': /* sort numerically */
numsort_flg++;
continue;
case 's': /* sort in section order */
sectsort_flg++;
continue;
case 'g': /* globl symbols only */
globl_flg++;
continue;
case 'u': /* undefined symbols only */
undef_flg++;
continue;
case 'r': /* sort in reverse order */
revsort_flg = -1;
continue;
case 'p': /* don't sort -- symbol table order */
nosort_flg++;
continue;
case 'o': /* prepend a name to each line */
prep_flg++;
continue;
default: /* oops */
fprintf(stderr, "anm: invalid argument -%c\n", *argv[0]);
exit(1);
}
argc--;
}
if (argc == 0) {
argc = 1;
argv[1] = "a.out";
}
narg = argc;
while(argc--) {
int fd;
filename = *++argv;
if ((fd = open(filename, 0)) < 0) {
fprintf(stderr, "anm: cannot open %s\n", filename);
continue;
}
process(fd);
close(fd);
}
exit(0);
}
extern int rd_unsigned2();
extern long lseek();
extern char *strncpy();
void do_file(int fd);
process(fd)
int fd;
{
unsigned int magic;
long nextpos;
struct ar_hdr archive_header;
static char buf[sizeof(archive_header.ar_name)+1];
if (narg > 1) printf("\n%s:\n", filename);
magic = rd_unsigned2(fd);
switch(magic) {
case O_MAGIC:
lseek(fd, 0L, 0);
do_file(fd);
break;
case ARMAG:
case AALMAG:
while (rd_arhdr(fd, &archive_header)) {
nextpos = lseek(fd, 0L, 1) + archive_header.ar_size;
if (nextpos & 1) nextpos++;
strncpy(buf,archive_header.ar_name,sizeof(archive_header.ar_name));
filename = buf;
if ( strcmp(filename, SYMDEF)) {
printf("\n%s:\n", filename);
do_file(fd);
}
lseek(fd, nextpos, 0);
}
break;
default:
fprintf(stderr, "anm: %s -- bad format\n", filename);
break;
}
}
void do_file(fd)
int fd;
{
struct outname *nbufp = NULL;
struct outname nbuf;
char *cbufp;
long fi_to_co;
long n;
unsigned readcount;
int i,j;
int compare();
read_error = 0;
rd_fdopen(fd);
rd_ohead(&hbuf);
if (read_error) {
return;
}
if (BADMAGIC(hbuf)) {
return;
}
n = hbuf.oh_nname;
if (n == 0) {
fprintf(stderr, "anm: %s -- no name list\n", filename);
return;
}
if (hbuf.oh_nchar == 0) {
fprintf(stderr, "anm: %s -- no names\n", filename);
return;
}
if ((readcount = hbuf.oh_nchar) != hbuf.oh_nchar) {
fprintf(stderr, "anm: string area too big in %s\n", filename);
exit(2);
}
/* store special section bases ??? */
if (hbuf.oh_flags & HF_8086) {
rd_sect(&sbuf, hbuf.oh_nsect);
if (read_error) {
return;
}
for (i=0; i<hbuf.oh_nsect; i++) {
s_base[i+S_MIN] =
(sbuf.os_base>>12) & 03777760;
}
}
if ((cbufp = (char *)malloc(readcount)) == NULL) {
fprintf(stderr, "anm: out of memory on %s\n", filename);
exit(2);
}
rd_string(cbufp, hbuf.oh_nchar);
if (read_error) {
free(cbufp);
return;
}
fi_to_co = (long) (cbufp - OFF_CHAR(hbuf));
i = 0;
while (--n >= 0) {
rd_name(&nbuf, 1);
if (read_error) {
break;
}
if (globl_flg && (nbuf.on_type&S_EXT)==0)
continue;
if (undef_flg
&&
((nbuf.on_type&S_TYP)!=S_UND || (nbuf.on_type&S_ETC)!=0))
continue;
if (nbuf.on_foff == 0) nbuf.on_mptr = 0;
else nbuf.on_mptr = (char *) (nbuf.on_foff + fi_to_co);
/* adjust value for specially encoded bases */
if (hbuf.oh_flags & HF_8086) {
if (((nbuf.on_type&S_ETC) == 0) ||
((nbuf.on_type&S_ETC) == S_SCT)) {
j = nbuf.on_type&S_TYP;
if ((j>=S_MIN) && (j<=S_MAX))
nbuf.on_valu += s_base[j];
}
}
if (nbufp == NULL)
nbufp = (struct outname *)malloc(sizeof(struct outname));
else
nbufp = (struct outname *)realloc(nbufp, (i+1)*sizeof(struct outname));
if (nbufp == NULL) {
fprintf(stderr, "anm: out of memory on %s\n", filename);
exit(2);
}
nbufp[i++] = nbuf;
}
if (nbufp && nosort_flg==0)
qsort(nbufp, i, sizeof(struct outname), compare);
for (n=0; n<i; n++) {
char cs1[4];
char cs2[4];
if (prep_flg)
printf("%s:", filename);
switch(nbufp[n].on_type&S_ETC) {
case S_SCT:
sprintf(cs1, "%2d", (nbufp[n].on_type&S_TYP) - S_MIN);
sprintf(cs2, " S");
break;
case S_FIL:
sprintf(cs1, " -");
sprintf(cs2, " F");
break;
case S_MOD:
sprintf(cs1, " -");
sprintf(cs2, " M");
break;
case S_COM:
sprintf(cs1, " C");
if (nbufp[n].on_type&S_EXT)
sprintf(cs2, " E");
else
sprintf(cs2, " -");
break;
case 0:
if (nbufp[n].on_type&S_EXT)
sprintf(cs2, " E");
else
sprintf(cs2, " -");
switch(nbufp[n].on_type&S_TYP) {
case S_UND:
sprintf(cs1, " U");
break;
case S_ABS:
sprintf(cs1, " A");
break;
default:
sprintf(cs1, "%2d", (nbufp[n].on_type&S_TYP) - S_MIN);
}
break;
default:
sprintf(cs1, "??");
sprintf(cs2, " ?");
}
printf("%8lx %s %s %s\n",nbufp[n].on_valu,cs1,cs2,nbufp[n].on_mptr ? nbufp[n].on_mptr : "(NULL)");
}
if (nbufp)
free((char *)nbufp);
if (cbufp)
free((char *)cbufp);
}
compare(p1, p2)
struct outname *p1, *p2;
{
int i;
if (sectsort_flg) {
if ((p1->on_type&S_TYP) > (p2->on_type&S_TYP))
return(revsort_flg);
if ((p1->on_type&S_TYP) < (p2->on_type&S_TYP))
return(-revsort_flg);
}
if (numsort_flg) {
if (p1->on_valu > p2->on_valu)
return(revsort_flg);
if (p1->on_valu < p2->on_valu)
return(-revsort_flg);
}
if (! p1->on_mptr) {
if (! p2->on_mptr) return 0;
return -revsort_flg;
}
if (! p2->on_mptr) return revsort_flg;
i = strcmp(p1->on_mptr, p2->on_mptr);
if (i > 0)
return(revsort_flg);
if (i < 0)
return(-revsort_flg);
return(0);
}
rd_fatal()
{
fprintf(stderr,"read error on %s\n", filename);
read_error = 1;
}

View file

@ -1,24 +0,0 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#ifndef __ARCH_H_INCLUDED
#define __ARCH_H_INCLUDED
#define ARMAG 0177545
#define AALMAG 0177454
struct ar_hdr {
char ar_name[14];
long ar_date;
char ar_uid;
char ar_gid;
short ar_mode;
long ar_size;
};
#define AR_TOTAL 26
#define AR_SIZE 22
#endif /* __ARCH_H_INCLUDED */

View file

@ -1,93 +0,0 @@
/* @(#)asize.c 1.4 */
#define ushort unsigned short
#include <stdio.h>
#include "out.h"
/*
asize -- determine object size
*/
main(argc, argv)
char **argv;
{
struct outhead buf;
struct outsect sbuf;
ushort nrsect;
long sum;
int gorp;
FILE *f;
if (--argc == 0) {
argc = 1;
argv[1] = "a.out";
}
gorp = argc;
while(argc--) {
if ((f = fopen(*++argv, "r"))==NULL) {
fprintf(stderr, "asize: cannot open %s\n", *argv);
continue;
}
getofmt ((char *)&buf, SF_HEAD , f);
if(BADMAGIC(buf)) {
fprintf(stderr, "asize: %s-- bad format\n", *argv);
fclose(f);
continue;
}
nrsect = buf.oh_nsect;
if (nrsect == 0) {
fprintf(stderr, "asize: %s-- no sections\n", *argv);
fclose(f);
continue;
}
if (gorp > 1)
printf("%s: ", *argv);
sum = 0;
while (nrsect-- > 0) {
getofmt ((char *)&sbuf, SF_SECT , f);
printf("%ld", sbuf.os_size);
sum += sbuf.os_size;
if (nrsect > 0)
putchar('+');
}
printf(" = %ld = 0x%lx\n", sum, sum);
fclose(f);
}
}
getofmt(p, s, f)
register char *p;
register char *s;
register FILE *f;
{
register i;
register long l;
for (;;) {
switch (*s++) {
/* case '0': p++; continue; */
case '1':
*p++ = getc(f);
continue;
case '2':
i = getc(f);
i |= (getc(f) << 8);
*((short *)p) = i; p += sizeof(short);
continue;
case '4':
l = (long)getc(f);
l |= ((long)getc(f) << 8);
l |= ((long)getc(f) << 16);
l |= ((long)getc(f) << 24);
*((long *)p) = l; p += sizeof(long);
continue;
default:
case '\0':
break;
}
break;
}
}

View file

View file

@ -1,78 +0,0 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#include <local.h>
#include <stdio.h>
#include <out.h>
#include <ranlib.h>
#include <arch.h>
#include "object.h"
#if ! defined(CHAR_UNSIGNED)
#define CHAR_UNSIGNED 0
#endif
#if CHAR_UNSIGNED
#define Xchar(ch) (ch)
#else
#define Xchar(ch) ((ch) & 0377)
#endif
#if ! defined(BYTE_ORDER)
#define BYTE_ORDER 0x3210
#endif
#if (BYTE_ORDER == 0x3210 || BYTE_ORDER == 0x1032)
#define uget2(c) (Xchar((c)[0]) | ((unsigned) Xchar((c)[1]) << 8))
#define Xput2(i, c) (((c)[0] = (i)), ((c)[1] = (i) >> 8))
#define put2(i, c) { register int j = (i); Xput2(j, c); }
#else
#define uget2(c) (* ((unsigned short *) (c)))
#define Xput2(i, c) (* ((short *) (c)) = (i))
#define put2(i, c) Xput2(i, c)
#endif
#define get2(c) ((short) uget2(c))
#if BYTE_ORDER != 0x0123
#define get4(c) (uget2(c) | ((long) uget2((c)+2) << 16))
#define put4(l, c) { register long x=(l); \
Xput2((int)x,c); \
Xput2((int)(x>>16),(c)+2); \
}
#else
#define get4(c) (* ((long *) (c)))
#define put4(l, c) (* ((long *) (c)) = (l))
#endif
#define SECTCNT 3 /* number of sections with own output buffer */
#if BIGMACHINE
#define WBUFSIZ (8*BUFSIZ)
#else
#define WBUFSIZ BUFSIZ
#endif
struct fil {
int cnt;
char *pnow;
char *pbegin;
long currpos;
int fd;
char pbuf[WBUFSIZ];
};
extern struct fil __parts[];
#define PARTEMIT 0
#define PARTRELO (PARTEMIT+SECTCNT)
#define PARTNAME (PARTRELO+1)
#define PARTCHAR (PARTNAME+1)
#ifdef SYMDBUG
#define PARTDBUG (PARTCHAR+1)
#else
#define PARTDBUG (PARTCHAR+0)
#endif
#define NPARTS (PARTDBUG + 1)
#define getsect(s) (PARTEMIT+((s)>=(SECTCNT-1)?(SECTCNT-1):(s)))

View file

@ -1,44 +0,0 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#include <minix/ansi.h>
#ifndef __OBJECT_INCLUDED__
#define __OBJECT_INCLUDED__
_PROTOTYPE(int wr_open, (char *f));
_PROTOTYPE(void wr_close, (void));
_PROTOTYPE(void wr_ohead, (struct outhead *h));
_PROTOTYPE(void wr_sect, (struct outsect *s, unsigned int c));
_PROTOTYPE(void wr_outsect, (int sectno));
_PROTOTYPE(void wr_emit, (char *b, long c));
_PROTOTYPE(void wr_putc, (int c));
_PROTOTYPE(void wr_relo, (struct outrelo *r, unsigned int c));
_PROTOTYPE(void wr_name, (struct outname *n, unsigned int c));
_PROTOTYPE(void wr_string, (char *s, long c));
_PROTOTYPE(void wr_arhdr, (int fd, struct ar_hdr *a));
_PROTOTYPE(void wr_ranlib, (int fd, struct ranlib *r, long cnt));
_PROTOTYPE(void wr_int2, (int fd, int i));
_PROTOTYPE(void wr_long, (int fd, long l));
_PROTOTYPE(void wr_bytes, (int fd, char *buf, long l));
_PROTOTYPE(int rd_open, (char *f));
_PROTOTYPE(int rd_fdopen, (int f));
_PROTOTYPE(void rd_close, (void));
_PROTOTYPE(void rd_ohead, (struct outhead *h));
_PROTOTYPE(void rd_sect, (struct outsect *s, unsigned int c));
_PROTOTYPE(void rd_outsect, (int sectno));
_PROTOTYPE(void rd_emit, (char *b, long c));
_PROTOTYPE(void rd_relo, (struct outrelo *r, unsigned int c));
_PROTOTYPE(void rd_rew_relo, (struct outhead *head));
_PROTOTYPE(void rd_name, (struct outname *n, unsigned int c));
_PROTOTYPE(void rd_string, (char *s, long c));
_PROTOTYPE(int rd_arhdr, (int fd, struct ar_hdr *a));
_PROTOTYPE(void rd_ranlib, (int fd, struct ranlib *r, long cnt));
_PROTOTYPE(int rd_int2, (int fd));
_PROTOTYPE(long rd_long, (int fd));
_PROTOTYPE(void rd_bytes, (int fd, char *buf, long l));
_PROTOTYPE(int rd_fd, (void));
#endif /* __OBJECT_INCLUDED__ */

View file

@ -1,126 +0,0 @@
/*
* (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 __OUT_H_INCLUDED
#define __OUT_H_INCLUDED
/*
* output format for ACK assemblers
*/
#ifndef ushort
#define ushort unsigned short
#endif /* ushort */
struct outhead {
ushort oh_magic; /* magic number */
ushort oh_stamp; /* version stamp */
ushort oh_flags; /* several format flags */
ushort oh_nsect; /* number of outsect structures */
ushort oh_nrelo; /* number of outrelo structures */
ushort oh_nname; /* number of outname structures */
long oh_nemit; /* sum of all os_flen */
long oh_nchar; /* size of string area */
};
#define O_MAGIC 0x0201 /* magic number of output file */
#define O_STAMP 0 /* version stamp */
#define MAXSECT 64 /* Maximum number of sections */
#define HF_LINK 0x0004 /* unresolved references left */
#define HF_8086 0x0008 /* os_base specially encoded */
struct outsect {
long os_base; /* startaddress in machine */
long os_size; /* section size in machine */
long os_foff; /* startaddress in file */
long os_flen; /* section size in file */
long os_lign; /* section alignment */
};
struct outrelo {
char or_type; /* type of reference */
char or_sect; /* referencing section */
ushort or_nami; /* referenced symbol index */
long or_addr; /* referencing address */
};
struct outname {
union {
char *on_ptr; /* symbol name (in core) */
long on_off; /* symbol name (in file) */
} on_u;
#define on_mptr on_u.on_ptr
#define on_foff on_u.on_off
ushort on_type; /* symbol type */
ushort on_desc; /* debug info */
long on_valu; /* symbol value */
};
/*
* relocation type bits
*/
#define RELSZ 0x07 /* relocation length */
#define RELO1 1 /* 1 byte */
#define RELO2 2 /* 2 bytes */
#define RELO4 4 /* 4 bytes */
#define RELPC 0x08 /* pc relative */
#define RELBR 0x10 /* High order byte lowest address. */
#define RELWR 0x20 /* High order word lowest address. */
/*
* section type bits and fields
*/
#define S_TYP 0x007F /* undefined, absolute or relative */
#define S_EXT 0x0080 /* external flag */
#define S_ETC 0x7F00 /* for symbolic debug, bypassing 'as' */
/*
* S_TYP field values
*/
#define S_UND 0x0000 /* undefined item */
#define S_ABS 0x0001 /* absolute item */
#define S_MIN 0x0002 /* first user section */
#define S_MAX (S_TYP-1) /* last user section */
#define S_CRS S_TYP /* on_valu is symbol index which contains value */
/*
* S_ETC field values
*/
#define S_SCT 0x0100 /* section names */
#define S_LIN 0x0200 /* hll source line item */
#define S_FIL 0x0300 /* hll source file item */
#define S_MOD 0x0400 /* ass source file item */
#define S_COM 0x1000 /* Common name. */
#define S_STB 0xe000 /* entries with any of these bits set are
reserved for debuggers
*/
/*
* structure format strings
*/
#define SF_HEAD "22222244"
#define SF_SECT "44444"
#define SF_RELO "1124"
#define SF_NAME "4224"
/*
* structure sizes (bytes in file; add digits in SF_*)
*/
#define SZ_HEAD 20
#define SZ_SECT 20
#define SZ_RELO 8
#define SZ_NAME 12
/*
* file access macros
*/
#define BADMAGIC(x) ((x).oh_magic!=O_MAGIC)
#define OFF_SECT(x) SZ_HEAD
#define OFF_EMIT(x) (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT))
#define OFF_RELO(x) (OFF_EMIT(x) + (x).oh_nemit)
#define OFF_NAME(x) (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO))
#define OFF_CHAR(x) (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME))
#endif /* __OUT_H_INCLUDED */

View file

@ -1,33 +0,0 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#ifndef __RANLIB_H_INCLUDED
#define __RANLIB_H_INCLUDED
#ifndef SYMDEF
# define SYMDEF "__.SYMDEF"
#endif /* SYMDEF */
/*
* Structure of the SYMDEF table of contents for an archive.
* SYMDEF begins with a long giving the number of ranlib
* structures that immediately follow, and then continues with a string
* table consisting of a long giving the number of bytes of
* strings that follow and then the strings themselves.
*/
struct ranlib {
union {
char *ran__ptr; /* symbol name (in core) */
long ran__off; /* symbol name (in file) */
} ran_u;
#define ran_ptr ran_u.ran__ptr
#define ran_off ran_u.ran__off
long ran_pos; /* library member is at this position */
};
#define SZ_RAN 8
#define SF_RAN "44"
#endif /* __RANLIB_H_INCLUDED */

View file

@ -1,259 +0,0 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#include "obj.h"
extern long lseek();
/*
* Parts of the output file.
*/
#undef PARTEMIT
#undef PARTRELO
#undef PARTNAME
#undef PARTCHAR
#undef PARTDBUG
#undef NPARTS
#define PARTEMIT 0
#define PARTRELO 1
#define PARTNAME 2
#define PARTCHAR 3
#ifdef SYMDBUG
#define PARTDBUG 4
#else
#define PARTDBUG 3
#endif
#define NPARTS (PARTDBUG + 1)
static long offset[MAXSECT];
static int outfile;
static long outseek[NPARTS];
static long currpos;
static long rd_base;
#define OUTSECT(i) \
(outseek[PARTEMIT] = offset[i])
#define BEGINSEEK(p, o) \
(outseek[(p)] = (o))
static int sectionnr;
static void
OUTREAD(p, b, n)
char *b;
long n;
{
register long l = outseek[p];
if (currpos != l) {
lseek(outfile, l, 0);
}
rd_bytes(outfile, b, n);
l += n;
currpos = l;
outseek[p] = l;
}
/*
* Open the output file according to the chosen strategy.
*/
int
rd_open(f)
char *f;
{
if ((outfile = open(f, 0)) < 0)
return 0;
return rd_fdopen(outfile);
}
static int offcnt;
int
rd_fdopen(fd)
{
register int i;
for (i = 0; i < NPARTS; i++) outseek[i] = 0;
offcnt = 0;
rd_base = lseek(fd, 0L, 1);
if (rd_base < 0) {
return 0;
}
currpos = rd_base;
outseek[PARTEMIT] = currpos;
outfile = fd;
sectionnr = 0;
return 1;
}
void
rd_close()
{
close(outfile);
outfile = -1;
}
int
rd_fd()
{
return outfile;
}
void
rd_ohead(head)
register struct outhead *head;
{
register long off;
OUTREAD(PARTEMIT, (char *) head, (long) SZ_HEAD);
#if BYTE_ORDER == 0x0123
if (sizeof(struct outhead) != SZ_HEAD)
#endif
{
register char *c = (char *) head + (SZ_HEAD-4);
head->oh_nchar = get4(c);
c -= 4; head->oh_nemit = get4(c);
c -= 2; head->oh_nname = uget2(c);
c -= 2; head->oh_nrelo = uget2(c);
c -= 2; head->oh_nsect = uget2(c);
c -= 2; head->oh_flags = uget2(c);
c -= 2; head->oh_stamp = uget2(c);
c -= 2; head->oh_magic = uget2(c);
}
off = OFF_RELO(*head) + rd_base;
BEGINSEEK(PARTRELO, off);
off += (long) head->oh_nrelo * SZ_RELO;
BEGINSEEK(PARTNAME, off);
off += (long) head->oh_nname * SZ_NAME;
BEGINSEEK(PARTCHAR, off);
#ifdef SYMDBUG
off += head->oh_nchar;
BEGINSEEK(PARTDBUG, off);
#endif
}
void
rd_rew_relos(head)
register struct outhead *head;
{
register long off = OFF_RELO(*head) + rd_base;
BEGINSEEK(PARTRELO, off);
}
void
rd_sect(sect, cnt)
register struct outsect *sect;
register unsigned int cnt;
{
register char *c = (char *) sect + cnt * SZ_SECT;
OUTREAD(PARTEMIT, (char *) sect, (long)cnt * SZ_SECT);
sect += cnt;
offcnt += cnt;
while (cnt--) {
sect--;
#if BYTE_ORDER == 0x0123
if (sizeof(struct outsect) != SZ_SECT)
#endif
{
c -= 4; sect->os_lign = get4(c);
c -= 4; sect->os_flen = get4(c);
c -= 4; sect->os_foff = get4(c);
c -= 4; sect->os_size = get4(c);
c -= 4; sect->os_base = get4(c);
}
offset[--offcnt] = sect->os_foff + rd_base;
}
}
void
rd_outsect(s)
{
OUTSECT(s);
sectionnr = s;
}
/*
* We don't have to worry about byte order here.
*/
void
rd_emit(emit, cnt)
char *emit;
long cnt;
{
OUTREAD(PARTEMIT, emit, cnt);
offset[sectionnr] += cnt;
}
void
rd_relo(relo, cnt)
register struct outrelo *relo;
register unsigned int cnt;
{
OUTREAD(PARTRELO, (char *) relo, (long) cnt * SZ_RELO);
#if BYTE_ORDER == 0x0123
if (sizeof(struct outrelo) != SZ_RELO)
#endif
{
register char *c = (char *) relo + (long) cnt * SZ_RELO;
relo += cnt;
while (cnt--) {
relo--;
c -= 4; relo->or_addr = get4(c);
c -= 2; relo->or_nami = uget2(c);
relo->or_sect = *--c;
relo->or_type = *--c;
}
}
}
void
rd_name(name, cnt)
register struct outname *name;
register unsigned int cnt;
{
OUTREAD(PARTNAME, (char *) name, (long) cnt * SZ_NAME);
#if BYTE_ORDER == 0x0123
if (sizeof(struct outname) != SZ_NAME)
#endif
{
register char *c = (char *) name + (long) cnt * SZ_NAME;
name += cnt;
while (cnt--) {
name--;
c -= 4; name->on_valu = get4(c);
c -= 2; name->on_desc = uget2(c);
c -= 2; name->on_type = uget2(c);
c -= 4; name->on_foff = get4(c);
}
}
}
void
rd_string(addr, len)
char *addr;
long len;
{
OUTREAD(PARTCHAR, addr, len);
}
#ifdef SYMDBUG
void
rd_dbug(buf, size)
char *buf;
long size;
{
OUTREAD(PARTDBUG, buf, size);
}
#endif

View file

@ -1,33 +0,0 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#include "obj.h"
int
rd_arhdr(fd, arhdr)
register struct ar_hdr *arhdr;
{
char buf[AR_TOTAL];
register char *c = buf;
register char *p = arhdr->ar_name;
register int i;
i = read(fd, c, AR_TOTAL);
if (i == 0) return 0;
if (i != AR_TOTAL) {
rd_fatal();
}
i = 14;
while (i--) {
*p++ = *c++;
}
arhdr->ar_date = ((long) get2(c)) << 16; c += 2;
arhdr->ar_date |= ((long) get2(c)) & 0xffff; c += 2;
arhdr->ar_uid = *c++;
arhdr->ar_gid = *c++;
arhdr->ar_mode = get2(c); c += 2;
arhdr->ar_size = (long) get2(c) << 16; c += 2;
arhdr->ar_size |= (long) get2(c) & 0xffff;
return 1;
}

View file

@ -1,34 +0,0 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#include "obj.h"
#define MININT (1 << (sizeof(int) * 8 - 1))
#define MAXCHUNK (~MININT) /* Highest count we read(2). */
/* Unfortunately, MAXCHUNK is too large with some compilers. Put it in
an int!
*/
static int maxchunk = MAXCHUNK;
/*
* We don't have to worry about byte order here.
* Just read "cnt" bytes from file-descriptor "fd".
*/
void
rd_bytes(fd, string, cnt)
register char *string;
register long cnt;
{
while (cnt) {
register int n = cnt >= maxchunk ? maxchunk : cnt;
if (read(fd, string, n) != n)
rd_fatal();
string += n;
cnt -= n;
}
}

View file

@ -1,14 +0,0 @@
/*
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#include "obj.h"
unsigned int
rd_unsigned2(fd)
{
char buf[2];
rd_bytes(fd, buf, 2L);
return uget2(buf);
}

0
commands/grep/grep.1 Executable file → Normal file
View file

0
commands/grep/grep.c Executable file → Normal file
View file

View file

@ -9,9 +9,6 @@
#include <machine/bios.h>
#include <minix/portio.h>
#include <minix/cpufeature.h>
#if !defined(__ELF__)
#include <a.out.h>
#endif
#include <assert.h>
#include <signal.h>
#include <machine/vm.h>
@ -184,19 +181,6 @@ PUBLIC __dead void arch_shutdown(int how)
NOT_REACHABLE;
}
#if !defined(__ELF__)
/* address of a.out headers, set in mpx386.s */
phys_bytes aout;
PUBLIC void arch_get_aout_headers(const int i, struct exec *h)
{
/* The bootstrap loader created an array of the a.out headers at
* absolute address 'aout'. Get one element to h.
*/
phys_copy(aout + i * A_MINHDR, vir2phys(h), (phys_bytes) A_MINHDR);
}
#endif
PUBLIC void fpu_init(void)
{
unsigned short cw, sw;

View file

@ -1,5 +1,4 @@
/*
* This file is part of the lowest layer of the MINIX kernel. (The other part
/* This file is part of the lowest layer of the MINIX kernel. (The other part
* is "proc.c".) The lowest layer does process switching and message handling.
* Furthermore it contains the assembler startup code for Minix and the 32-bit
* interrupt handlers. It cooperates with the code in "start.c" to set up a
@ -83,22 +82,7 @@ IMPORT(multiboot_init)
MINIX:
/* this is the entry point for the MINIX kernel */
#if defined(__ELF__)
jmp _C_LABEL(multiboot_init)
#endif
jmp over_flags /* skip over the next few bytes */
.short CLICK_SHIFT /* for the monitor: memory granularity */
flags:
/* boot monitor flags:
* call in 386 mode, make bss, make stack,
* load high, don't patch, will return,
* uses generic INT, memory vector,
* new boot code return
*/
.short 0x03FD
nop /* extra byte to sync up disassembler */
/* Multiboot header here*/
@ -125,11 +109,6 @@ multiboot_height:
multiboot_depth:
.long 0
over_flags:
/* Set up a C stack frame on the monitor stack. (The monitor sets cs and ds */
/* right. The ss descriptor still references the monitor data segment.) */
movzwl %sp, %esp /* monitor stack is a 16 bit stack */
.globl kernel_init
kernel_init: /* after pre-init*/
push %ebp
@ -165,9 +144,6 @@ copygdt:
mov 8(%ebp), %ebx /* boot parameters offset */
mov 12(%ebp), %edx /* boot parameters length */
mov 16(%ebp), %eax /* address of a.out headers */
#if !defined(__ELF__)
movl %eax, _C_LABEL(aout)
#endif
mov %ds, %ax /* kernel data */
mov %ax, %es
mov %ax, %fs

View file

@ -117,12 +117,6 @@ PUBLIC int main(void)
register struct proc *rp; /* process pointer */
register int i, j;
size_t argsz; /* size of arguments passed to crtso on stack */
#if !defined(__ELF__)
vir_clicks text_clicks, data_clicks, st_clicks;
phys_clicks text_base;
int hdrindex; /* index to array of a.out headers */
struct exec e_hdr; /* for a copy of an a.out header */
#endif
BKL_LOCK();
/* Global value to test segment sanity. */
@ -209,7 +203,6 @@ PUBLIC int main(void)
/* Don't let the process run for now. */
RTS_SET(rp, RTS_NO_PRIV | RTS_NO_QUANTUM);
}
#if defined(__ELF__)
rp->p_memmap[T].mem_vir = ABS2CLICK(ip->memmap.text_vaddr);
rp->p_memmap[T].mem_phys = ABS2CLICK(ip->memmap.text_paddr);
rp->p_memmap[T].mem_len = ABS2CLICK(ip->memmap.text_bytes);
@ -223,38 +216,6 @@ PUBLIC int main(void)
ip->memmap.data_bytes +
ip->memmap.stack_bytes);
rp->p_memmap[S].mem_len = 0;
#else
if (iskerneln(proc_nr)) { /* part of the kernel? */
hdrindex = 0; /* all use the first a.out header */
} else {
hdrindex = 1 + i-NR_TASKS; /* system/user processes */
}
/* Architecture-specific way to find out aout header of this
* boot process.
*/
arch_get_aout_headers(hdrindex, &e_hdr);
/* Convert addresses to clicks and build process memory map */
text_base = e_hdr.a_syms >> CLICK_SHIFT;
text_clicks = (vir_clicks) (CLICK_CEIL(e_hdr.a_text) >> CLICK_SHIFT);
data_clicks = (vir_clicks) (CLICK_CEIL(e_hdr.a_data
+ e_hdr.a_bss) >> CLICK_SHIFT);
st_clicks = (vir_clicks) (CLICK_CEIL(e_hdr.a_total) >> CLICK_SHIFT);
if (!(e_hdr.a_flags & A_SEP))
{
data_clicks = (vir_clicks) (CLICK_CEIL(e_hdr.a_text +
e_hdr.a_data + e_hdr.a_bss) >> CLICK_SHIFT);
text_clicks = 0; /* common I&D */
}
rp->p_memmap[T].mem_phys = text_base;
rp->p_memmap[T].mem_len = text_clicks;
rp->p_memmap[D].mem_phys = text_base + text_clicks;
rp->p_memmap[D].mem_len = data_clicks;
rp->p_memmap[S].mem_phys = text_base + text_clicks + st_clicks;
rp->p_memmap[S].mem_vir = st_clicks;
rp->p_memmap[S].mem_len = 0;
#endif
/* Set initial register values. The processor status word for tasks
* is different from that of other processes because tasks can

View file

@ -196,9 +196,6 @@ _PROTOTYPE( int is_fpu, (void) );
_PROTOTYPE( void ser_putc, (char) );
_PROTOTYPE( __dead void arch_shutdown, (int) );
_PROTOTYPE( __dead void arch_monitor, (void) );
#if !defined(__ELF__)
_PROTOTYPE( void arch_get_aout_headers, (int i, struct exec *h) );
#endif
_PROTOTYPE( void restore_user_context, (struct proc * p) );
_PROTOTYPE( void read_tsc, (u32_t *high, u32_t *low) );
_PROTOTYPE( int arch_init_profile_clock, (u32_t freq) );

View file

@ -48,9 +48,6 @@ PUBLIC int do_getinfo(struct proc * caller, message * m_ptr)
int nr_e, nr, r;
int wipe_rnd_bin = -1;
struct proc *p;
#if !defined(__ELF__)
struct exec e_hdr;
#endif
/* Set source address and length based on request type. */
switch (m_ptr->I_REQUEST) {
@ -189,23 +186,6 @@ PUBLIC int do_getinfo(struct proc * caller, message * m_ptr)
src_vir = (vir_bytes) &idl->p_cycles;
break;
}
#if !defined(__ELF__)
case GET_AOUTHEADER: {
int hdrindex, index = m_ptr->I_VAL_LEN2_E;
if(index < 0 || index >= NR_BOOT_PROCS) {
return EINVAL;
}
if (iskerneln(_ENDPOINT_P(image[index].endpoint))) {
hdrindex = 0;
} else {
hdrindex = 1 + index-NR_TASKS;
}
arch_get_aout_headers(hdrindex, &e_hdr);
length = sizeof(e_hdr);
src_vir = (vir_bytes) &e_hdr;
break;
}
#endif
default:
printf("do_getinfo: invalid request %d\n", m_ptr->I_REQUEST);
return(EINVAL);

View file

@ -1,14 +0,0 @@
ack_build.sh - for ACK library building
gnu_build.sh - for GNU library building
ack_build.sh obj - create objdirs for gnu libraries
ack_build.sh depend - find dependencies of ack libraries
ack_build.sh all - compile ack libraries
ack_build.sh install - compile and install ack libraries
ack_build.sh clean - clean for ack libraries
gnu_build.sh obj - create objdirs for gnu libraries
gnu_build.sh depend - find dependencies of gnu libraries
gnu_build.sh all - compile gnu libraries
gnu_build.sh install - compile and install gnu libraries
gnu_build.sh clean - clean for gnu libraries

View file

@ -1,9 +1,5 @@
.include <bsd.own.mk>
.if ${OBJECT_FMT} == "a.out"
SUBDIR=${ARCH}-aout
.elif ${OBJECT_FMT} == "ELF"
SUBDIR=${ARCH}-elf
.endif
.include <bsd.subdir.mk>

View file

@ -1,12 +0,0 @@
.include <bsd.own.mk>
SRCS= crtso.S
OBJS= crtso.o
realall: ${OBJS}
FILES=${OBJS}
FILESDIR=${LIBDIR}
CLEANFILES=${OBJS}
.include <bsd.prog.mk>

View file

@ -1,129 +0,0 @@
/* This is the C run-time start-off routine. It's job is to take the */
/* arguments as put on the stack by EXEC, and to parse them and set them up the */
/* way _main expects them. */
/* It also initializes environ when this variable isn't defined by the */
/* programmer. The detection of whether environ belong to us is rather */
/* simplistic. We simply check for some magic value, but there is no other */
/* way. */
#include <machine/vm.h>
.globl begtext, begdata, begbss
.text
begtext:
#ifdef __ACK__
.rom
#else
.data
#endif
begrom:
.data
begdata:
.bss
begbss:
#ifdef __ACK__
.globl __minix_datastart
#endif
.globl crtso, __penviron, __penvp, ___prognamep, ___argc
.globl __minix_mainjump, __minix_unmapzero
.extern _main, _exit
#if defined(__ELF__)
.section .init
#else
.text
#endif
#if defined(__ELF__)
.globl __start
__start:
#endif
crtso:
xorl %ebp, %ebp /* clear for backtrace of core files */
movl (%esp), %eax /* argc */
leal 4(%esp), %edx /* argv */
leal 8(%esp,%eax,4), %ecx /* envp */
/* Test if environ is in the initialized data area and is set to our */
/* magic number. If so then it is not redefined by the user. */
movl $_environ, %ebx
cmpl $__edata, %ebx /* within initialized data? */
jae 0f
testb $3, %bl /* aligned? */
jne 0f
cmpl $0x53535353, (%ebx) /* is it our environ? */
jne 0f
movl %ebx, __penviron /* _penviron = &environ; */
0:
movl __penviron, %ebx
movl %ecx, (%ebx) /* *_penviron = envp; */
/* Save argv[] and argc. This is so that we can return
* argv[0] in the future, without having to check whether
* argv can be dereferenced safely now.
*/
mov %edx, (___prognamep)
mov %eax, (___argc)
push %ecx /* push envp */
push %edx /* push argv */
push %eax /* push argc */
jmp __minix_mainjump
.balign I386_PAGE_SIZE
__minix_mainjump:
/* unmap zero pages */
call __minix_unmapzero
call _main /* main(argc, argv, envp) */
push %eax /* push exit status */
call _exit
hlt /* force a trap if exit fails */
__minix_unmapzero:
/* unmap 0-page code */
push $I386_PAGE_SIZE
push $crtso
call _minix_munmap_text /* unmap_text(crtso, I386_PAGE_SIZE) */
add $8, %esp
#ifdef __ACK__
/*
* ack uses separate segments for text and data by default. We have a
* common segment when compiling using any other compiler
*/
/* unmap 0-page data */
push $I386_PAGE_SIZE
push $romstart
call _minix_munmap /* munmap(romstart, I386_PAGE_SIZE) */
add $8, %esp
#endif
ret
#ifdef __ACK__
.rom
romstart:
.space I386_PAGE_SIZE
__minix_datastart:
.space 4
#endif
.data
__penviron:
.long __penvp /* Pointer to environ, or hidden pointer */
.bss
___prognamep:
.space 4
___argc:
.space 4
.lcomm __penvp, 4 /* Hidden environment vector */
.extern endtext /* Force loading of end labels. */

View file

@ -1,35 +0,0 @@
.TH M 1
.SH NAME
M, U \- conveniently mount and unmount
.SH SYNOPSIS
\fBM \fIdevice\fR [\fB\-r\fR]\fR
.br
\fBU \fIdevice\fR\fR
.br
.de FL
.TP
\\fB\\$1\\fR
\\$2
..
.de EX
.TP 20
\\fB\\$1\\fR
# \\$2
..
.SH OPTIONS
.FL "\-r" "Mount read-only"
.SH EXAMPLES
.EX "M root" "Mount the RAM image on /root"
.EX "M 0" "Mount /dev/fd0 on /fd0"
.EX "U fd1" "Unmount /dev/fd1 from /fd1"
.SH DESCRIPTION
.PP
\fIM\fR and \fIU\fR allow easy mounting and unmounting of a device by using
only an abbreviated device name or keyword. Special keywords are
\fBroot\fR, \fBtmp\fR, and \fBusr\fR for the three hard disk partitions
MINIX 3 runs in. Floppy devices are mounted on \fB/fd0\fR or \fB/fd1\fR. You
can use \fB0\fR and \fB1\fR instead of \fBfd0\fR and \fBfd1\fP. A device it
doesn't know about is mounted on \fB/mnt\fR.
.SH "SEE ALSO"
.BR mount (1),
.BR umount (1).

View file

@ -1,7 +1,7 @@
MAN= acd.1 anm.1 ar.1 ash.1 asize.1 at.1 banner.1 basename.1 \
MAN= ash.1 at.1 banner.1 basename.1 \
bsfilt.1 cal.1 \
calendar.1 cat.1 cawf.1 chgrp.1 \
chmem.1 chmod.1 cksum.1 clear.1 cmp.1 comm.1 compress.1 \
chmod.1 cksum.1 clear.1 cmp.1 comm.1 compress.1 \
cp.1 crc.1 crontab.1 ctags.1 dd.1 dev2name.1 \
df.1 dhrystone.1 dosdir.1 dosread.1 doswrite.1 du.1 \
dumpcore.1 echo.1 ed.1 eject.1 elvis.1 elvrec.1 \
@ -10,14 +10,14 @@ MAN= acd.1 anm.1 ar.1 ash.1 asize.1 at.1 banner.1 basename.1 \
fsck.mfs.1 head.1 host.1 hostaddr.1 ifdef.1 \
install.1 isodir.1 isoinfo.1 isoread.1 join.1 kill.1 \
last.1 leave.1 loadfont.1 loadkeys.1 logger.1 login.1 \
look.1 lp.1 ls.1 lspci.1 M.1 mail.1 \
mesg.1 mixer.1 ackmkdep.1 mkfs.1 \
look.1 lp.1 ls.1 lspci.1 mail.1 \
mesg.1 mixer.1 mkfs.1 \
mkproto.1 modem.1 mount.1 mt.1 nice.1 nm.1 nohup.1 od.1 \
paste.1 ping.1 playwave.1 postmort.1 pr.1 prep.1 \
paste.1 ping.1 playwave.1 pr.1 prep.1 \
profile.1 ps.1 pwd.1 rcp.1 readall.1 recwave.1 \
ref.1 remsync.1 rget.1 rlogin.1 rsh.1 rz.1 \
shar.1 acksize.1 sleep.1 sort.1 spell.1 \
split.1 strip.1 stty.1 su.1 sum.1 svc.1 \
split.1 stty.1 su.1 sum.1 svc.1 \
synctree.1 sysenv.1 sz.1 tail.1 tee.1 telnet.1 template.1 \
term.1 termcap.1 tget.1 time.1 tr.1 true.1 \
truncate.1 tsort.1 tty.1 umount.1 uname.1 unexpand.1 \
@ -25,7 +25,6 @@ MAN= acd.1 anm.1 ar.1 ash.1 asize.1 at.1 banner.1 basename.1 \
who.1 write.1 xargs.1 yap.1 yes.1 linkfarm.1 pkg_view.1
MLINKS += ash.1 sh.1
MLINKS += ash.1 bigsh.1
MLINKS += ash.1 ..1
MLINKS += ash.1 break.1
MLINKS += ash.1 case.1

View file

@ -1,860 +0,0 @@
.TH ACD 1
.SH NAME
acd \- a compiler driver
.SH SYNOPSIS
.B acd
\fB\-v\fR[\fIn\fR]
\fB\-vn\fR[\fIn\fR]
.BI \-name " name"
.BI \-descr " descr"
.BI \-T " dir"
.RI [ arg " ...]"
.SH DESCRIPTION
.de SP
.if t .sp 0.4
.if n .sp
..
.B Acd
is a compiler driver, a program that calls the several passes that are needed
to compile a source file. It keeps track of all the temporary files used
between the passes. It also defines the interface of the compiler, the
options the user gets to see.
.PP
This text only describes
.B acd
itself, it says nothing about the different options the C-compiler accepts.
(It has nothing to do with any language, other than being a tool to give
a compiler a user interface.)
.SH OPTIONS
.B Acd
itself takes five options:
.TP
\fB\-v\fR[\fIn\fR]
Sets the diagnostic level to
.I n
(by default
.BR 2 ).
The higher
.I n
is, the more output
.B acd
generates:
.B \-v0
does not produce any output.
.B \-v1
prints the basenames of the programs called.
.B \-v2
prints names and arguments of the programs called.
.B \-v3
shows the commands executed from the description file too.
.B \-v4
shows the program read from the description file too. Levels 3 and 4 use
backspace overstrikes that look good when viewing the output with a smart
pager.
.TP
\fB\-vn\fR[\fIn\fR]
Like
.B \-v
except that no command is executed. The driver is just play-acting.
.TP
.BI \-name " name"
.B Acd
is normally linked to the name the compiler is to be called with by the
user. The basename of this, say
.BR cc ,
is the call name of the driver. It plays a role in selecting the proper
description file. With the
.B \-name
option one can change this.
.B Acd \-name cc
has the same effect as calling the program as
.BR cc .
.TP
.BI \-descr " descr"
Allows one to choose the pass description file of the driver. By default
.I descr
is the same as
.IR name ,
the call name of the program. If
.I descr
doesn't start with
.BR / ,
.BR ./ ,
or
.BR ../
then the file
.BI /usr/lib/ descr /descr
will be used for the description, otherwise
.I descr
itself. Thus
.B cc \-descr newcc
calls the C-compiler with a different description file without changing the
call name. Finally, if
.I descr
is \fB"\-"\fP, standard input is read. (The default lib directory
.BR /usr/lib ,
may be changed to
.I dir
at compile time by \fB\-DLIB=\e"\fP\fIdir\fP\fB\e"\fP. The default
.I descr
may be set with \fB\-DDESCR=\e"\fP\fIdescr\fP\fB\e"\fP for simple
installations on a system without symlinks.)
.TP
.BI \-T " dir"
Temporary files are made in
.B /tmp
by default, which may be overridden by the environment variable
.BR TMPDIR ,
which may be overridden by the
.B \-T
option.
.SH "THE DESCRIPTION FILE"
The description file is a program interpreted by the driver. It has variables,
lists of files, argument parsing commands, and rules for transforming input
files.
.SS Syntax
There are four simple objects:
.PP
.RS
Words, Substitutions, Letters, and Operators.
.RE
.PP
And there are two ways to group objects:
.PP
.RS
Lists, forming sequences of anything but letters,
.SP
Strings, forming sequences of anything but Words and Operators.
.RE
.PP
Each object has the following syntax:
.IP Words
They are sequences of characters, like
.BR cc ,
.BR \-I/usr/include ,
.BR /lib/cpp .
No whitespace and no special characters. The backslash character
.RB ( \e )
may be used to make special characters common, except whitespace. A backslash
followed by whitespace is completely removed from the input. The sequence
.B \en
is changed to a newline.
.IP Substitutions
A substitution (henceforth called 'subst') is formed with a
.BR $ ,
e.g.
.BR $opt ,
.BR $PATH ,
.BR ${lib} ,
.BR $\(** .
The variable name after the
.B $
is made of letters, digits and underscores, or any sequence of characters
between parentheses or braces, or a single other character. A subst indicates
that the value of the named variable must be substituted in the list or string
when fully evaluated.
.IP Letters
Letters are the single characters that would make up a word.
.IP Operators
The characters
.BR = ,
.BR + ,
.BR \- ,
.BR \(** ,
.BR < ,
and
.B >
are the operators. The first four must be surrounded by whitespace if they
are to be seen as special (they are often used in arguments). The last two
are always special.
.IP Lists
One line of objects in the description file forms a list. Put parentheses
around it and you have a sublist. The values of variables are lists.
.IP Strings
Anything that is not yet a word is a string. All it needs is that the substs
in it are evaluated, e.g.
.BR $LIBPATH/lib$key.a .
A single subst doesn't make a string, it expands to a list. You need at
least one letter or other subst next to it. Strings (and words) may also
be formed by enclosing them in double quotes. Only
.B \e
and
.B $
keep their special meaning within quotes.
.SS Evaluation
One thing has to be carefully understood: Substitutions are delayed until
the last possible moment, and description files make heavy use of this.
Only if a subst is tainted, either because its variable is declared local, or
because a subst in its variable's value is tainted, is it immediately
substituted. So if a list is assigned to a variable then this list is only
checked for tainted substs. Those substs are replaced by the value
of their variable. This is called partial evaluation.
.PP
Full evaluation expands all substs, the list is flattened, i.e. all
parentheses are removed from sublists.
.PP
Implosive evaluation is the last that has to be done to a list before it
can be used as a command to execute. The substs within a string have been
evaluated to lists after full expansion, but a string must be turned into
a single word, not a list. To make this happen, a string is first exploded
to all possible combinations of words choosing one member of the lists within
the string. These words are tried one by one to see if they exist as a
file. The first one that exists is taken, if none exists than the first
choice is used. As an example, assume
.B LIBPATH
equals
.BR "(/lib /usr/lib)" ,
.B key
is
.B (c)
and
.B key
happens to be local. Then we have:
.PP
.RS
\fB"$LIBPATH/lib$key.a"\fP
.RE
.PP
before evaluation,
.PP
.RS
\fB"$LIBPATH/lib(c).a"\fP
.RE
.PP
after partial evaluation,
.PP
.RS
\fB"(/lib/libc.a /usr/lib/libc.a)"\fP
.RE
.PP
after full evaluation, and finally
.PP
.RS
.B /usr/lib/libc.a
.RE
.PP
after implosion, if the file exists.
.SS Operators
The operators modify the way evaluation is done and perform a special
function on a list:
.TP
.B \(**
Forces full evaluation on all the list elements following it. Use it to
force substitution of the current value of a variable. This is the only
operator that forces immediate evaluation.
.TP
.B +
When a
.B +
exists in a list that is fully evaluated, then all the elements before the
.B +
are imploded and all elements after the
.B +
are imploded and added to the list if they are not already in the list. So
this operator can be used either for set addition, or to force implosive
expansion within a sublist.
.TP
.B \-
Like
.BR + ,
except that elements after the
.B \-
are removed from the list.
.PP
The set operators can be used to gather options that exclude each other
or for their side effect of implosive expansion. You may want to write:
.PP
.RS
\fBcpp \-I$LIBPATH/include\fP
.RE
.PP
to call cpp with an extra include directory, but
.B $LIBPATH
is expanded using a filename starting with
.B \-I
so this won't work. Given that any problem in Computer Science can be solved
with an extra level of indirection, use this instead:
.PP
.RS
.ft B
cpp \-I$INCLUDE
.br
INCLUDE = $LIBPATH/include +
.ft P
.RE
.SS "Special Variables"
There are three special variables used in a description file:
.BR $\(** ,
.BR $< ,
and
.BR $> .
These variables are always local and mostly read-only. They will be
explained later.
.SS "A Program"
The lists in a description file form a program that is executed from the
first to the last list. The first word in a list may be recognized as a
builtin command (only if the first list element is indeed simply a word.)
If it is not a builtin command then the list is imploded and used as a
\s-2UNIX\s+2 command with arguments.
.PP
Indentation (by tabs or spaces) is not just makeup for a program, but are
used to group lines together. Some builtin commands need a body. These
bodies are simply lines at a deeper indentation.
.PP
Empty lines are not ignored either, they have the same indentation level as
the line before it. Comments (starting with a
.B #
and ending at end of line) have an indentation of their own and can be used
as null commands.
.PP
.B Acd
will complain about unexpected indentation shifts and empty bodies. Commands
can share the same body by placing them at the same indentation level before
the indented body. They are then "guards" to the same body, and are tried
one by one until one succeeds, after which the body is executed.
.PP
Semicolons may be used to separate commands instead of newlines. The commands
are then all at the indentation level of the first.
.SS "Execution phases"
The driver runs in three phases: Initialization, Argument scanning, and
Compilation. Not all commands work in all phases. This is further explained
below.
.SS "The Commands"
The commands accept arguments that are usually generic expressions that
implode to a word or a list of words. When
.I var
is specified, then a single word or subst needs to be given, so
an assignment can be either
.I name
.B =
.IR value ,
or
.BI $ name
.B =
.IR value .
.TP
.IB "var " = " expr ..."
The partially evaluated list of expressions is assigned to
.IR var .
During the evaluation is
.I var
marked as local, and after the assignment set from undefined to defined.
.TP
.BI unset " var"
.I Var
is set to null and is marked as undefined.
.TP
.BI import " var"
If
.I var
is defined in the environment of
.B acd
then it is assigned to
.IR var .
The environment variable is split into words at whitespace and colons. Empty
space between two colons
.RB ( :: )
is changed to a dot.
.TP
.BI mktemp " var " [ suffix ]
Assigns to
.I var
the name of a new temporary file, usually something like /tmp/acd12345x. If
.I suffix
is present then it will be added to the temporary file's name. (Use it
because some programs require it, or just because it looks good.)
.B Acd
remembers this file, and will delete it as soon as you stop referencing it.
.TP
.BI temporary " word"
Mark the file named by
.I word
as a temporary file. You have to make sure that the name is stored in some
list in imploded form, and not just temporarily created when
.I word
is evaluated, because then it will be immediately removed and forgotten.
.TP
.BI stop " suffix"
Sets the target suffix for the compilation phase. Something like
.B stop .o
means that the source files must be compiled to object files. At least one
.B stop
command must be executed before the compilation phase begins. It may not be
changed during the compilation phase. (Note: There is no restriction on
.IR suffix ,
it need not start with a dot.)
.TP
.BI treat " file suffix"
Marks the file as having the given suffix for the compile phase. Useful
for sending a
.B \-l
option directly to the loader by treating it as having the
.B .a
suffix.
.TP
.BI numeric " arg"
Checks if
.I arg
is a number. If not then
.B acd
will exit with a nice error message.
.TP
.BI error " expr ..."
Makes the driver print the error message
.I "expr ..."
and exit.
.TP
.BI if " expr " = " expr"
.B If
tests if the two expressions are equal using set comparison, i.e. each
expression should contain all the words in the other expression. If the
test succeeds then the if-body is executed.
.TP
.BI ifdef " var"
Executes the ifdef-body if
.I var
is defined.
.TP
.BI ifndef " var"
Executes the ifndef-body if
.I var
is undefined.
.TP
.BI iftemp " arg"
Executes the iftemp-body if
.I arg
is a temporary file. Use it when a command has the same file as input and
output and you don't want to clobber the source file:
.SP
.RS
.nf
.ft B
transform .o .o
iftemp $\(**
$> = $\(**
else
cp $\(** $>
optimize $>
.ft P
.fi
.RE
.TP
.BI ifhash " arg"
Executes the ifhash-body if
.I arg
is an existing file with a '\fB#\fP' as the very first character. This
usually indicates that the file must be pre-processed:
.SP
.RS
.nf
.ft B
transform .s .o
ifhash $\(**
mktemp ASM .s
$CPP $\(** > $ASM
else
ASM = $\(**
$AS \-o $> $ASM
unset ASM
.ft P
.fi
.RE
.TP
.B else
Executes the else-body if the last executed
.BR if ,
.BR ifdef ,
.BR ifndef ,
.BR iftemp ,
or
.B ifhash
was unsuccessful. Note that
.B else
need not immediately follow an if, but you are advised not to make use of
this. It is a "feature" that may not last.
.TP
.BI apply " suffix1 suffix2"
Executed inside a transform rule body to transform the input file according
to another transform rule that has the given input and output suffixes. The
file under
.B $\(**
will be replaced by the new file. So if there is a
.B .c .i
preprocessor rule then the example of
.B ifhash
can be replaced by:
.SP
.RS
.nf
.ft B
transform .s .o
ifhash $\(**
apply .c .i
$AS \-o $> $*
.ft P
.fi
.RE
.TP
.BI include " descr"
Reads another description file and replaces the
.B include
with it. Execution continues with the first list in the new program. The
search for
.I descr
is the same as used for the
.B \-descr
option. Use
.B include
to switch in different front ends or back ends, or to call a shared
description file with a different initialization. Note that
.I descr
is only evaluated the first time the
.B include
is called. After that the
.B include
has been replaced with the included program, so changing its argument won't
get you a different file.
.TP
.BI arg " string ..."
.B Arg
may be executed in the initialization and scanning phase to post an argument
scanning rule, that's all the command itself does. Like an
.B if
that fails it allows more guards to share the same body.
.TP
.BI transform " suffix1 suffix2"
.BR Transform ,
like
.BR arg ,
only posts a rule to transform a file with the suffix
.I suffix1
into a file with the suffix
.IR suffix2 .
.TP
.BI prefer " suffix1 suffix2"
Tells that the transformation rule from
.I suffix1
to
.I suffix2
is to be preferred when looking for a transformation path to the stop suffix.
Normally the shortest route to the stop suffix is used.
.B Prefer
is ignored on a
.BR combine ,
because the special nature of combines does not allow ambiguity.
.SP
The two suffixes on a
.B transform
or
.B prefer
may be the same, giving a rule that is only executed when preferred.
.TP
.BI combine " suffix-list suffix"
.B Combine
is like
.B transform
except that it allows a list of input suffixes to match several types of
input files that must be combined into one.
.TP
.B scan
The scanning phase may be run early from the initialization phase with the
.B scan
command. Use it if you need to make choices based on the arguments before
posting the transformation rules. After running this,
.B scan
and
.B arg
become no-ops.
.TP
.B compile
Move on to the compilation phase early, so that you have a chance to run
a few extra commands before exiting. This command implies a
.BR scan .
.PP
Any other command is seen as a \s-2UNIX\s+2 command. This is where the
.B <
and
.B >
operators come into play. They redirect standard input and standard output
to the file mentioned after them, just like the shell.
.B Acd
will stop with an error if the command is not successful.
.SS The Initialization Phase
The driver starts by executing the program once from top to bottom to
initialize variables and post argument scanning and transformation rules.
.SS The Scanning Phase
In this phase the driver makes a pass over the command line arguments to
process options. Each
.B arg
rule is tried one by one in the order they were posted against the front of
the argument list. If a match is made then the matched arguments are removed
from the argument list and the arg-body is executed. If no match can be made
then the first argument is moved to the list of files waiting to be
transformed and the scan is restarted.
.PP
The match is done as follows: Each of the strings after
.B arg
must match one argument at the front of the argument list. A character
in a string must match a character in an argument word, a subst in a string
may match 1 to all remaining characters in the argument, preferring the
shortest possible match. The hyphen in a argument starting with a hyphen
cannot be matched by a subst. Therefore:
.PP
.RS
.B arg \-i
.RE
.PP
matches only the argument
.BR \-i .
.PP
.RS
.B arg \-O$n
.RE
.PP
matches any argument that starts with
.B \-O
and is at least three characters long. Lastly,
.PP
.RS
.B arg \-o $out
.RE
.PP
matches
.B \-o
and the argument following it, unless that argument starts with a hyphen.
.PP
The variable
.B $\(**
is set to all the matched arguments before the arg-body is executed. All
the substs in the arg strings are set to the characters they match. The
variable
.B $>
is set to null. All the values of the variables are saved and the variables
marked local. All variables except
.B $>
are marked read-only. After the arg-body is executed is the value of
.B $>
concatenated to the file list. This allows one to stuff new files into the
transformation phase. These added names are not evaluated until the start
of the next phase.
.SS The Compilation Phase
The files gathered in the file list in the scanning phase are now transformed
one by one using the transformation rules. The shortest, or preferred route
is computed for each file all the way to the stop suffix. Each file is
transformed until it lands at the stop suffix, or at a combine rule. After
a while all files are either fully transformed or at a combine rule.
.PP
The driver chooses a combine rule that is not on a path from another combine
rule and executes it. The file that results is then transformed until it
again lands at a combine rule or the stop suffix. This continues until all
files are at the stop suffix and the program exits.
.PP
The paths through transform rules may be ambiguous and have cycles, they will
be resolved. But paths through combines must be unambiguous, because of
the many paths from the different files that meet there. A description file
will usually have only one combine rule for the loader. However if you do
have a combine conflict then put a no-op transform rule in front of one to
resolve the problem.
.PP
If a file matches a long and a short suffix then the long suffix is preferred.
By putting a null input suffix (\fB""\fP) in a rule one can match any file
that no other rule matches. You can send unknown files to the loader this
way.
.PP
The variable
.B $\(**
is set to the file to be transformed or the files to be combined before the
transform or combine-body is executed.
.B $>
is set to the output file name, it may again be modified.
.B $<
is set to the original name of the first file of
.B $\(**
with the leading directories and the suffix removed.
.B $\(**
will be made up of temporary files after the first rule.
.B $>
will be another temporary file or the name of the target file
.RB ( $<
plus the stop suffix), if the stop suffix is reached.
.PP
.B $>
is passed to the next rule; it is imploded and checked to be a single word.
This driver does not store intermediate object files in the current directory
like most other compilers, but keeps them in
.B /tmp
too. (Who knows if the current directory can have files created in?) As an
example, here is how you can express the "normal" method:
.PP
.RS
.nf
.ft B
transform .s .o
if $> = $<.o
# Stop suffix is .o
else
$> = $<.o
temporary $>
$AS \-o $> $\(**
.ft P
.fi
.RE
.PP
Note that
.B temporary
is not called if the target is already the object file, or you would lose
the intended result!
.B $>
is known to be a word, because
.B $<
is local. (Any string whose substs are all expanded changes to a word.)
.SS "Predefined Variables"
The driver has three variables predefined:
.BR PROGRAM ,
set to the call name of the driver,
.BR VERSION ,
the driver's version number, and
.BR ARCH ,
set to the name of the default output architecture. The latter is optional,
and only defined if
.B acd
was compiled with \fB\-DARCH=\e"\fP\fIarch-name\fP\fB\e"\fP.
.SH EXAMPLE
As an example a description file for a C compiler is given. It has a
front end (ccom), an intermediate code optimizer (opt), a code generator (cg),
an assembler (as), and a loader (ld). The compiler can pre-process, but
there is also a separate cpp. If the
.B \-D
and options like it are changed to look like
.B \-o
then this example is even as required by \s-2POSIX\s+2.
.RS
.nf
# The compiler support search path.
C = /lib /usr/lib /usr/local/lib
# Compiler passes.
CPP = $C/cpp $CPP_F
CCOM = $C/ccom $CPP_F
OPT = $C/opt
CG = $C/cg
AS = $C/as
LD = $C/ld
# Predefined symbols.
CPP_F = \-D__EXAMPLE_CC__
# Library path.
LIBPATH = $USERLIBPATH $C
# Default transformation target.
stop .out
# Preprocessor directives.
arg \-D$name
arg \-U$name
arg \-I$dir
CPP_F = $CPP_F $\(**
# Stop suffix.
arg \-c
stop .o
arg \-E
stop .E
# Optimization.
arg \-O
prefer .m .m
OPT = $OPT -O1
arg \-O$n
numeric $n
prefer .m .m
OPT = $OPT $\(**
# Add debug info to the executable.
arg \-g
CCOM = $CCOM -g
# Add directories to the library path.
arg \-L$dir
USERLIBPATH = $USERLIBPATH $dir
# \-llib must be searched in $LIBPATH later.
arg \-l$lib
$> = $LIBPATH/lib$lib.a
# Change output file.
arg \-o$out
arg \-o $out
OUT = $out
# Complain about a missing argument.
arg \-o
error "argument expected after '$\(**'"
# Any other option (like \-s) are for the loader.
arg \-$any
LD = $LD $\(**
# Preprocess C-source.
transform .c .i
$CPP $\(** > $>
# Preprocess C-source and send it to standard output or $OUT.
transform .c .E
ifndef OUT
$CPP $\(**
else
$CPP $\(** > $OUT
# Compile C-source to intermediate code.
transform .c .m
transform .i .m
$CCOM $\(** $>
# Intermediate code optimizer.
transform .m .m
$OPT $\(** > $>
# Intermediate to assembly.
transform .m .s
$CG $\(** > $>
# Assembler to object code.
transform .s .o
if $> = $<.o
ifdef OUT
$> = $OUT
$AS \-o $> $\(**
# Combine object files and libraries to an executable.
combine (.o .a) .out
ifndef OUT
OUT = a.out
$LD \-o $OUT $C/crtso.o $\(** $C/libc.a
.fi
.RE
.SH FILES
.TP 25n
.RI /usr/lib/ descr /descr
\- compiler driver description file.
.SH "SEE ALSO"
.BR cc (1).
.SH ACKNOWLEDGEMENTS
Even though the end result doesn't look much like it, many ideas were
nevertheless derived from the ACK compiler driver by Ed Keizer.
.SH BUGS
\s-2POSIX\s+2 requires that if compiling one source file to an object file
fails then the compiler should continue with the next source file. There is
no way
.B acd
can do this, it always stops after error. It doesn't even know what an
object file is! (The requirement is stupid anyhow.)
.PP
If you don't think that tabs are 8 spaces wide, then don't mix them with
spaces for indentation.
.SH AUTHOR
Kees J. Bot (kjb@cs.vu.nl)

View file

@ -1,82 +0,0 @@
.TH MKDEP 1 "February 1st, 2010"
.SH NAME
mkdep \- print dependencies in the Right Way for make(1)
.SH SYNOPSIS
.B mkdep
.I path
.br
.B mkdep
.I pp_command
.IR sourcefile " ... "
.SH DESCRIPTION
.B Mkdep
does what
.B cpp -M
should do, but no compiler gets it right, they all
strip the leading path of the \fI*.o\fP files.
.PP
The first synopsis form just creates the needed
.I .depend
files in all the subdirectories of
.IR path .
.PP
The second synopsis form does the hard work of emitting the
dependencies instructions for
.IR sourcefile
in the right format expected by
.IR make (1),
including the path information.
.PP
.B Mkdep
expects
.I pp_command
to be the correct invocation for the preprocessor
.\" FIXME: there are no cpp(1x) manpage presently...
.\" .IR cpp (1x)
command adequate for
.IR sourcefile ,
and also expects this command to emit lines of the form
.nf
.ta +1i +\w'# lineno "filename"'u+2m
# \fIlineno\fP "\fIfilename\fP"
.fi
for each files which is included by the named
.IR sourcefile .
.PP
For C, the typical idiom is to add in all your
.IR Makefile s:
.PP
.nf
.ta +0.2i +\w'depend:'u+1m +\w'mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend'u+2m
depend:
cd sub1 && $(MAKE) -$(MAKEFLAGS) $@
cd sub2 && $(MAKE) -$(MAKEFLAGS) $@
# repeat for each subdirectory
mkdep "$(CC) -E $(CPPFLAGS)" *.c > .depend
.PP
.fi
.SH "SEE ALSO"
.BR cc (1),
.BR make (1).
.SH BUGS
Since
.I Makefile
is read in full before any command is executed,
there is no way to prevent
.IR make (1)
to report an error if the
.I .depend
file was not created beforehand; hence the first form of
.IR mkdep
should be used \fBbefore\fP any attempt is done to use this feature in any
.IR Makefile .
.PP
The current version hardcodes the \fI.o\fP suffix, so it cannot be used for e.g.
.IR flex (1)
or
.IR yacc (1)
source files.
.SH AUTHOR
.I Mkdep.c
was written by Kees J. Bot and Jorrit N. Herder.
.\" This manual page by A. Leca.

View file

@ -1,63 +0,0 @@
.TH ANM 1
.SH NAME
anm \- print name list
.SH SYNOPSIS
\fBanm \fR[\fB\-gnoprus\fR] \fIfile\fR ...\fR
.br
.de FL
.TP
\\fB\\$1\\fR
\\$2
..
.de EX
.TP 20
\\fB\\$1\\fR
# \\$2
..
.SH OPTIONS
.FL "\-g" "Global symbols only"
.FL "\-n" "Sort numerically"
.FL "\-o" "Prepend the filename to each line"
.FL "\-p" "No sorting\(emuse symbol table order"
.FL "\-r" "Sort in reverse order"
.FL "\-u" "List undefined symbols only"
.FL "\-s" "Sort in section order"
.SH EXAMPLES
.EX "anm \-gn test.o" "Print global symbols in numerical order"
.SH DESCRIPTION
.PP
.I Anm
prints the name list (symbol table) of each ACK format object
.I file
in the argument list.
If no file name is given, \fIa.out\fR is used.
Each symbol name is preceded by its value, a section indicator
and a type indicator.
The section indicators are:
.PP
.ta 0.25i 0.50i
.nf
\fBU\fR Undefined symbol
\fBA\fR Absolute symbol
\fB\-\fR Other symbol
.sp
The type indicators are:
.PP
\fBF\fR Filename
\fBM\fR Module name
\fBS\fR Section name
\fBE\fR External (global) symbol
\fB\-\fR Local symbol
.fi
.PP
The output is sorted alphabetically, unless otherwise specified.
Notice that \fIanm\fR can only be used on ACK format object files
(that is: \fI.o\fR and \fI.out\fR files).
If you want to get the name list of an executable program use
.I nm
instead.
.SH "SEE ALSO"
.BR asize (1),
.BR nm (1),
.BR ar (1),
.BR size (1).

View file

@ -1,56 +0,0 @@
.TH AR 1
.SH NAME
ar, aal \- archivers
.SH SYNOPSIS
\fBar\fR [\fBdmpqrtx\fR][\fBabciluv\fR]\fR [\fIposname\fR] \fIarchive\fR [\fIfile \fR...]\fR
.br
\fBaal\fR [\fBdpqrtx\fR][\fBclv\fR]\fR \fIarchive\fR [\fIfile \fR...]\fR
.br
.de FL
.TP
\\fB\\$1\\fR
\\$2
..
.de EX
.TP 20
\\fB\\$1\\fR
# \\$2
..
.SH EXAMPLES
.EX "ar r libc.a sort.s" "Replace \fIsort\fR.s in \fIlibc.a\fR"
.EX "ar rb a.s libc.a b.s" "Insert \fIb.s\fR before \fIa.s\fR in \fIlibc.a\fR"
.SH DESCRIPTION
.PP
\fIAr\fR allows groups of files to be put together into a single archive.
It is normally used for libraries of compiled procedures. \fIAal\fR is like
\fIar\fP, but is to be used with the ACK compiler. The following keys
are allowed:
.PP
.ta 0.25i 0.50i
.nf
\fBd\fR: Delete. \fIAr\fR will delete the named members.
\fBm\fR: Move named files. \fIAr\fR expects \fIa\fR, \fIb\fR, or \fIi\fR to be specified.
\fBp\fR: Print the named files (list them on \fIstdout\fR)
\fBq\fR: Quickly append to the end of the archive file.
\fBr\fR: Replace (append when not in archive).
\fBt\fR: Print the archive's table of contents.
\fBx\fR: Extract
.fi
.PP
\fBThe keys may optionally concatencated with one or more of the following\fR:
.nf
.PP
\fBa\fR: After \fIposname\fR
\fBb\fR: Before \fIposname\fR
\fBc\fR: Create (suppresses creation message)
\fBi\fR: Before \fIposname\fR
\fBl\fR: Local temporary file for work instead of \fI/tmp/ar.$$$$$\fR
\fBu\fR: Replace only if dated later than member in archive
\fBv\fR: Verbose
.PP
.fi
.SH "SEE ALSO"
.BR anm (1),
.BR asize (1),
.BR nm (1),
.BR size (1).

View file

@ -1,37 +0,0 @@
.TH ASIZE 1
.SH NAME
asize \- report the size of an object file
.SH SYNOPSIS
\fBasize \fIfile\fR ...\fR
.br
.de FL
.TP
\\fB\\$1\\fR
\\$2
..
.de EX
.TP 20
\\fB\\$1\\fR
# \\$2
..
.SH EXAMPLES
.EX "asize test.o" "Give the size of \fItest.o\fR"
.SH DESCRIPTION
.PP
.I Asize
prints for each argument
the (decimal) number of bytes used by the different sections,
as well as their sum in decimal and hexadecimal.
If no
.I file
is given \fIa.out\fR is used.
.I Asize
can only be used to obtain the size of a \fI.o\fR or \fI.out\fR file.
To obtain the size of an executable, use
.I size
instead.
.SH "SEE ALSO"
.BR anm (1),
.BR nm (1),
.BR ar (1),
.BR size (1).

View file

@ -1,65 +0,0 @@
.TH CHMEM 1
.SH NAME
chmem \- change memory allocation
.SH SYNOPSIS
\fBchmem\fR [\fB+\fR]\fR [\fB\-\fR] [\fB=\fR] \fIamount file\fR
.br
.de FL
.TP
\\fB\\$1\\fR
\\$2
..
.de EX
.TP 20
\\fB\\$1\\fR
# \\$2
..
.SH EXAMPLES
.EX "chmem =50000 a.out" "Give \fIa.out\fP 50K of stack space"
.EX "chmem \-4000 a.out" "Reduce the stack space by 4000 bytes"
.EX "chmem +1000 file1" "Increase each stack by 1000 bytes"
.SH DESCRIPTION
.PP
When a program is loaded into memory, it is allocated enough memory
for the text and data+bss segments, plus
an area for the stack.
Data segment growth using
.I malloc ,
.I brk ,
or
.I sbrk
eats up stack space from the low end.
The amount of stack space to allocate is derived
from a field in the executable program's file header.
If the combined stack and data segment growth exceeds the stack space
allocated, the program will be terminated.
.PP
It is therefore important to set the amount of stack space carefully.
If too little is provided, the program may crash.
If too much is provided, memory will be wasted, and fewer programs will be able
to fit in memory and run simultaneously.
\s-1MINIX 3\s-1
does not swap, so that when memory is full, subsequent attempts to fork will
fail.
The compiler sets the stack space
to the largest possible value (for the Intel CPUs, 64K \- text \- data).
For many programs, this value is far too large.
Nonrecursive programs that do not call
.I brk ,
.I sbrk ,
or
.I malloc ,
and do not have any local arrays usually do not need more than 8K of stack
space.
.PP
The
.I chmem
command changes the value of the header field that determines the stack allocation, and
thus indirectly the total memory required to run the program.
The = option sets the stack size
to a specific value; the + and \- options increment and decrement the
current value by the indicated amount.
The old and new stack sizes are printed.
.SH "SEE ALSO"
.BR install (1),
.BR brk (2).

View file

@ -1,37 +0,0 @@
.TH POSTMORT 1
.SH NAME
postmort \- perform post-mortem on PC MINIX 3 core files
.SH SYNOPSIS
\fBpostmort\fR [\fB\-dpt\fR] \fB\-c \fIcorefile \fB\-s \fIsymbfile\fR
.br
.de FL
.TP
\\fB\\$1\\fR
\\$2
..
.de EX
.TP 20
\\fB\\$1\\fR
# \\$2
..
.SH OPTIONS
.FL "\-c" "Use the named corefile"
.FL "\-d" "Dump all text symbols and segment data"
.FL "\-p" "Display the kernel process table"
.FL "\-s" "Use the named symbol file"
.FL "\-t" "Display a stack backtrace"
.SH EXAMPLES
.EX "postmort" "display the data from the file 'core'"
.SH DESCRIPTION
.PP
.I Postmort
does a simple static analysis of a PC MINIX 3 core file;
By default, it looks for the
file 'core' in the local directory and loads that for analysis; it
also searches for the file 'symbol.out', and if that fails 'a.out',
expecting them to contain symbol information for the core file.
It is not a fatal error if the symbol files don't exist.
.PP
The stack backtrace is slightly tricky, and may go on longer
than is really justified, since there's no easy way for it to
know when to stop. Treat its results with caution.

View file

@ -1,24 +0,0 @@
.TH STRIP 1
.SH NAME
strip \- remove symbol table from executable file
.SH SYNOPSIS
\fBstrip\fR [\fIfile\fR] ...\fR
.br
.de FL
.TP
\\fB\\$1\\fR
\\$2
..
.de EX
.TP 20
\\fB\\$1\\fR
# \\$2
..
.SH EXAMPLES
.EX "strip a.out" "Remove symbols from \fIa.out\fR"
.SH DESCRIPTION
.PP
For each file argument, \fIstrip\fR removes the symbol table.
Strip makes a copy of the file being stripped, so links are lost.
.SH "SEE ALSO"
.BR install (1).

View file

@ -1,4 +1,4 @@
MAN= awk.1x dis88.1x elvis.1x kermit.1x \
MAN= awk.1x elvis.1x kermit.1x \
macros.1x mined.1x
.include <bsd.man.mk>

View file

@ -1,84 +0,0 @@
.so mnx.mac
.TH DIS88 1x
.CD "dis88 \(en disassembler [IBM]"
.SX "dis88\fR [\fB\(eno\fR] \fIinfile\fR [\fIoutfile\fR]"
.FL "\(eno" "List the object code along with the assembly code"
.EX "dis88 a.out >listing" "Disassemble \fIa.out\fR"
.EX "dis88 \(eno a.out listing" "Ditto, but with object code"
.PP
\fIDis88\fR disassembles 8088 object code to the assembly language format
used by
.MX .
It makes full use of
symbol table information, supports separate
instruction and data space, and generates synthetic labels when needed.
It does not support 8087 mnemonics, symbolic data segment references, or
the ESC mnemonic.
.PP
The program is invoked by:
.HS
.Cx "dis88 [\(eno] infile [outfile]"
.HS
The \(eno flag causes object code to be listed.
If no outfile is given, \fIstdout\fR is used.
.PP
The text segment of an object file is always padded to an even address.
In addition, if the file has split I/D space, the text segment will be padded
to a paragraph boundary (i.e., an address divisible by 16). Due to padding, the
disassembler may produce a few spurious, but harmless, instructions at the end
of the text segment.
.PP
Because the information to which initialized data refers cannot generally
be inferred from context, the data segment is treated literally. Byte values
(in hexadecimal) are output, and long stretches of null data are represented by
appropriate \fI.zerow\fR pseudo-ops.
Disassembly of the bss segment, on the other
hand, is quite straightforward, because uninitialized data is all zero by
definition.
No data is output in the bss segment, but symbolic labels are output
as appropriate.
.PP
The output of operands in symbolic form is complicated somewhat by the
existence of assembler symbolic constants and segment override opcodes. Thus,
the program's symbol lookup routine attempts to apply a certain amount of
intelligence when it is asked to find a symbol. If it cannot match on a symbol
of the preferred type, it may output a symbol of some other type, depending on
preassigned (and somewhat arbitrary) rankings within each type. Finally, if
all else fails, it will output a string containing the address sought as a hex
constant. For user convenience, the targets of branches are also output, in
comments, as hexadecimal constants.
.SS "Error Messages"
.PP
Various error messages may be generated as a result of problems encountered
during the disassembly.
They are listed below
.HS.
.in +3.20i
.ta +2.75i +0.2i
.ti -2.95i
Cannot access input file \(en Input file cannot be opened or read
.ti -2.95i
Cannot open output file \(en Output file cannot be created
.ti -2.95i
Input file not in object format \(en Bad magic number
.ti -2.95i
Not an 8086/8088 object file \(en CPU ID of the file header is incorrect
.ti -2.95i
Reloc table overflow \(en Relocation table exceeds 1500 entries
.ti -2.95i
Symbol table overflow \(en Symbol table exceeds 1500 entries
.ti -2.95i
Lseek error \(en Input file corrupted (should never happen)
.ti -2.95i
Warning: no symbols \(en Symbol table is missing (use ast)
.ti -2.95i
Cannot reopen input file \(en Input file was removed during execution
.in -3.20i
.SS "Author"
.PP
\fIDis88\fR was written and
copyrighted by G. M. Harding and is included here by permission. It may be
freely redistributed provided that complete source code, with all copyright
notices, accompanies any redistribution. This provision also applies to any
modifications you may make. You are urged to comment such changes, giving,
as a minimum, your name and complete address.

0
man/man3/dirname.3 Executable file → Normal file
View file

0
man/man3/feholdexcept.3 Executable file → Normal file
View file

0
man/man3/getaddrinfo.3 Executable file → Normal file
View file

View file

@ -19,9 +19,6 @@ Contains the utility programs; see also \fB/sbin/\fP, \fB/usr/bin/\fP, \fB/usr/s
...
.fi
.TP
.I /boot/
Contains images and files which are needed during the boot process. See \fBmonitor\fP(8).
.TP
.I /dev/
Contains device, block, or other special files. See
.BR mknod(2).
@ -29,7 +26,7 @@ Contains device, block, or other special files. See
.nf
\fBconsole\fP computer's console device, \fBtty\fP(4)
\fBfd*\fP floppy disk, \fBfd\fP(4)
\fBhd*\fP hard disk, \fBhd\fP(4)
\fBc?d*\fP hard disk, \fBhd\fP(4)
\fBnull\fP accetps and discards all input; produces no output
\fBtty*\fP terminal device, \fBtty\fP(4)
\fBzero\fP the zero device; produces null bytes
@ -121,7 +118,6 @@ Contains source and majority of system utilities and files
\fIbin/\fP Common user programs and utilities.
\fBcc\fP MINIX 3 c compiler, \fBcc\fP(1)
\fBman\fP show manual pages, \fBman\fP(1)
...
@ -146,19 +142,7 @@ Contains source and majority of system utilities and files
\fBcawf/\fP text formatter support files, \fBcawf\fP(1)
\fBcrontab\fP cron jobs, \fBcron\fP(8)
\fBdict/\fP word lists
\fBlibc.a\fP C library (Minix-8086 only), \fBcc\fP(1)
\fBarch\fP per architecture compiler binaries and
libaries, \fBcc\fP(1)
...
\fIlocal/\fP
Contains programs which are related to local softwares.
\fBbin/\fP utilities for locally installed programs
\fBetc/\fP local configuration and data files
\fBrc\fP local system startup
\fBman/\fP manual pages associated with local programs
\fBsrc/\fP local sources
\fBlibc.a\fP C library
...
\fIman/\fP Contains manual pages in subdirectories according to
@ -183,6 +167,14 @@ Contains source and majority of system utilities and files
\fBboot\fP bootstrap code, \fBinstallboot\fP(8)
...
\fIpkg/\fP
Contains programs which are related to local softwares.
\fBbin/\fP utilities for locally installed programs
\fBetc/\fP local configuration and data files
\fBman/\fP manual pages associated with local programs
...
\fIpreserve/\fP
Contains saved elvis editor buffers.
See \fBelvprsv\fP(8), \fBelvrec\fP(1).
@ -206,12 +198,10 @@ Contains source and majority of system utilities and files
utilities and boot files
\fBbenchmarks/\fP
test programs for system and graphic tests
\fBboot/\fP source files for boot monitor package
\fBcommands/\fP source file for command utilities
\fBcommon/\fP
\fBinclude/\fP includes common to NetBSD and Minix
\fBlib/\fP lib files common to NetBSD kernel and libc
\fBcrclist\fP CRC checksums of the source tree, \fBsrccrc\fP(8)
\fBdocs/\fP documents related to recent source changes
\fBdrivers/\fP source files for various device drivers
\fBetc/\fP source for files in /etc/

View file

@ -1,9 +1,9 @@
MAN= add_route.8 backup.8 badblocks.8 boot.8 btrace.8 \
cdprobe.8 checkhier.8 chown.8 cleantmp.8 config.8 cron.8 \
dhcpd.8 diskctl.8 dosminix.8 elvprsv.8 fbdctl.8 fdisk.8 fingerd.8 \
ftpd.8 getty.8 halt.8 hgfs.8 httpd.8 ifconfig.8 inet.8 init.8 \
installboot.8 intr.8 irdpd.8 loadramdisk.8 MAKEDEV.8 \
mknod.8 monitor.8 netconf.8 newroot.8 nonamed.8 \
dhcpd.8 diskctl.8 elvprsv.8 fbdctl.8 fdisk.8 fingerd.8 \
getty.8 halt.8 hgfs.8 httpd.8 ifconfig.8 inet.8 init.8 \
intr.8 irdpd.8 loadramdisk.8 MAKEDEV.8 \
mknod.8 netconf.8 newroot.8 nonamed.8 \
ossdevlinks.8 part.8 partition.8 \
poweroff.8 printroot.8 pr_routes.8 pwdauth.8 rarpd.8 \
rdate.8 readclock.8 reboot.8 repartition.8 rlogind.8 \

0
man/man8/cdprobe.8 Executable file → Normal file
View file

View file

@ -1,287 +0,0 @@
.TH DOSMINIX 8
.SH NAME
dosminix, mkfile \- Running MINIX 3 under DOS
.SH SYNOPSIS
.RB "C:\eMINIX> " "boot disk0.mnx" "\0\0\0\0\0(Typical example)"
.br
.RB "C:\eMINIX> " "mkfile \fIsize disk"
.SH DESCRIPTION
.de SP
.if t .sp 0.4
.if n .sp
..
This text describes running MINIX 3
.\" or Minix-vmd
under DOS. The DOS version
of the Boot Monitor, described in
.BR monitor (8),
grabs as much memory as DOS is willing to give, loads MINIX 3 into that memory
from the active partition of a "file as disk", and jumps to the MINIX 3 kernel
to let MINIX 3 take control. As far as DOS is concerned MINIX 3 is just a part
of the
.B boot.com
program.
.PP
In the example above
.B disk0.mnx
is the "file as disk". It is a file of many megabytes that is used by MINIX 3
as a disk of four partitions. These partitions will normally be
.B /dev/dosd1
through
.BR /dev/dosd4 ,
with
.BR /dev/dosd0
for the whole "disk". The Boot Monitor will set the
.B dosd0
boot variable to the name of the disk (its first argument), the root file
system will be the active partition, usually
.BR dosd1 .
It is better to use the special name
.B bootdev
to indicate this device, usually in the setting
.BR rootdev = bootdev .
.PP
Once MINIX 3 is running it will operate the same as if started from a regular
disk partition until it is shut down. On shutdown from protected mode it
will return to the Boot Monitor prompt, and with the
.B exit
command you leave the Boot Monitor and return to DOS. Shutting down from
real mode will reboot the machine, just like when run from a disk partition.
(This more or less crashes DOS, but DOS is used to such abuse.)
.SS EMM386
MINIX 3 can't run in protected mode (286 or 386 mode) if DOS is using a memory
manager like
.BR EMM386 .
You can either temporarily comment out EMM386 from
.BR CONFIG.SYS ,
or you can press
.B F8
on startup to bypass CONFIG.SYS. This is only possible with the later DOS
versions.
.SS "Windows 95"
Press F8 at startup to make the boot menu visible. Choose
"\fBCommand prompt\fP", or "\fBSafe mode command prompt\fP" to run DOS.
Use the "safe mode" if EMM386 is started in CONFIG.SYS.
.PP
Typing F8 at the right moment isn't easy, so you may want to change the way
Windows boots by editing the
.B MSDOS.SYS
file found in the root directory of your Windows system. This is alas not
trivial.
Open a window on your main drive, click on "\fBView\fP" and choose
"\fBOptions\fP." In the Options window choose "\fBView\fP" and enable
"\fBShow all files\fP". The MSDOS.SYS file should now be visible, among
several other hidden files. Right-click on the MSDOS.SYS icon, choose
"\fBProperties\fP" and disable "\fBRead-only\fP". Bring MSDOS.SYS into a
simple text editor such as Notepad. In the
.B "[Options]"
segment add the following lines (or change existing lines into):
.PP
.RS
.nf
BootMenu=2
BootMenuDelay=5
.fi
.RE
.PP
The first setting makes the Windows boot menu always visible, and the second
line changes the delay before booting to 5 seconds. Take care not to change
anything else, or things will go horribly wrong. Save MSDOS.SYS and exit.
Don't forget to make MSDOS.SYS read-only again, and also hide all the hidden
files again, unless you like it this way.
.SS "DOS compatibility box"
The 16-bit version of standard MINIX 3 can be run in real mode in a DOS box.
This is somewhat surprising, because it means Windows 95 simulates devices
like the keyboard, timer, and interrupt controller well enough to fool MINIX 3
into thinking that all is well. Alas it doesn't work as well under Windows
NT. Keypresses get lost if you type to fast, and using the floppy
occasionally locks MINIX 3 up. This is a bit disappointing, because it is the
only way to run MINIX 3 under NT. Under Windows 95 one is better off
putting the system in DOS at boot and then to run MINIX 3 in protected mode.
.PP
One thing that is better under NT is that the Boot Monitor is able to get a
so-called "Upper Memory Block", thereby raising useful memory to about 750K.
Windows 95 however hogs leftover UMB memory in a process named
.BR vmm32 ,
whatever that may be. To get
some of this memory you can put
.B "BOOT /U"
at the start of
.BR autoexec.bat .
The monitor will grab a 64K UMB if it can get it, and keep that memory safe
for use by MINIX 3 when it is later started from Windows.
.PP
The easiest way to start MINIX 3 is to give all MINIX 3 disk files the suffix
.BR MNX .
Doubleclick on the disk you want to run to make the "\fBOpen With\fP" window
appear. Click on "\fBOther\fP" and browse to the
.B BOOT.COM
program. Set the name of the .mnx files to "\fBMINIX 3 "disk" file\fP" in the
description box if you want everything right. In the future you can
just click on a MINIX 3 disk file to run it, you don't have to start a DOS
box first. (To make it perfect use "View", "Options", "File Types", choose
"MINIX 3 "disk" file", "Edit", "Change Icon", "Browse", select MINIX.ICO.)
.PP
When MINIX 3 shuts down it will try to reboot what it thinks is a PC. Windows
seems to assume that the DOS session has exited. Right-click on the
BOOT.COM program, "Properties", "Program", and enable "Close on exit" to make
the DOS box disappear automatically when MINIX 3 thinks it reboots. You may
also want to lock the font to
.BR 7x12 ,
or any other font that isn't ugly.
.PP
MINIX 3 disk files are opened in a write-exclusive mode. A second MINIX 3
session can only open it read-only, which may lead to a "can't open
root device" error.
.SS "Mkfile"
MINIX 3 disk files can be created or resized with the
.B mkfile
utility. Its two arguments are the size and name of the disk file. The
size is a number optionally followed by the letter
.BR k ,
.BR m
or
.BR g
to specify kilobytes, megabytes, or even gigabytes. So the call
.PP
.RS
.B "mkfile 50m disk5.mnx"
.RE
.PP
will create a 50 megabyte file named
.BR disk5.mnx .
If the file already exist then it is shrunk or grown to 50 megabytes. No
data is lost if the file is grown. If the file is shrunk then only the data
that is cut off is lost. These features allow one to inrease the size of a
MINIX 3 /usr partition with the following recipe:
.PP
.RS
.ta +24n+2m
.nf
copy disk0.mnx disk0.new Copy the disk to disk0.new
mkfile 100M disk0.new Enlarge to 100 megabytes
boot disk0.mnx Boot the old "disk"
[ESC] Get the attention of the monitor
dosd5=disk0.new /dev/dosd5 becomes disk0.new
boot
\&...
login: root
.fi
.in +(24n+2m)
.ti -(24n+2m)
part Choose dosd5, move to the Size field of dosd7
partition, hit 'm' to fill it out to the end of the "disk". Write and quit.
.in -(24n+2m)
.nf
mkfs /dev/dosd7 Recreate the file system, but larger
mount /dev/dosd7 /mnt
cpdir -v /usr /mnt Copy /usr to the new disk's /usr to be
shutdown Back to the monitor
exit Back to DOS
ren disk0.mnx disk0.old
ren disk0.new disk0.mnx Replace old by new
boot disk0.mnx Run the larger system
.fi
.RE
.PP
Now MINIX 3 runs from a larger "disk". Don't worry if it claims to have
crashed, there wasn't a "shutdown" entry in /usr/adm/wtmp at the time it was
copied.
.PP
The above recipe is for a ordinary standard MINIX 3 installation with /usr on
the second and last partition.
.\" Minix-vmd usually has /usr on the third and
.\" last partition (dosd3 / dosd8), its
.\" .B mkfs
.\" command requires a
.\" .B "-t\ 2f"
.\" option to specify the file system type as "V2 flex", and it knows if
.\" it has crashed or not.
.SS Backups
In the recipe above you saw how simple it is to create a new system, just
copy a disk file. It is equally simple to make a backup, you just copy the
disk file. To make a test system: copy the disk file. To make another test
system: copy the disk file. Let friends have their own MINIX 3: copy the disk
file again. (Exciting, eh?)
.PP
You may want to save a MINIX 3 disk file in a ZIP file to save space. It may
look as a good idea to first run
.B "make clean"
in
.B /usr/src
to remove all the binary junk, but alas that has no effect at all.
The disk file is compressed under DOS, and there it is unknown which blocks
are in use and which are free. With the following trick you can make those
deleted blocks compress really well:
.PP
.RS
.nf
cd /usr/tmp
echo >junk
while cat junk >>junk; do :; done
sync
rm junk
.fi
.RE
.PP
After these commands all free blocks contain newlines. Long runs of the
same byte happen to compress by a factor 1000, so the unused disk blocks
will almost disappear in the ZIP file.
.\" Under Minix-vmd you can use
.\" .PP
.\" .RS
.\" cp /dev/zero junk
.\" .RE
.\" .PP
.\" instead of the echo/while pair of lines above. Standard MINIX 3 doesn't have
.\" /dev/zero.
.SS "FAT driver"
The dos disk driver, described in
.BR dosd (4),
has two identities. By default you get the "\fBfile\fP" driver, that uses
DOS file I/O calls to access a large DOS file as a disk. The other
alternative is the "\fBFAT\fP" driver. The FAT driver sits on top of an
ordinary MINIX 3 disk driver, and interprets a partition as a FAT (File Access
Table) file system to find a file to use as a MINIX 3 disk. The result
has the same effect as the file driver, except that no costly calls to DOS
are made. To enable this feature you have to use the following Boot
environment settings:
.PP
.RS
.nf
dosd = fat
dosd0 = hd1:\eminix\edisk0.mnx
.fi
.RE
.PP
The
.B dosd
setting tells MINIX 3 to use the FAT driver, and the
.B dosd0
setting tells the MINIX 3 device and DOS file name to use. Disk I/O should
be sped up nicely by this change, although typical use of MINIX 3 doesn't
require fast disk I/O, so the difference won't be too noticable.
.PP
Support for FAT-32 (big file system support added in the later Windows 95
releases) has not been tested very well. The FAT-12 and FAT-16 code has
been used a lot, and seems safe. Note the risks inherent in these
drivers: The file driver uses simple DOS file I/O calls, leaving it to
DOS to know its own file system. The FAT driver interprets FAT file system
structures by itself. MINIX 3 booted from a real hard disk partition can
only use DOS disk files through the FAT driver.
.SH "SEE ALSO"
.BR dosd (4),
.BR monitor (8),
.BR usage (8).
.SH NOTES
Use at your own risk.
.SH BUGS
Hasn't been tried under Windows 98 yet.
.PP
Pray the deity of your choice will forgive you for running a UNIX-like
system as an ordinary DOS program. The author of this code is already
doomed. When his time comes the daemons wi*(&%*$%*&
.br
Memory fault \- core dumped
.SH AUTHOR
Kees J. Bot (kjb@cs.vu.nl)

View file

@ -1,145 +0,0 @@
.\" Copyright (c) 1985 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\" @(#)ftpd.8c 6.4 (Berkeley) 5/28/86
.\"
.TH FTPD 8
.SH NAME
ftpd, in.ftpd, setup.anonftp \- DARPA Internet File Transfer Protocol server
.SH SYNOPSIS
.B "ftp stream tcp nowait root /usr/sbin/in.ftpd in.ftpd"
.br
.B "tcpd ftp /usr/sbin/in.ftpd"
.SH DESCRIPTION
.B Ftpd
is the DARPA Internet File Transfer Prototocol
server process. The server uses the TCP protocol
and listens at the port specified in the ``ftp''
service specification; see
.BR services (5).
.PP
The ftp server currently supports the following ftp
requests; case is not distinguished.
.PP
.nf
.ta \w'Request 'u
\fBRequest Description\fP
ABOR abort previous command
ACCT specify account (ignored)
ALLO allocate storage (vacuously)
APPE append to a file
CDUP change to parent of current working directory
CWD change working directory
DELE delete a file
HELP give help information
LIST give list files in a directory (``ls -lA'')
MKD make a directory
MODE specify data transfer \fImode\fP
NLST give name list of files in directory (``ls'')
NOOP do nothing
PASS specify password
PASV prepare for server-to-server transfer
PORT specify data connection port
PWD print the current working directory
QUIT terminate session
RETR retrieve a file
RMD remove a directory
RNFR specify rename-from file name
RNTO specify rename-to file name
STOR store a file
STOU store a file with a unique name
STRU specify data transfer \fIstructure\fP
TYPE specify data transfer \fItype\fP
USER specify user name
XCUP change to parent of current working directory
XCWD change working directory
XMKD make a directory
XPWD print the current working directory
XRMD remove a directory
.fi
.PP
The remaining ftp requests specified in Internet RFC 959 are
recognized, but not implemented.
.PP
The ftp server will abort an active file transfer only when the
ABOR command is preceded by a Telnet "Interrupt Process" (IP)
signal and a Telnet "Synch" signal in the command Telnet stream,
as described in Internet RFC 959.
.PP
.B Ftpd
interprets file names according to the ``globbing''
conventions used by
.BR csh (1).
This allows users to utilize the metacharacters ``*?[]{}~''.
.PP
.B Ftpd
authenticates users according to three rules.
.IP 1)
The user name must be in the password data base,
.BR /etc/passwd ,
and not have a null password. In this case a password
must be provided by the client before any file operations
may be performed.
.IP 2)
The user name must not appear in the file
.BR /etc/ftpusers .
.IP 3)
If the user name is ``anonymous'' or ``ftp'', an
anonymous ftp account must be present in the password
file (user ``ftp''). In this case the user is allowed
to log in by specifying any password (by convention this
is given as the client host's name).
.PP
In the last case,
.B ftpd
takes special measures to restrict the client's access privileges.
The server performs a
.BR chroot (2)
command to the home directory of the ``ftp'' user.
In order that system security is not breached, it is recommended
that the ``ftp'' subtree be constructed with care; the following
rules are recommended.
.IP ~ftp)
Make the home directory owned by ``ftp'' and unwritable by anyone.
.IP ~ftp/bin)
Make this directory owned by the super-user and unwritable by
anyone. The program
.BR ls (1)
must be present to support the list commands. This
program should have mode 111.
.IP ~ftp/etc)
This directory could be created, and could have
.BR passwd (5)
and
.BR group (5)
databases in it so that
.B ls
can show file ownership, but outsiders will grab your password file and
misuse it to spam you. So don't bother.
.IP ~ftp/pub)
Make this directory mode 755 and owned by the super-user. Create
directories in it owned by users if those users want to manage an
anonymous ftp directory.
.IP ~ftp/pub/incoming)
Optionally create this directory for anonymous uploads. Make it mode
777. The FTP daemon will create files with mode 266, so remote users
can write a file, but only local users can do something with it.
.PP
The script
.B setup.anonftp
can be used to create or check an anonymous FTP tree.
.SH "SEE ALSO"
.BR ftp (1).
.SH BUGS
The anonymous account is inherently dangerous and should
avoided when possible.
.ig \" MINIX 3 doesn't have privileged port numbers (yet?)
.PP
The server must run as the super-user
to create sockets with privileged port numbers. It maintains
an effective user id of the logged in user, reverting to
the super-user only when binding addresses to sockets. The
possible security holes have been extensively
scrutinized, but are possibly incomplete.
..

View file

@ -1,395 +0,0 @@
.TH INSTALLBOOT 8
.SH NAME
installboot \- make a device bootable
.SH SYNOPSIS
.B installboot \-i(mage)
.I image
.RI [ label :] kernel
.IR "mm fs" " ... " init
.br
.B installboot \-(e)x(tract)
.I image
.br
.B installboot \-d(evice)
.I device bootblock boot
.RI [[ label :] image
\&...]
.br
.B installboot \-b(oot)
.I device bootblock boot
.RI [ label :] image
\&...
.br
.B installboot \-m(aster)
.I device masterboot
.RI [ keys " [" logical ]]
.SH DESCRIPTION
.de SP
.if t .sp 0.4
.if n .sp
..
.B Installboot
may be used to make a device bootable by constructing a kernel image and
installing bootstrap code into the boot block of a MINIX 3 file system. To
understand how this can be done one first has to know what happens when a
PC is booted.
.PP
When the power is turned on the typical PC will try to read the first sector
from the first floppy disk or from the first hard disk into memory and execute
it. The code obtained from the hard disk (from the so-called master boot
sector) will immediately replace itself by the code found in the first sector
of the active partition. Thus the PC is now executing the bootstrap code found
in the first sector of /dev/fd0, /dev/c0d0p0, /dev/c0d0p1, /dev/c0d0p2, or
/dev/c0d0p3 (assuming the boot disk is attached to controller 0.)
The bootstrap will locate the operating system on the device it itself was
loaded from, load it, and execute it.
.PP
To make a MINIX 3 file system
.B /dev/fd0
mounted on
.B /mnt
bootable, enter the following:
.SP
.RS
.ft B
cp /usr/mdec/boot /mnt/boot
.SP
installboot \-i /mnt/minix kernel mm fs init
.SP
installboot \-d /dev/fd0 /usr/mdec/bootblock boot
.ft P
.RE
.PP
The "boot" program in the example is named the "Boot Monitor". It is loaded
by the bootblock code placed in the boot sector of /dev/fd0 and it will take
care of loading the kernel image "minix" from the root directory of the
file system. See
.BR monitor (8)
for a description of the Boot Monitor. Note that
.B boot
is a name in the file system on
.B /dev/fd0
in this example, the same file as
.BR /mnt/boot .
Making
.B /mnt/minix
is normally not necessary, there is usually a kernel image in the
.B tools
directory.
.SH OPTIONS
.B \-i(mage)
.I image
.RI [ label :] kernel
.IR "mm fs" " ... " init
.RS
The
.B \-image
option (or the
.B \-i
shorthand) combines the executable files needed to run MINIX 3 in one file.
Only the names and a few zero bytes are inserted into the image. The name
is for identification and the zeros are used to pad separate pieces to
sector boundaries for fast loading.
.SP
An executable may be prefixed by a label. The Monitor may be instructed to
load processes by label. So more than one kernel process may be included in
the image, each with a different winchester driver for instance. So if you
have compiled two different kernels with an AT or XT driver then
.SP
.RS
.BI "installboot \-i" " image AT:at_kernel XT:xt_kernel mm fs init"
.RE
.SP
will make an image with two different labeled kernels and one
unlabeled set of the other binaries.
.RE
.PP
.B \-(e)x(tract)
.I image
.RS
Extract the binaries from
.I image
under the names stored in the image. (The name includes the optional label.)
.RE
.PP
.B \-d(evice)
.I device bootblock boot
.RI [[ label :] image
\&...]
.RS
Installs
.I bootblock
in the boot sector of
.I device
together with the disk addresses to
.IR boot .
These disk addresses are needed to load
.I boot
from the file system at boot time. The argument
.I boot
is first searched in the file system on
.IR device .
If it is not found then it is read as a normal file and added at the end of
the file system. The file system should be smaller than the device it is on
to allow this. Any extra images are also added to the end as described
under
.BR \-boot .
(Make sure you understand all this.)
.SP
The device need not be mounted when
.B installboot
is run, nor does it matter if it is.
.SP
.B Installboot
needs to be run again if
.I boot
is rewritten, because it will then occupy a new place on the disk.
.SP
Old boot parameters are kept if there are no images added.
.RE
.PP
.B \-b(oot)
.I device bootblock boot
.RI [ label :] image
\&...
.RS
This option fills a blank floppy in
.I device
with boot code and kernel images. This "boot disk" does not have a root
file system, only the Boot Monitor and MINIX 3 kernels. The boot parameters
sector is filled with code that enables menu options for selecting an
image. After loading an image, the Monitor will ask you to insert a root
file system diskette before starting MINIX 3.
.SP
The labels used on the images should match those on the executables used
inside the image. You can put a comma separated list of labels on an image
for each label used within the image. For the image created earlier one
would create a boot floppy like this:
.SP
.RS
.nf
.BI "installboot \-b /dev/fd0 bootblock boot" " AT,XT:image"
.fi
.RE
.SP
If a label-list is omitted on an image, then that image will be selected by
default. (Like in the normal one image, no labels case.)
.SP
Note that
.B \-device
and
.B \-boot
together allow you to make a boot floppy with or without a root file system.
With the boot code in the file system, attached to the end of it, or after
the boot block. And with one or more kernel images in the file system or
at the end of the device. Somewhat confusing.
.RE
.PP
.B \-m(aster)
.I device masterboot
.RI [ keys " [" logical ]]
.RS
This option installs the
.I masterboot
program into the boot sector of the given device. If another device is
given instead of
.I masterboot
then its bootstrap code is copied to
.IR device .
The master bootstrap on a hard disk boots the active partition on that disk
at boot time. The MS-DOS fdisk command normally puts a master bootstrap on
the hard disk. MINIX 3 has two bootstraps that can be used as a master
bootstrap,
.B masterboot
and
.BR jumpboot.
.SP
.B Masterboot
is a fairly normal master bootstrap that works as follows:
.RS
.SP
If installed on a hard disk then it will load the bootstrap of the active
partition and run it.
.B Masterboot
can be put in the first sector of a hard disk to boot the active partition,
or in the first sector of a MINIX 3 partition to boot the active subpartition.
.SP
If installed on a MINIX 3 floppy then it will try to boot the next floppy or
the first hard disk. Ideal for floppies with just data on it, they will no
longer obstruct the boot process if left in the drive. Also a very useful
trick to boot from floppy drive 1.
.RE
.SP
The other bootstrap named
.B jumpboot
is used for the weird cases:
.SP
.RS
If your default operating system is installed on another disk then
.B jumpboot
can be installed on the first disk and instructed to boot the disk,
partition or subpartition that must be booted by default.
.SP
If one of your operating systems insists on being active when booted then use
.B jumpboot
to ignore the active flag and boot your preferred O.S. instead. The Boot
Monitor's "\fBboot\ \(**\fP" trick to activate the partition to boot is
useful here.
.SP
To boot a logical partition within an extended partition. Note that you can
put
.B jumpboot
in the first sector of the extended partition in this case, with the
extended partition marked active.
.SP
If you hold down the ALT key while
.B jumpboot
is being executed, then you can type the disk, partition or subpartition
you want to boot as one to three digits followed by typing ENTER.
.RE
.SP
.B Jumpboot
can be programmed to boot a certain partition with the
.I keys
argument and optionally also the
.I logical
argument.
.I Keys
are one to three digits naming the disk, partition or subpartition. If the
device to boot is
.BR /dev/c0d1p3s0 ,
then
.I keys
is
.BR 130 .
These are the same three digits you can type manually if you hold down ALT
at boot. To program
.B jumpboot
to boot a logical partition within an extended partition, let
.I keys
be just a disk number, and specify
.I logical
as the name of the logical partition on that disk that is to be booted.
(Actually
.I logical
can be any device name, but this form should be avoided because it offers
less checking to see if the device is still there after a disk
rearrangement.)
.SP
A backup copy of the current master bootstrap (including the partition
table) can be made with:
.RS
.SP
dd if=\fIdevice\fP of=\fIbackup-file\fP count=1
.SP
.RE
A simple 'cp \fIbackup-file\fP \fIdevice\fP' will put it back. You can
also use
.B fdisk /mbr
under MS-DOS 5.0 (or newer) to restore the master bootstrap.
.RE
.RE
.SH FILES
.TP 25
.B /usr/mdec/bootblock
MINIX 3 bootstrap for the Minix root device. To be placed in the boot sector.
.TP
.B /usr/mdec/boot
MINIX 3 Boot Monitor. Can usually be found in the root directory of a bootable
device.
.TP
.B /usr/mdec/masterboot
Master bootstrap. Can be placed in the first sector of a disk to select the
active partition. In a MINIX 3 primary partition it selects the active
subpartition.
.TP
.B /usr/mdec/jumpboot
Special "boot this" bootstrap.
.SH "SEE ALSO"
.BR part (8),
.BR monitor (8).
.SH DIAGNOSTICS
.I File
is not an executable
.RS
What you think is boot code or part of the kernel isn't.
.RE
.SP
.I Program
will crash, text/data segment larger then 64K
.RS
One of the 16-bit programs added to an image has a text or data segment
that is larger than 64K. You probably enabled too many drivers, or
configured too many buffers.
.RE
.SP
.I File
can't be attached to
.I device
.RS
You are trying to put the boot monitor or an image after a file system, but
there is no or not enough space. Did you specify the full path of the
monitor instead of just "boot"?
.RE
.SP
.I Device
is not a MINIX 3 file system
.RS
You are using
.B \-device
on a device that doesn't contain a file system. Maybe you specified the
wrong device, maybe you should make a file system, or maybe you should use
.BR \-boot .
.RE
.SP
.I Device
contains a file system
.RS
You are about to destroy a file system with
.BR \-boot .
Maybe you meant to use
.BR \-device ?
You have 10 seconds to make up your mind...
.RE
.SP
.I File
is too big
.RS
Several types of messages like these will tell you that
.I file
can't be installed in a boot sector, or that there is no room to add some
parameters, etc. Is
.I file
really a bootstrap?
.RE
.SS "Bootstrap errors"
Read error
.RS
A read error trying to get the next bit of boot code. You may even get the
BIOS error code in hex. Either the device has a bad block, or jumpboot is
told to read a nonexistent disk.
.RE
.SP
No active partition
.RS
None of the partitions in a partition table is marked active.
.RE
.SP
Not bootable
.RS
Partition does not exist (jumpboot), or it's bootstrap isn't executable.
.RE
.SH NOTES
The MINIX 3 bootstraps can boot beyond the 8G disk size limit if the BIOS
supports the IBM/MS INT 13 Extensions. Alas only Minix-vmd can make use of
this, standard MINIX 3 has a 4G disk size limit.
.SH BUGS
It has four more options than the SunOS installboot program it is modeled
after.
.PP
The bootblock code has been crunched to such ugliness that you can use it
to scare little kids out of your garden.
.SH AUTHOR
Kees J. Bot (kjb@cs.vu.nl)
.\"
.\" $PchId: installboot.8,v 1.7 2000/08/13 22:09:31 philip Exp $

0
man/man8/loadramdisk.8 Executable file → Normal file
View file

View file

@ -1,606 +0,0 @@
.TH MONITOR 8
.SH NAME
monitor, edparams \- load and start MINIX 3, modify boot parameters
.SH SYNOPSIS
.B /boot
.br
.B edparams
.I device
.RI [ command " ...]"
.br
.B boot.com
.I virdisk
.RI [ command " ...]"
.SH DESCRIPTION
.de SP
.if t .sp 0.4
.if n .sp
..
This text describes the Boot Monitor, a boot time interactive program designed
not only to load and start MINIX 3, its most important task, but to also
provide an interface to configure MINIX 3 and to boot other operating systems.
.PP
The monitor is controlled with an environment that is modeled after the
Bourne shell. This environment is filled at startup with default values
that depend on the machine the monitor is running on and the environment
settings saved into the boot parameters sector (the second sector on a
device). When the environment is loaded, the monitor executes the function
named
.BR main ,
which by default starts a simple menu.
.PP
The environment can be manipulated at boot time from the monitor prompt,
but may also be edited using
.B edparams
on a given device.
.B Edparams
simulates the monitor as much as it can, echoing commands it can't execute
between brackets. It can also be used in Makefiles and scripts by giving
it commands as arguments.
.PP
The DOS version of the monitor, usually named
.B boot.com
under DOS, boots MINIX 3 from a "DOS virtual disk".
.B Boot.com
is a simple COM program that interprets a DOS
file as a disk, loads a MINIX 3 kernel from the active partition in the same
way as the BIOS based monitor, and executes it to start MINIX 3. All the
monitor commands function in the same way, except for the
.B boot
command, it can only load MINIX 3. The monitor grabs as much free memory as
it can for MINIX 3 to work in, as the
.B memory
variable shows. Further details on how to run MINIX 3 under DOS, Windows 95,
or even Windows NT are written down in
.BR dosminix (8).
.SH COMMANDS
The monitor is best described by the commands you can type to the '>'
prompt. This is known as the "monitor mode". You can enter this mode by
hitting the Escape key. These are the monitor commands:
.PP
\fIname\fP = [\fBdevice\fP] \fIvalue\fP
.SP
.RS
Set environment variable.
.br
Changes the value of
.I name
to
.IR value .
The optional word
.B device
marks
.I name
as being subject to device translation. (See the section on devices.) These
(name, value) pairs are passed to the kernel who uses them to configure
itself. These variables are passed by default:
.SP
.B rootdev
.RS
This is the device used as your root device. It is by default set to
.BR ram,
which means that the device specified by
.B ramimagedev
will be loaded into the RAM disk and used as root. If you change this
variable then a physical device will be used as root, and the RAM disk will
be uninitialized and have the size specified by
.BR ramsize .
.RE
.SP
.B ramimagedev
.RS
Describes the device to use to initialize the RAM disk if
.B rootdev
is set to
.BR ram .
It's by default set to
.BR bootdev ,
a special name for the device the monitor booted from.
.RE
.SP
.B ramsize
.RS
The size of the RAM disk. If the RAM disk is used for the root file system
then the root file system is stretched out to
.B ramsize
if possible.
.RE
.SP
.B processor
.RS
Set by default to
.BR 86 ,
.BR 186 ,
.BR 286 ,
.BR 386 ,
.BR 486 ", ..."
depending on the hardware you have. You can set it to a smaller value to
test your kernel in a more limited environment.
.RE
.SP
.B bus
.RS
The type of system bus, either
.BR xt ,
.BR at
or
.BR mca .
This answers basic questions like: "How many interrupt controllers and how
to initialize?" Or: "Does the keyboard have LEDs?"
.RE
.SP
.B memory
.RS
List of memory free for use by MINIX 3. It is a comma separated list of
.IR base:size
pairs denoting the byte offsets and sizes of free memory in hexadecimal.
.B "800:925E0,100000:F00000"
is a typical example of about 585K starting at 2K, and 15M starting at 1M.
(The first 2K are BIOS parameters and the 53K under the 640K boundary is
the monitor itself.) The very last number you can play with if you know
what you are doing. Either increase it if the monitor has it wrong, or
decrease it to test if MINIX 3 still runs with less memory then normal.
.RE
.SP
.B video
.RS
Describes capabilities of the VDU:
.BR mda ,
.BR cga ,
.B ega
or
.BR vga .
.RE
.SP
.B chrome
.RS
Either
.B color
or
.BR mono .
.RE
.SP
.B c0
.RS
By default
.B at
(AT compatibles),
.B bios
(XT or PS/2), or
.B dosfile
(running under DOS).
The
.B c0
variable binds a driver to the first controller, i.e. the
.B /dev/c0*
devices. The monitor sets
.B c0
to a suitable default, so that most machines can find their disk.
.RE
.SP
.B console
.RS
If set to a hexadecimal value it makes the monitor set the BIOS video mode to
this value when MINIX 3 is started.
This allows the use of video modes with more rows or colums than the
standard 80x25 mode. You can use any text mode in the 00-FF range, and VESA
extended modes in the 100-FFF range. Most text modes use a 9x16 font with
400 scanlines on screen, so you see 400/16 = 25 lines. The text mode can be
modified by adding special flags to the console setting. Add
2000 to switch to 480 scan lines, adding 20% more lines to the screen. Add
4000 to select a 9x14 font, so 28 or 34 lines are shown. Add 8000 instead
to select an 8x8 font showing 50 or 60 lines. Each setting has drawbacks.
Using 480 scanlines implies a 60 Hz refresh, so the screen may flicker. The
8x8 font looks squashed. More letters on screen require more memory, so there
is less for virtual consoles. Interesting modes to try are 4003 (80x28),
2003 (80x30), 6003 (80x34), 8003 (80x50), A003 (80x60), 109 (132x25),
10A (132x43), 10B (132x50), 10C (132x60). The 109 VESA mode is often
available, and can be modified like mode 3. Use mode 7 instead of 3 for
monochrome. Which modes and flags work can only be found out by experiment.
More parameters may follow the mode number that are of interest
to the console driver, see
.BR boot (8).
.RE
.SP
.B dosfile-d0
.RS
Set by the DOS version of the monitor to the name of the virtual disk, i.e.
the
.I virdisk
argument as shown above. The "dosfile" driver
will use this as the name of the file to use as a disk.
.RE
.SP
Two variables are only used by the monitor, even though they are passed to the
kernel too:
.SP
.B image
.RS
The name of the file containing the kernel image, by default
.BR minix .
If it refers to a directory however then the newest file inside the
directory is chosen to be the kernel image. The names inside
.B /minix/
are best set to the MINIX 3 version you are using, which looks good when the
monitor prints its name. Rules for pretty printing image names:
.RS
.SP
A '/' or '_' is changed to a space.
.SP
The first letter is changed from lowercase to uppercase.
.SP
An 'r' if followed by a digit changes to " revision ".
.RE
.RE
.SP
.B label
.RS
If set then only processes marked with this label or without a label are
loaded from the image.
.RE
.SP
.B Installboot \-boot
will create functions to select images and labels. These functions will set
.B label
and
.B image
and echo what you selected. The two numbers separated by a colon used as an
image name tell the starting sector and sector count of the image on disk.
.RE
.SP
\fIname\fP() \fIcommand\fP
.RS
Define function.
.br
Functions may be used to bundle a set of commands, so that you can easily
boot MINIX 3 with a different set of parameters then normal. E.g.
.SP
.RS
ram() { rootdev=ram; boot }
.RE
.SP
will allow you to run MINIX 3 with the root device on RAM for a change, if you
normally use a real device as root. There are three predefined functions,
.BR leader ,
with default value an
.B echo
command that shows the monitor's startup banner,
.BR main ,
with default value
.BR menu ,
and
.BR trailer ,
with default value a command that clears the screen.
The monitor executes
.B leader;main
at startup to show the banner message and a menu. The
.B trailer
function is executed just before MINIX 3 is started. These three functions can
be redefined as you please.
.RE
.SP
\fIname\fP(\fIkey\fP) \fIcommand\fP
.RS
Define kernel selecting function.
.br
The menu command uses functions like these to add menu entries to select
a different kernel from a boot disk.
.B Installboot \-boot
produces these functions when the images are labeled. The label
.B AT
would give:
.SP
.RS
AT(a) {label=AT;image=42:626;echo AT kernel selected;menu}
.RE
.SP
With the menu option:
.SP
.RS
a Select AT kernel
.RE
.SP
Typing
.B a
will then execute the
.B AT
function above.
.RE
.SP
\fIname\fP(\fIkey\fP,\fItext\fP) \fIcommand\fP
.RS
User defined menu option.
.br
This variant may be used to make any menu entry you like:
.SP
.RS
dos(d,Boot MS-DOS) boot d0p0
.RE
.SP
.I Text
may be anything, even parentheses if they match.
.RE
.SP
.I name
.RS
Call function.
.br
If
.I name
is a user defined function then its value is expanded and executed in place of
.IR name .
Try a recursive one like 'rec() {rec;xx}' one day. You can see the monitor
run out of space with nice messages about using
.BR chmem (1)
to increase it's heap.
.RE
.SP
\fBboot\fP [\fB\-\fP\fIopts\fP]
.br
\fBboot\fP \fIdevice\fP
.RS
Boot MINIX 3 or another O.S.
.br
Without an argument,
.B boot
will load and execute the MINIX 3 image named by the
.B image
variable. With options the variable
.B bootopts
is first set to
.BI \- opts
before MINIX 3 is started, and unset when Minix returns. With a
.I device
argument,
.B boot
loads the boot sector of
.I device
into memory and jumps to it, starting another operating system. You would
normally use partitions on the first hard disk for this command (d0p[0\-3]),
using d0 will also work (choosing the active partition). One can also boot
devices on the second hard disk (d1, d1p[0\-3]) if the bootstrap writer did
not hardwire the disk number to disk 0.
.br
Some Operating Systems can only be booted from the active partition, if
you use a '*', e.g.
.BR "boot *d0p2" ,
then partition 2 is first made active. You'll then need to use
.SP
.RS
.BI "installboot \-m /dev/c0d0 /usr/mdec/jumpboot" " keys"
.RE
.SP
with
.I keys
chosen so that MINIX 3 is booted at startup. (See
.BR installboot (8).)
.RE
.SP
\fBctty\fP \fIn\fP
.RS
Copies output to and takes input from serial line
.I n
(0-3) at 9600 baud, 8 bits, no parity.
This allows you to control a MINIX 3 system remotely through an RS-232
connection.
.RE
.SP
\fBdelay\fP [\fImsec\fP]
.RS
Delay (500 msec default).
.br
Fast booting speed was one of the objectives when this program was created,
so a hard disk boot usually takes only a fraction of a second. If you need
some time (to hit Escape, or stare at the numbers) you can use
.B delay
to make the monitor pause for a specified number of milliseconds.
.RE
.SP
\fBecho\fP \fIword\fP ...
.RS
Print these words.
.br
Used to display messages, like the startup banner. Echo normally prints
the words with spaces in between and a newline at the end. Echo understands
special '\e' escape sequences as follows:
.RS
.SP
\e (At the end) Don't print a newline.
.br
\en Print a newline.
.br
\ev Print the monitor's version numbers.
.br
\ec Clear the screen.
.br
\ew Wait until a RETURN is typed
.br
\e\e Print a backslash.
.RE
.RE
.SP
\fBls\fP [\fIdirectory\fP]
.RS
List contents of a directory.
.br
Useful when looking for kernel images.
.RE
.SP
.B menu
.RS
Menu driven startup.
.br
This command allows you to execute functions defined with a
.IR key .
If no menu functions have been defined then
.B menu
will use this one hidden built-in function:
.SP
.RS
*(=,Start Minix) boot
.SP
.RE
Kernel selecting functions only add new options to this set, but if you
define a two argument function yourself then the above one is no longer
shown, allowing you to customize the menu completely. Your first
function definition should therefore be one that starts MINIX 3.
.SP
Menu entries are shown in the same order as
.B set
shows them. If you don't like the order then you have to unset the
functions and retype them in the proper order.
.SP
If you type a key then a scheduled trap is killed and the appropriate menu
function is executed. If you need more time to choose then hit the
spacebar. A key not on the menu also kills a trap, but does nothing more.
.RE
.SP
.B save
.RS
Save environment.
.br
This will save all the environment variables and functions with nondefault
values to the parameter sector (the second sector on the boot device), so
they are automatically set the next time you boot the monitor.
.RE
.SP
.B set
.RS
Show environment.
.br
Show the current values of the environment variables and functions. Default
values are shown between parentheses to distinguish them from values that
were explicitly set.
.RE
.SP
\fBtrap\fP \fImsec\fP \fIfunction\fP
.RS
Schedule function.
.br
Schedules a function to be executed after
.I msec
milliseconds. Only the monitor mode cannot be interrupted, a scheduled trap
is killed when the prompt is printed. Example:
.SP
.RS
main() {trap 10000 boot; menu}
.RE
.SP
This gives you 10 seconds to choose a menu option before MINIX 3 is booted.
.RE
.SP
\fBunset\fP \fIname\fP ...
.RS
Unset environment variables.
.br
Removes the named variables and functions from the environment, and sets
special variables back to their default values. This is also the only way
to remove the "device name translation" property from a variable.
.RE
.SP
\fBexit\fP
.RS
Exit the monitor.
.br
Reboot the machine, exit to MINIX 3 or exit to DOS as appropriate.
.RE
.SP
\fBoff\fP
.RS
Turn the PC off.
.br
If the PC supports power management then turn it off, otherwise
print some error messages and do nothing.
.RE
.SP
\fB{\fP \fIcommand\fP; ... \fB}\fP
.RS
Bundle commands.
.br
Treat a number of commands as a single command. Used for function
definitions when a function body must contain more than one command.
.RE
.SH DEVICES
The MINIX 3 kernel can't do anything with device names, so they have to be
translated to device numbers before they are passed to the kernel. This
number is found under the st_rdev field (see
.BR stat (2))
of the file on the boot file system. The monitor will look for the device
file with the working directory set to '/dev'. If it can't find the device
name then it will translate names like 'ram', 'fd1', 'c0d1p0', 'c1d0p2s0',
and even the obsolete 'hd2a' to what it itself thinks the numbers should be.
.PP
The special name
.B bootdev
is translated to the name of the device booted from, like 'fd0',
or 'c0d0p1s0', and then searched for in /dev.
.B Bootdev
can only be translated to a device for the first controller, and only if
the disks on that controller are numbered without "gaps". (The master
device on the second IDE channel is always d2 on MINIX 3. The BIOS will
call it disk 0, 1, or 2 depending on the number of disks on the first
IDE channel.)
.SP
Controller numbers are meaningless to the BIOS, so everything is assumed to
be attached to controller 0. You can omit
.B c0
for device names, and it is best to always omit
.B c0
for the
.B boot
command, and to always use the full name for variables passed to MINIX 3.
.SH EXTENSIONS
A few extensions have been made to this program for kernel hackers. They
may be triggered by setting bits in the flags word in the kernel startup
code (the mpx file.) The flag bits are:
.TP 10
0x0001
Call kernel in 386 mode.
.TP
0x0002
Do not make space for the bss areas of processes other than the kernel.
.TP
0x0004
Use the stack size set by
.BR chmem (1).
.TP
0x0008
Load PM, VFS, etc. into extended memory.
.TP
0x0010
No need to patch process sizes into the kernel.
.TP
0x0020
The kernel can return to the monitor on halt or reboot.
.TP
0x0040
Offer generic BIOS support instead of just INT 13 (disk I/O).
.TP
0x0080
Pass memory lists for free and used memory (processes).
.TP
0x0100
Kernel returns monitor code on shutdown in boot parameters array.
.SH "SEE ALSO"
.BR controller (4),
.BR installboot (8),
.BR usage (8),
.BR boot (8),
.BR dosminix (8).
.SH BUGS
The
.B delay
command will hang forever on the original IBM PC (not the XT!). Not that it
matters, as everything takes forever on that box.
.PP
By redefining
.B leader
one can easily hide the identity of this program.
.SH ACKNOWLEDGMENTS
Earl Chew, for the inspiration his ShoeLace package provided, unless he wants
to file a "look and feel" suit against me, then I will say I modeled it after
the Sun ROM boot monitor, which is also true.
.SH AUTHOR
Kees J. Bot (kjb@cs.vu.nl)
.\"
.\" $PchId: monitor.8,v 1.11 2002/02/27 19:36:34 philip Exp $

0
man/man8/newroot.8 Executable file → Normal file
View file

View file

@ -46,10 +46,6 @@ FORWARD _PROTOTYPE( void handle_vfs_reply, (void) );
#define click_to_round_k(n) \
((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
#if !defined(__ELF__)
extern int unmap_ok;
#endif
/* SEF functions and variables. */
FORWARD _PROTOTYPE( void sef_local_startup, (void) );
FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) );
@ -302,19 +298,6 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
system_hz = sys_hz();
/* Map out our own text and data. This is normally done in crtso.o
* but PM is an exception - we don't get to talk to VM so early on.
* That's why we override munmap() and munmap_text() in utility.c.
*
* _minix_unmapzero() is the same code in crtso.o that normally does
* it on startup. It's best that it's there as crtso.o knows exactly
* what the ranges are of the filler data.
*/
#if !defined(__ELF__)
unmap_ok = 1;
_minix_unmapzero();
#endif
/* Initialize user-space scheduling. */
sched_init();

View file

@ -149,7 +149,3 @@ message *m_ptr;
rmp->mp_flags |= VFS_CALL;
}
#if !defined(__ELF__)
int unmap_ok = 0;
#endif

View file

@ -10,8 +10,6 @@
*/
#include "inc.h"
#include <fcntl.h>
#include <a.out.h>
#include <minix/crtso.h>
#include "kernel/const.h"
#include "kernel/type.h"
#include "kernel/proc.h"
@ -24,9 +22,6 @@ FORWARD _PROTOTYPE(void boot_image_info_lookup, ( endpoint_t endpoint,
FORWARD _PROTOTYPE(void catch_boot_init_ready, (endpoint_t endpoint) );
FORWARD _PROTOTYPE(void get_work, (message *m_ptr, int *status_ptr) );
/* Flag set when memory unmapping can be done. */
EXTERN int unmap_ok;
/* SEF functions and variables. */
FORWARD _PROTOTYPE( void sef_local_startup, (void) );
FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) );
@ -459,12 +454,6 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
/* Clean up the old RS instance, the new instance will take over. */
cleanup_service(rp);
/* Map out our own text and data. */
unmap_ok = 1;
#if !defined(__ELF__)
_minix_unmapzero();
#endif
/* Ask VM to pin memory for the new RS instance. */
if((s = vm_memctl(RS_PROC_NR, VM_RS_MEM_PIN)) != OK) {
panic("unable to pin memory for the new RS instance: %d", s);

View file

@ -61,8 +61,6 @@ struct {
FORWARD _PROTOTYPE(int map_service, (struct rprocpub *rpub));
FORWARD _PROTOTYPE(int vm_acl_ok, (endpoint_t caller, int call));
extern int unmap_ok;
/* SEF functions and variables. */
FORWARD _PROTOTYPE( void sef_local_startup, (void) );
FORWARD _PROTOTYPE( int sef_cb_init_fresh, (int type, sef_init_info_t *info) );
@ -379,12 +377,6 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
/* Initialize the structures for queryexit */
init_query_exit();
/* Unmap our own low pages. */
unmap_ok = 1;
#if !defined(__ELF__)
_minix_unmapzero();
#endif
/* Map all the services in the boot image. */
if((s = sys_safecopyfrom(RS_PROC_NR, info->rproctab_gid, 0,
(vir_bytes) rprocpub, sizeof(rprocpub), S)) != OK) {

View file

@ -94,7 +94,7 @@ hdboot: image
done
cp kernel /boot/minix/.temp/
[ -d /boot/image ] && ln -f /boot/minix/.temp/kernel /boot/kernel || true
exec sh mkboot $@ minix
sh mkboot $@ minix
exec sh update_bootcfg.sh
fdboot: image