24 lines
564 B
C
24 lines
564 B
C
#ifndef __PIPE_H
|
|
#define __PIPE_H
|
|
|
|
#include "types.h"
|
|
#include "spinlock.h"
|
|
#include "file.h"
|
|
|
|
#define PIPESIZE 512
|
|
|
|
struct pipe {
|
|
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 pipealloc(struct file **f0, struct file **f1);
|
|
void pipeclose(struct pipe *pi, int writable);
|
|
int pipewrite(struct pipe *pi, uint64 addr, int n);
|
|
int piperead(struct pipe *pi, uint64 addr, int n);
|
|
|
|
#endif |