Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern PR/29679: Gunnar.Ritter: fstat() blksize on the wri...



details:   https://anonhg.NetBSD.org/src/rev/f9c79e3efc54
branches:  trunk
changeset: 574799:f9c79e3efc54
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 12 18:43:42 2005 +0000

description:
PR/29679: Gunnar.Ritter: fstat() blksize on the write side of the pipe returns
0. Fix it by returning the peer's block size.
XXX: This is the minimal fix. Probably the buffer size should be initialized
somewhere else, but probably this would need some more code changes.

diffstat:

 sys/kern/sys_pipe.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 3734f0b6229f -r f9c79e3efc54 sys/kern/sys_pipe.c
--- a/sys/kern/sys_pipe.c       Sat Mar 12 18:23:30 2005 +0000
+++ b/sys/kern/sys_pipe.c       Sat Mar 12 18:43:42 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_pipe.c,v 1.63 2005/02/26 21:34:55 perry Exp $      */
+/*     $NetBSD: sys_pipe.c,v 1.64 2005/03/12 18:43:42 christos Exp $   */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.63 2005/02/26 21:34:55 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.64 2005/03/12 18:43:42 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1254,6 +1254,8 @@
        memset((caddr_t)ub, 0, sizeof(*ub));
        ub->st_mode = S_IFIFO | S_IRUSR | S_IWUSR;
        ub->st_blksize = pipe->pipe_buffer.size;
+       if (ub->st_blksize == 0 && pipe->pipe_peer)
+               ub->st_blksize = pipe->pipe_peer->pipe_buffer.size;
        ub->st_size = pipe->pipe_buffer.cnt;
        ub->st_blocks = (ub->st_size) ? 1 : 0;
        TIMEVAL_TO_TIMESPEC(&pipe->pipe_atime, &ub->st_atimespec);



Home | Main Index | Thread Index | Old Index