summaryrefslogtreecommitdiff
path: root/fs/fd.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-10-09 16:21:32 +0200
committerMiguel <m.i@gmx.at>2018-10-09 16:21:32 +0200
commit63e5017d9863d4ed215782e469e8ee2c6ff8473d (patch)
treef12d149ffa34e6a39f4bce4fe9a001e4ca8c6027 /fs/fd.c
parenta6a11437a390fb7e95fe995214d82bf5dbfe1eaf (diff)
fix pipers
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;