view src/impl/pipe.h @ 280:21a5761e3e7a

mv_extraction_dg_compile_sources Context2Util
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 28 Jan 2020 15:20:34 +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;