view src/impl/pipe.h @ 185:7fc3c3da2159

bump pipe.h
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 21 Jan 2020 14:50:15 +0900
parents 21e83548d738
children 9d385a07dbfc
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

    // 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_fileclose(Impl* pipe, Isa* file, __code next(...));
    __code cbc_fileclose2(Impl* pipe, Isa* file,struct file* ff,  __code next(...));
    __code cbc_fileclose3(Impl* pipe, Isa* file,struct file* ff,  __code next(...));
    __code cbc_pipe_close(Impl* p, int writable, __code next(...));
    __code cbc_pipe_close_writeopen(Impl* p, __code next(...));
    __code cbc_pipe_close_readopen(Impl* p, __code next(...));
} pipe;