Annotation of researchv10dc/lsys/sys/stream.h, revision 1.1.1.1

1.1       root        1: #define        QPCTL   0100            /* priority control message */
                      2: #define        QBSIZE  64              /* "standard" size of queue block*/
                      3: #define QBBSIZE 1024           /* size of a big queue block */
                      4: 
                      5: /*
                      6:  * data queue
                      7:  */
                      8: struct queue {
                      9:        struct  qinit   *qinfo;         /* procs and limits for queue */
                     10:        struct  block   *first;         /* first data block */
                     11:        struct  block   *last;          /* last data block */
                     12:        struct  queue   *next;          /* Q of next stream */
                     13:        struct  queue   *link;          /* to next Q for scheduling */
                     14:        caddr_t ptr;                    /* to private data structure */
                     15:        short   count;                  /* number of blocks on Q */
                     16:        u_short flag;
                     17: };
                     18: 
                     19: /* Queue flags */
                     20: #define        QENAB   01                      /* Queue is already enabled to run */
                     21: #define        QWANTR  02                      /* Someone wants to read Q */
                     22: #define        QWANTW  04                      /* Someone wants to write Q */
                     23: #define        QFULL   010                     /* Q is considered full */
                     24: #define        QREADR  020                     /* This is the reader (first) Q */
                     25: #define        QUSE    040                     /* This queue in use (allocation) */
                     26: #define        QNOENB  0100                    /* Don't enable Q via putq */
                     27: #define        QDELIM  0200                    /* This queue generates delimiters */
                     28: #define        QBIGB   0400                    /* This queue would like big blocks */
                     29: 
                     30: /*
                     31:  * queue information structure
                     32:  */
                     33: struct qinit {
                     34:        int     (*putp)();              /* put procedure */
                     35:        int     (*srvp)();              /* service procedure */
                     36:        long    (*qopen)();             /* called on startup */
                     37:        int     (*qclose)();            /* called on finish */
                     38:        short   limit;                  /* high water mark */
                     39:        short   lolimit;                /* low water mark */
                     40: };
                     41: 
                     42: #define        OTHERQ(q)       ((q)->flag&QREADR? (q)+1: (q)-1)
                     43: #define        WR(q)           (q+1)
                     44: #define        RD(q)           (q-1)
                     45: 
                     46: /*
                     47:  * Queue data block
                     48:  */
                     49: struct block {
                     50:        struct  block   *next;          /* next in chain */
                     51:        u_char  *rptr;                  /* first unconsumed data */
                     52:        u_char  *wptr;                  /* next unwritten data */
                     53:        u_char  *lim;                   /* max for wptr */
                     54:        u_char  *base;                  /* min for rptr/wptr */
                     55:        u_char  type;                   /* type of block contents */
                     56:        u_char  class;                  /* size class (plus S_DELIM flag) */
                     57:        u_char  bufix;                  /* buffer index (for io maps) */
                     58:        u_char  rbufix;                 /* real index for anon block */
                     59:        u_char  data[4];                /* data contents for tiny blocks */
                     60: };
                     61: 
                     62: #define        NOBUFIX 255
                     63: #define        S_DELIM 0200                    /* This block is followed by a delimiter */
                     64: #define        CL_MASK 0177
                     65: 
                     66: /*
                     67:  * Header for a stream: interface to rest of system
                     68:  */
                     69: struct stdata {
                     70:        struct  queue *wrq;             /* write queue */
                     71:        struct  block *iocblk;          /* return block for ioctl */
                     72:        struct  inode *inode;           /* backptr, for hangups */
                     73:        struct  proc *wsel;             /* process write-selecting */
                     74:        struct  proc *rsel;             /* process read-selecting */
                     75:        short   pgrp;                   /* process group, for signals */
                     76:        short   flag;
                     77:        char    count;                  /* # processes in stream routines */
                     78: };
                     79: #define        IOCWAIT 01                      /* Someone wants to do ioctl */
                     80: #define RSLEEP 02                      /* Someone wants to read */
                     81: #define        WSLEEP  04                      /* Someone wants to write */
                     82: #define        HUNGUP  010                     /* Device has vanished */
                     83: #define        RSEL    020                     /* read-select collision*/
                     84: #define        WSEL    040                     /* write-select collision */
                     85: #define        EXCL    0100                    /* exclusive-use (no opens) */
                     86: #define        STWOPEN 0200                    /* waiting for 1st open */
                     87: 
                     88: #ifdef KERNEL
                     89: struct block   *getq();
                     90: int    putq();
                     91: int    noput();
                     92: struct block   *allocb();
                     93: struct block   *cramb();
                     94: struct block   *dupb();
                     95: struct queue   *backq();
                     96: struct queue   *allocq();
                     97: struct inode   *stopen();
                     98: #endif
                     99: 
                    100: /*
                    101:  * Control messages (regular priority)
                    102:  */
                    103: #define        M_DATA  0               /* regular data (not ctl) */
                    104: #define        M_BREAK 01              /* line break */
                    105: #define        M_HANGUP 02             /* line disconnect */
                    106: #define        M_DELIM 03              /* data delimiter */
                    107: #define        M_ECHO  04              /* request ACK (1 param) */
                    108: #define        M_ACK   05              /* response to ECHO (1 param) */
                    109: #define        M_IOCTL 06              /* ioctl; set/get params */
                    110: #define        M_DELAY 07              /* real-time xmit delay (1 param) */
                    111: #define        M_CTL   010             /* device-specific control message */
                    112: #define        M_PASS  011             /* pass file */
                    113: #define        M_YDEL  012             /* stream has started generating delims */
                    114: #define        M_NDEL  013             /* stream has stopped generating delims */
                    115: 
                    116: /*
                    117:  * Control messages (high priority; go to head of queue)
                    118:  */
                    119: #define        M_SIGNAL 0101           /* generate process signal */
                    120: #define        M_FLUSH 0102            /* flush your queues */
                    121: #define        M_STOP  0103            /* stop transmission immediately */
                    122: #define        M_START 0104            /* restart transmission after stop */
                    123: #define        M_IOCACK 0105           /* acknowledge ioctl */
                    124: #define        M_IOCNAK 0106           /* negative ioctl acknowledge */
                    125: #define        M_PRICTL 0107           /* high priority device-specific ctl */
                    126: #define        M_IOCWAIT 0110          /* stop ioctl timeout, ack/nak follows later */
                    127: 
                    128: #define        setqsched()     mtpr(SIRR, 0x3)
                    129: 
                    130: /*
                    131:  * ioctl message packet
                    132:  */
                    133: 
                    134: #define        STIOCSIZE       16
                    135: #define        STIOCHDR        4
                    136: 
                    137: struct stioctl {
                    138:        unsigned char com[STIOCHDR];    /* four-byte command, low order byte first */
                    139:        char data[STIOCSIZE];   /* depends on command */
                    140: };
                    141: 
                    142: #define        stiocom(bp)     (((struct stioctl *)bp->rptr)->com[0]|(((struct stioctl *)bp->rptr)->com[1]<<8))        /* two high bytes ignored for now */
                    143: #define        stiodata(bp)    (((struct stioctl *)bp->rptr)->data)
                    144: 
                    145: /*
                    146:  * for passing files across streams
                    147:  */
                    148: struct kpassfd {
                    149:        union  {
                    150:                struct  file *fp;
                    151:                int     fd;
                    152:        } f;
                    153:        short   uid;
                    154:        short   gid;
                    155:        short   nice;
                    156:        char    logname[8];
                    157: };
                    158: 
                    159: /*
                    160:  * header for messages, see mesg.c
                    161:  */
                    162: 
                    163: struct mesg {
                    164:        char    type;
                    165:        u_char  magic;
                    166:        u_char  losize, hisize;
                    167: };
                    168: 
                    169: #define        MSGMAGIC        0345
                    170: #define        MSGHLEN 4       /* true length of struct mesg in bytes */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.