xfs
[Top] [All Lists]

Re: stat() flushes named pipe?

To: Lennert Buytenhek <buytenh@xxxxxxx>
Subject: Re: stat() flushes named pipe?
From: Steve Lord <lord@xxxxxxx>
Date: Mon, 09 Apr 2001 09:56:20 -0500
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: Message from Lennert Buytenhek <buytenh@xxxxxxx> of "Sun, 08 Apr 2001 14:36:42 EDT." <20010408143642.A32116@xxxxxxx>
Sender: owner-linux-xfs@xxxxxxxxxxx
This is indeed happening - the pipe data is still there, it is just that
xfs is hiding it from you, small fix on its way into cvs land now.

Steve

> 
> Hi,
> 
> I think I found something fishy in XFS. Or at least, something which is worki
> ng
> on ext2 isn't working on XFS. Calling stat() on a named pipe which is on an
> XFS filesystem seems to flush all queued data in that pipe.
> 
> Testcase:
> # mkfifo XYZ
> # ./t &                                       (t.c attached)
> # echo foo > XYZ
> 
> correct output: "read returned 4"
> wrong output: "read returned 0"
> 
> 
> cheers,
> Lennert
> 
> 
> -- t.c
> #include <stdio.h>
> #include <stdlib.h>
> #include <fcntl.h>
> #include <sys/stat.h>
> #include <unistd.h>
> 
> int main()
> {
>         char buf[512];
>         int fd;
>         int i;
>         struct stat sb;
> 
>         fd = open("XYZ", O_RDONLY);
>         fstat(fd, &sb);
>         printf("read returned %i\n", read(fd, buf, 512));
> 
>         return 0;
> }



<Prev in Thread] Current Thread [Next in Thread>