Research V6 development
authorKen Thompson <ken@research.uucp>
Wed, 14 May 1975 00:56:49 +0000 (19:56 -0500)
committerKen Thompson <ken@research.uucp>
Wed, 14 May 1975 00:56:49 +0000 (19:56 -0500)
Work on file usr/sys/reg.h
Work on file usr/sys/param.h
Work on file usr/sys/file.h
Work on file usr/sys/filsys.h
Work on file usr/sys/conf.h
Work on file usr/sys/ino.h
Work on file usr/sys/tty.h
Work on file usr/sys/systm.h
Work on file usr/sys/text.h

Co-Authored-By: Dennis Ritchie <dmr@research.uucp>
Synthesized-from: v6

usr/sys/conf.h [new file with mode: 0644]
usr/sys/file.h [new file with mode: 0644]
usr/sys/filsys.h [new file with mode: 0644]
usr/sys/ino.h [new file with mode: 0644]
usr/sys/param.h [new file with mode: 0644]
usr/sys/reg.h [new file with mode: 0644]
usr/sys/systm.h [new file with mode: 0644]
usr/sys/text.h [new file with mode: 0644]
usr/sys/tty.h [new file with mode: 0644]

diff --git a/usr/sys/conf.h b/usr/sys/conf.h
new file mode 100644 (file)
index 0000000..acb2b8d
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Used to dissect integer device code
+ * into major (driver designation) and
+ * minor (driver parameter) parts.
+ */
+struct
+{
+       char    d_minor;
+       char    d_major;
+};
+
+/*
+ * Declaration of block device
+ * switch. Each entry (row) is
+ * the only link between the
+ * main unix code and the driver.
+ * The initialization of the
+ * device switches is in the
+ * file conf.c.
+ */
+struct bdevsw
+{
+       int     (*d_open)();
+       int     (*d_close)();
+       int     (*d_strategy)();
+       int     *d_tab;
+} bdevsw[];
+
+/*
+ * Nblkdev is the number of entries
+ * (rows) in the block switch. It is
+ * set in binit/bio.c by making
+ * a pass over the switch.
+ * Used in bounds checking on major
+ * device numbers.
+ */
+int    nblkdev;
+
+/*
+ * Character device switch.
+ */
+struct cdevsw
+{
+       int     (*d_open)();
+       int     (*d_close)();
+       int     (*d_read)();
+       int     (*d_write)();
+       int     (*d_sgtty)();
+} cdevsw[];
+
+/*
+ * Number of character switch entries.
+ * Set by cinit/tty.c
+ */
+int    nchrdev;
diff --git a/usr/sys/file.h b/usr/sys/file.h
new file mode 100644 (file)
index 0000000..9c44ab3
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * One file structure is allocated
+ * for each open/creat/pipe call.
+ * Main use is to hold the read/write
+ * pointer associated with each open
+ * file.
+ */
+struct file
+{
+       char    f_flag;
+       char    f_count;        /* reference count */
+       int     f_inode;        /* pointer to inode structure */
+       char    *f_offset[2];   /* read/write character pointer */
+} file[NFILE];
+
+/* flags */
+#define        FREAD   01
+#define        FWRITE  02
+#define        FPIPE   04
diff --git a/usr/sys/filsys.h b/usr/sys/filsys.h
new file mode 100644 (file)
index 0000000..6a53d78
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Definition of the unix super block.
+ * The root super block is allocated and
+ * read in iinit/alloc.c. Subsequently
+ * a super block is allocated and read
+ * with each mount (smount/sys3.c) and
+ * released with unmount (sumount/sys3.c).
+ * A disk block is ripped off for storage.
+ * See alloc.c for general alloc/free
+ * routines for free list and I list.
+ */
+struct filsys
+{
+       int     s_isize;        /* size in blocks of I list */
+       int     s_fsize;        /* size in blocks of entire volume */
+       int     s_nfree;        /* number of in core free blocks (0-100) */
+       int     s_free[100];    /* in core free blocks */
+       int     s_ninode;       /* number of in core I nodes (0-100) */
+       int     s_inode[100];   /* in core free I nodes */
+       char    s_flock;        /* lock during free list manipulation */
+       char    s_ilock;        /* lock during I list manipulation */
+       char    s_fmod;         /* super block modified flag */
+       char    s_ronly;        /* mounted read-only flag */
+       int     s_time[2];      /* current date of last update */
+       int     pad[50];
+};
diff --git a/usr/sys/ino.h b/usr/sys/ino.h
new file mode 100644 (file)
index 0000000..d9fbd4f
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Inode structure as it appears on
+ * the disk. Not used by the system,
+ * but by things like check, df, dump.
+ */
+struct inode
+{
+       int     i_mode;
+       char    i_nlink;
+       char    i_uid;
+       char    i_gid;
+       char    i_size0;
+       char    *i_size1;
+       int     i_addr[8];
+       int     i_atime[2];
+       int     i_mtime[2];
+};
+
+/* modes */
+#define        IALLOC  0100000
+#define        IFMT    060000
+#define                IFDIR   040000
+#define                IFCHR   020000
+#define                IFBLK   060000
+#define        ILARG   010000
+#define        ISUID   04000
+#define        ISGID   02000
+#define ISVTX  01000
+#define        IREAD   0400
+#define        IWRITE  0200
+#define        IEXEC   0100
diff --git a/usr/sys/param.h b/usr/sys/param.h
new file mode 100644 (file)
index 0000000..c422492
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * tunable variables
+ */
+
+#define        NBUF    15              /* size of buffer cache */
+#define        NINODE  100             /* number of in core inodes */
+#define        NFILE   100             /* number of in core file structures */
+#define        NMOUNT  5               /* number of mountable file systems */
+#define        NEXEC   3               /* number of simultaneous exec's */
+#define        MAXMEM  (64*32)         /* max core per process - first # is Kw */
+#define        SSIZE   20              /* initial stack size (*64 bytes) */
+#define        SINCR   20              /* increment of stack (*64 bytes) */
+#define        NOFILE  15              /* max open files per process */
+#define        CANBSIZ 256             /* max size of typewriter line */
+#define        CMAPSIZ 100             /* size of core allocation area */
+#define        SMAPSIZ 100             /* size of swap allocation area */
+#define        NCALL   20              /* max simultaneous time callouts */
+#define        NPROC   50              /* max number of processes */
+#define        NTEXT   40              /* max number of pure texts */
+#define        NCLIST  100             /* max total clist size */
+#define        HZ      60              /* Ticks/second of the clock */
+
+/*
+ * priorities
+ * probably should not be
+ * altered too much
+ */
+
+#define        PSWP    -100
+#define        PINOD   -90
+#define        PRIBIO  -50
+#define        PPIPE   1
+#define        PWAIT   40
+#define        PSLEP   90
+#define        PUSER   100
+
+/*
+ * signals
+ * dont change
+ */
+
+#define        NSIG    20
+#define                SIGHUP  1       /* hangup */
+#define                SIGINT  2       /* interrupt (rubout) */
+#define                SIGQIT  3       /* quit (FS) */
+#define                SIGINS  4       /* illegal instruction */
+#define                SIGTRC  5       /* trace or breakpoint */
+#define                SIGIOT  6       /* iot */
+#define                SIGEMT  7       /* emt */
+#define                SIGFPT  8       /* floating exception */
+#define                SIGKIL  9       /* kill */
+#define                SIGBUS  10      /* bus error */
+#define                SIGSEG  11      /* segmentation violation */
+#define                SIGSYS  12      /* sys */
+#define                SIGPIPE 13      /* end of pipe */
+
+/*
+ * fundamental constants
+ * cannot be changed
+ */
+
+#define        USIZE   16              /* size of user block (*64) */
+#define        NULL    0
+#define        NODEV   (-1)
+#define        ROOTINO 1               /* i number of all roots */
+#define        DIRSIZ  14              /* max characters per directory */
+
+/*
+ * structure to access an
+ * integer in bytes
+ */
+struct
+{
+       char    lobyte;
+       char    hibyte;
+};
+
+/*
+ * structure to access an integer
+ */
+struct
+{
+       int     integ;
+};
+
+/*
+ * Certain processor registers
+ */
+#define PS     0177776
+#define KL     0177560
+#define SW     0177570
diff --git a/usr/sys/reg.h b/usr/sys/reg.h
new file mode 100644 (file)
index 0000000..71f1b5f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Location of the users' stored
+ * registers relative to R0.
+ * Usage is u.u_ar0[XX].
+ */
+#define        R0      (0)
+#define        R1      (-2)
+#define        R2      (-9)
+#define        R3      (-8)
+#define        R4      (-7)
+#define        R5      (-6)
+#define        R6      (-3)
+#define        R7      (1)
+#define        RPS     (2)
+
+#define        TBIT    020             /* PS trace bit */
diff --git a/usr/sys/systm.h b/usr/sys/systm.h
new file mode 100644 (file)
index 0000000..08b71d7
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Random set of variables
+ * used by more than one
+ * routine.
+ */
+char   canonb[CANBSIZ];        /* buffer for erase and kill (#@) */
+int    coremap[CMAPSIZ];       /* space for core allocation */
+int    swapmap[SMAPSIZ];       /* space for swap allocation */
+int    *rootdir;               /* pointer to inode of root directory */
+int    cputype;                /* type of cpu =40, 45, or 70 */
+int    execnt;                 /* number of processes in exec */
+int    lbolt;                  /* time of day in 60th not in time */
+int    time[2];                /* time in sec from 1970 */
+int    tout[2];                /* time of day of next sleep */
+/*
+ * The callout structure is for
+ * a routine arranging
+ * to be called by the clock interrupt
+ * (clock.c) with a specified argument,
+ * in a specified amount of time.
+ * Used, for example, to time tab
+ * delays on teletypes.
+ */
+struct callo
+{
+       int     c_time;         /* incremental time */
+       int     c_arg;          /* argument to routine */
+       int     (*c_func)();    /* routine */
+} callout[NCALL];
+/*
+ * Mount structure.
+ * One allocated on every mount.
+ * Used to find the super block.
+ */
+struct mount
+{
+       int     m_dev;          /* device mounted */
+       int     *m_bufp;        /* pointer to superblock */
+       int     *m_inodp;       /* pointer to mounted on inode */
+} mount[NMOUNT];
+int    mpid;                   /* generic for unique process id's */
+char   runin;                  /* scheduling flag */
+char   runout;                 /* scheduling flag */
+char   runrun;                 /* scheduling flag */
+char   curpri;                 /* more scheduling */
+int    maxmem;                 /* actual max memory per process */
+int    *lks;                   /* pointer to clock device */
+int    rootdev;                /* dev of root see conf.c */
+int    swapdev;                /* dev of swap see conf.c */
+int    swplo;                  /* block number of swap space */
+int    nswap;                  /* size of swap space */
+int    updlock;                /* lock for sync */
+int    rablock;                /* block to be read ahead */
+char   regloc[];               /* locs. of saved user registers (trap.c) */
diff --git a/usr/sys/text.h b/usr/sys/text.h
new file mode 100644 (file)
index 0000000..f6ff234
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Text structure.
+ * One allocated per pure
+ * procedure on swap device.
+ * Manipulated by text.c
+ */
+struct text
+{
+       int     x_daddr;        /* disk address of segment */
+       int     x_caddr;        /* core address, if loaded */
+       int     x_size;         /* size (*64) */
+       int     *x_iptr;        /* inode of prototype */
+       char    x_count;        /* reference count */
+       char    x_ccount;       /* number of loaded references */
+} text[NTEXT];
diff --git a/usr/sys/tty.h b/usr/sys/tty.h
new file mode 100644 (file)
index 0000000..7e29eac
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * A clist structure is the head
+ * of a linked list queue of characters.
+ * The characters are stored in 4-word
+ * blocks containing a link and 6 characters.
+ * The routines getc and putc (m45.s or m40.s)
+ * manipulate these structures.
+ */
+struct clist
+{
+       int     c_cc;           /* character count */
+       int     c_cf;           /* pointer to first block */
+       int     c_cl;           /* pointer to last block */
+};
+
+/*
+ * A tty structure is needed for
+ * each UNIX character device that
+ * is used for normal terminal IO.
+ * The routines in tty.c handle the
+ * common code associated with
+ * these structures.
+ * The definition and device dependent
+ * code is in each driver. (kl.c dc.c dh.c)
+ */
+struct tty
+{
+       struct  clist t_rawq;   /* input chars right off device */
+       struct  clist t_canq;   /* input chars after erase and kill */
+       struct  clist t_outq;   /* output list to device */
+       int     t_flags;        /* mode, settable by stty call */
+       int     *t_addr;        /* device address (register or startup fcn) */
+       char    t_delct;        /* number of delimiters in raw q */
+       char    t_col;          /* printing column of device */
+       char    t_erase;        /* erase character */
+       char    t_kill;         /* kill character */
+       char    t_state;        /* internal state, not visible externally */
+       char    t_char;         /* character temporary */
+       int     t_speeds;       /* output+input line speed */
+       int     t_dev;          /* device name */
+};
+
+char partab[];                 /* ASCII table: parity, character class */
+
+#define        TTIPRI  10
+#define        TTOPRI  20
+
+#define        CERASE  '#'             /* default special characters */
+#define        CEOT    004
+#define        CKILL   '@'
+#define        CQUIT   034             /* FS, cntl shift L */
+#define        CINTR   0177            /* DEL */
+
+/* limits */
+#define        TTHIWAT 50
+#define        TTLOWAT 30
+#define        TTYHOG  256
+
+/* modes */
+#define        HUPCL   01
+#define        XTABS   02
+#define        LCASE   04
+#define        ECHO    010
+#define        CRMOD   020
+#define        RAW     040
+#define        ODDP    0100
+#define        EVENP   0200
+#define        NLDELAY 001400
+#define        TBDELAY 006000
+#define        CRDELAY 030000
+#define        VTDELAY 040000
+
+/* Hardware bits */
+#define        DONE    0200
+#define        IENABLE 0100
+
+/* Internal state bits */
+#define        TIMEOUT 01              /* Delay timeout in progress */
+#define        WOPEN   02              /* Waiting for open to complete */
+#define        ISOPEN  04              /* Device is open */
+#define        SSTART  010             /* Has special start routine at addr */
+#define        CARR_ON 020             /* Software copy of carrier-present */
+#define        BUSY    040             /* Output in progress */
+#define        ASLEEP  0100            /* Wakeup when output done */