summaryrefslogtreecommitdiff
path: root/fs/fd.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fd.c')
-rw-r--r--fs/fd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/fd.c b/fs/fd.c
index 7ba7142..740bf35 100644
--- a/fs/fd.c
+++ b/fs/fd.c
@@ -25,6 +25,11 @@ bool fd_has(fd* f)
if(!f->has)kpanic("no has func")
return f->has(f->data);
}
+bool fd_can_write(fd* f)
+{
+ if(!f->can_write)kpanic("no has func")
+ return f->can_write(f->data);
+}
bool fd_eof(fd* f)
{
@@ -203,6 +208,10 @@ bool pipe_has(uint32_t *data)
{
return ringbuffer_has(data);
}
+bool pipe_can_write(uint32_t *data)
+{
+ return !ringbuffer_full(data);
+}
bool pipe_eof(uint8_t *data)
{
@@ -248,6 +257,7 @@ int fds_from_pipe(fd pipefds[2])
read.eof=pipe_eof;
wrt.eof=0;
+ wrt.can_write=pipe_can_write;
read.close=pipe_r_close;
wrt.close=pipe_w_close;