From caf79156722645e699fd38cead6f24378ef51ef5 Mon Sep 17 00:00:00 2001 From: Ken Thompson Date: Wed, 10 Jan 1979 15:12:39 -0500 Subject: [PATCH] Research V7 development Work on file usr/include/sys/pk.h Work on file usr/include/sys/times.h Work on file usr/include/a.out.h Work on file usr/include/ar.h Work on file usr/include/core.h Work on file usr/include/assert.h Work on file usr/include/dk.h Work on file usr/include/errno.h Work on file usr/include/execargs.h Work on file usr/include/dumprestor.h Work on file usr/include/ident.h Work on file usr/include/grp.h Work on file usr/include/olddump.h Work on file usr/include/pack.h Work on file usr/include/pwd.h Work on file usr/include/setjmp.h Work on file usr/include/symbol.h Work on file usr/include/signal.h Work on file usr/include/utmp.h Work on file usr/include/time.h Co-Authored-By: Dennis Ritchie Synthesized-from: v7 --- usr/include/a.out.h | 33 +++++++++++ usr/include/ar.h | 9 +++ usr/include/assert.h | 7 +++ usr/include/core.h | 4 ++ usr/include/dk.h | 51 +++++++++++++++++ usr/include/dumprestor.h | 33 +++++++++++ usr/include/errno.h | 40 +++++++++++++ usr/include/execargs.h | 1 + usr/include/grp.h | 6 ++ usr/include/ident.h | 1 + usr/include/olddump.h | 92 +++++++++++++++++++++++++++++ usr/include/pack.h | 121 +++++++++++++++++++++++++++++++++++++++ usr/include/pwd.h | 11 ++++ usr/include/setjmp.h | 1 + usr/include/signal.h | 21 +++++++ usr/include/symbol.h | 9 +++ usr/include/sys/pk.h | 121 +++++++++++++++++++++++++++++++++++++++ usr/include/sys/times.h | 9 +++ usr/include/time.h | 11 ++++ usr/include/utmp.h | 5 ++ 20 files changed, 586 insertions(+) create mode 100644 usr/include/a.out.h create mode 100644 usr/include/ar.h create mode 100644 usr/include/assert.h create mode 100644 usr/include/core.h create mode 100644 usr/include/dk.h create mode 100644 usr/include/dumprestor.h create mode 100644 usr/include/errno.h create mode 100644 usr/include/execargs.h create mode 100644 usr/include/grp.h create mode 100644 usr/include/ident.h create mode 100644 usr/include/olddump.h create mode 100644 usr/include/pack.h create mode 100644 usr/include/pwd.h create mode 100644 usr/include/setjmp.h create mode 100644 usr/include/signal.h create mode 100644 usr/include/symbol.h create mode 100644 usr/include/sys/pk.h create mode 100644 usr/include/sys/times.h create mode 100644 usr/include/time.h create mode 100644 usr/include/utmp.h diff --git a/usr/include/a.out.h b/usr/include/a.out.h new file mode 100644 index 0000000000..75e2ba9fa4 --- /dev/null +++ b/usr/include/a.out.h @@ -0,0 +1,33 @@ +struct exec { /* a.out header */ + int a_magic; /* magic number */ + unsigned a_text; /* size of text segment */ + unsigned a_data; /* size of initialized data */ + unsigned a_bss; /* size of unitialized data */ + unsigned a_syms; /* size of symbol table */ + unsigned a_entry; /* entry point */ + unsigned a_unused; /* not used */ + unsigned a_flag; /* relocation info stripped */ +}; + +#define A_MAGIC1 0407 /* normal */ +#define A_MAGIC2 0410 /* read-only text */ +#define A_MAGIC3 0411 /* separated I&D */ +#define A_MAGIC4 0405 /* overlay */ + +struct nlist { /* symbol table entry */ + char n_name[8]; /* symbol name */ + int n_type; /* type flag */ + unsigned n_value; /* value */ +}; + + /* values for type flag */ +#define N_UNDF 0 /* undefined */ +#define N_ABS 01 /* absolute */ +#define N_TEXT 02 /* text symbol */ +#define N_DATA 03 /* data symbol */ +#define N_BSS 04 /* bss symbol */ +#define N_TYPE 037 +#define N_REG 024 /* register name */ +#define N_FN 037 /* file name symbol */ +#define N_EXT 040 /* external bit, or'ed in */ +#define FORMAT "%06o" /* to print a value */ diff --git a/usr/include/ar.h b/usr/include/ar.h new file mode 100644 index 0000000000..88708076e0 --- /dev/null +++ b/usr/include/ar.h @@ -0,0 +1,9 @@ +#define ARMAG 0177545 +struct ar_hdr { + char ar_name[14]; + long ar_date; + char ar_uid; + char ar_gid; + int ar_mode; + long ar_size; +}; diff --git a/usr/include/assert.h b/usr/include/assert.h new file mode 100644 index 0000000000..6c51adc8b8 --- /dev/null +++ b/usr/include/assert.h @@ -0,0 +1,7 @@ +# ifndef NDEBUG +# define _assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__, __LINE__);exit(1);}} +# define assert(ex) {if (!(ex)){fprintf(stderr,"Assertion failed: file %s, line %d\n", __FILE__, __LINE__);exit(1);}} +# else +# define _assert(ex) ; +# define assert(ex) ; +# endif diff --git a/usr/include/core.h b/usr/include/core.h new file mode 100644 index 0000000000..69155c727f --- /dev/null +++ b/usr/include/core.h @@ -0,0 +1,4 @@ +/* machine dependent stuff for core files */ +#define TXTRNDSIZ 8192L +#define stacktop(siz) (0x10000L) +#define stackbas(siz) (0x10000L-siz) diff --git a/usr/include/dk.h b/usr/include/dk.h new file mode 100644 index 0000000000..9cbe4ff586 --- /dev/null +++ b/usr/include/dk.h @@ -0,0 +1,51 @@ +/* + * switch commands + */ +#define RAM_ON 0226 +#define ROM_ON 0322 +#define R_CNTL 0264 +#define W_CNTL 0170 + + +/* + * library routine declarations + */ +extern long cmread(); +extern long ocmread(); + + +/* + * call setup struct + */ + +struct dialout { + char srv; + char area; + char sw; + char mch; + char chan; + char other; + short check; +}; + +struct indial { + char i_lchan; + char i_rhost; + char i_rchan; + char i_srv; + char i_area; + char i_sw; + char i_mch; + char i_chan; + char i_other; + short i_check; +}; +#define D_SH 1 +#define D_FS 2 +#define D_LSTNR 3 + + +struct ring { + char r_lchan; + char r_srv; +}; diff --git a/usr/include/dumprestor.h b/usr/include/dumprestor.h new file mode 100644 index 0000000000..83c1dfc6dc --- /dev/null +++ b/usr/include/dumprestor.h @@ -0,0 +1,33 @@ +#define NTREC 20 +#define MLEN 16 +#define MSIZ 4096 + +#define TS_TAPE 1 +#define TS_INODE 2 +#define TS_BITS 3 +#define TS_ADDR 4 +#define TS_END 5 +#define TS_CLRI 6 +#define MAGIC (int)60011 +#define CHECKSUM (int)84446 +struct spcl +{ + int c_type; + time_t c_date; + time_t c_ddate; + int c_volume; + daddr_t c_tapea; + ino_t c_inumber; + int c_magic; + int c_checksum; + struct dinode c_dinode; + int c_count; + char c_addr[BSIZE]; +} spcl; + +struct idates +{ + char id_name[16]; + char id_incno; + time_t id_ddate; +}; diff --git a/usr/include/errno.h b/usr/include/errno.h new file mode 100644 index 0000000000..3ff9fde529 --- /dev/null +++ b/usr/include/errno.h @@ -0,0 +1,40 @@ +/* + * Error codes + */ + +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EAGAIN 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define ENOTBLK 15 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define EINVAL 22 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define ETXTBSY 26 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 + +/* math software */ +#define EDOM 33 +#define ERANGE 34 diff --git a/usr/include/execargs.h b/usr/include/execargs.h new file mode 100644 index 0000000000..17511bfe28 --- /dev/null +++ b/usr/include/execargs.h @@ -0,0 +1 @@ +char **execargs = (char**)(-2); diff --git a/usr/include/grp.h b/usr/include/grp.h new file mode 100644 index 0000000000..59ad28cc88 --- /dev/null +++ b/usr/include/grp.h @@ -0,0 +1,6 @@ +struct group { /* see getgrent(3) */ + char *gr_name; + char *gr_passwd; + int gr_gid; + char **gr_mem; +}; diff --git a/usr/include/ident.h b/usr/include/ident.h new file mode 100644 index 0000000000..05cf4aa08f --- /dev/null +++ b/usr/include/ident.h @@ -0,0 +1 @@ +char myname[] = "research 11/70"; diff --git a/usr/include/olddump.h b/usr/include/olddump.h new file mode 100644 index 0000000000..7ebb959e8e --- /dev/null +++ b/usr/include/olddump.h @@ -0,0 +1,92 @@ +#define MAXSIZE 500 /* max size in blocks of dumped files */ +#define NILIST 100 /* max files extracted at once */ +#define BFACT 20 /* tape blocking factor */ + +int tden 1600; /* tape density */ +int tlen 2200; /* tape length (feet) */ + +char *dump_cmd[] = { /* default args for dump */ + "dump", + "i", + "/dev/rp0", + 0 +}; + +char *rest_cmd[] = { /* defaults for restor */ + "restor", + "t", + 0 +}; + +char *tape "/dev/rmt1"; +char dfile[] "/dev/dtab"; +char tfile[] "/tmp/dtmp"; +char name[100]; + +#define NDTAB 10 +struct { + char dt_name[16]; + time_t dt_date; +} dtab[NDTAB]; + +struct thdr { + ino_t isize; + ino_t maxi; + daddr_t fsize; + time_t cdate; + time_t ddate; + long tsize; + int nflg; +}; + +struct fhdr { + short xmagic; + ino_t xino; + short xmode; + short xnlink; + short xuid; + short xgid; + daddr_t xaddr; + off_t xsize; + time_t xatime; + time_t xmtime; + time_t xctime; +}; +#define FMAGIC 012345 +#define SMAGIC 031415 + +#define DAPTB 127 /* (BSIZE-2*sizeof(short))/sizeof(daddr_t)) */ + +FILE *tmpf; + +long +getsize() +{ + register c; + long j; + + c = getc(tmpf); + if(c == EOF) + return((long)-1); + if(c <= 253) + return((long)c); + if(c == 255) + return((long)-1); + j = 0; + for(c=0;c<3;c++) + j = (j<<8) + (getc(tmpf)&0377); + return(j); +} + +putsize(s) +long s; +{ + if(s <= 253) { + putc((char)s, tmpf); + return; + } + putc(254, tmpf); + putc((char)(s>>16), tmpf); + putc((char)(s>>8), tmpf); + putc((char)s, tmpf); +} diff --git a/usr/include/pack.h b/usr/include/pack.h new file mode 100644 index 0000000000..9b67aac7b2 --- /dev/null +++ b/usr/include/pack.h @@ -0,0 +1,121 @@ +struct header { + char sync; + char ksize; + unsigned short sum; + char cntl; + char ccntl; +}; +#define HDRSIZ 6 + +struct pack { + short p_state; /* line state */ + short p_bits; /* mask for getepack */ + short p_rsize; /* input packet size */ + short p_xsize; /* output packet size */ + struct header p_ihbuf; /* input header */ + struct header p_ohbuf; /* output header */ + char *p_rptr; + char p_mode; + char **p_ipool; + char p_xcount; /* # active output buffers */ + char p_rcount; + char p_nout,p_tout; + char p_lpsize; /* log(psize/32) */ + char p_timer; + char p_obusy; + char p_srxmit; + char p_rwindow; /* window size */ + char p_swindow; + char p_msg; /* control msg */ + char p_rmsg; /* repeated control msg */ + char p_ps,p_pr; /* last packet sent, recv'd */ + char p_rpr; + char p_nxtps; /* next output seq number */ + char p_imap; /* bit map of input buffers */ + char p_pscopy; /* newest output packet */ + char *p_ob[8]; /* output buffers */ + char *p_ib[8]; /* input buffers */ + char p_os[8]; /* output buffer status */ + char p_is[8]; /* input buffer status */ + short p_osum[8]; /* output checksums */ + short p_isum[8]; /* input checksums */ + DSYSTEM; +}; +#define CHECK 0125252 +#define SYN 020 +#define MOD8 7 +#define ISCNTL(a) ((a & 0300)==0) +#define MIN(a,b) ((a