view src/impl/pipe.h @ 192:429f0c3cc097

fix
author tobaru
date Wed, 22 Jan 2020 19:41:31 +0900
parents 000e247dc51d
children 26be78edaf83
line wrap: on
line source

typedef struct pipe<Impl, Isa> impl file {
    #define PIPESIZE 512
    union Data* file;
    struct spinlock lock;
    char data[PIPESIZE];
    uint nread;     // number of bytes read
    uint nwrite;    // number of bytes written
    int readopen;   // read fd is still open
    int writeopen;  // write fd is still open

    int ref;   // reference count
    char readable;
    char writable;
    unsigned int off;

    // interface field
    int n;
    char* addr;

    // private code gear
    __code piperead1(Impl* pipe, char* addr, int n, __code next(...));
    __code piperead2(Impl* pipe, char* addr, int n, __code next(...));
    __code cbc_pipeclose(Impl* pipe, Isa* file, __code next(...));
    __code cbc_pipeclose2(Impl* pipe, Isa* file, Isa* ff,  __code next(...));
    __code cbc_pipeclose3(Impl* pipe, Isa* file, Isa* ff,  __code next(...));
    __code cbc_pipeclose4(Impl* pipe, int writable, __code next(...));
    __code cbc_pipe_close_writeopen(Impl* pipe, __code next(...));
    __code cbc_pipe_close_readopen(Impl* pipe, __code next(...));
} pipe;