From 1944173cbf97009bac2f4d12e7175c5c1dcaa043 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Thu, 24 Aug 1995 16:14:51 +0000 Subject: (trivfs_goaway, trivfs_modify_stat): Update arguments. (trivfs_modify_stat): Give the size of the fifo now that we've got a handle on it. --- trans/fifo.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'trans/fifo.c') diff --git a/trans/fifo.c b/trans/fifo.c index 60e44b5b..6593be91 100644 --- a/trans/fifo.c +++ b/trans/fifo.c @@ -261,20 +261,24 @@ error_t (*trivfs_peropen_create_hook) (struct trivfs_peropen *) = open_hook; void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *) = close_hook; void -trivfs_modify_stat (struct stat *st) +trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st) { - st->st_size = 0; - st->st_blocks = 0; + struct pipe *pipe = cred->po->hook; + st->st_mode &= ~S_IFMT; st->st_mode |= S_IFIFO; + + mutex_lock (&pipe->lock); + st->st_size = pipe_readable (pipe, 1); + st->st_blocks = st->st_size >> 9; + mutex_unlock (&pipe->lock); + /* As we try to be clever with large transfers, ask for them. */ st->st_blksize = vm_page_size * 16; } error_t -trivfs_goaway (int flags, mach_port_t realnode, - struct port_class *control_class, - struct port_class *protid_class) +trivfs_goaway (struct trivfs_control *cntl, int flags) { exit(0); } -- cgit v1.2.3