xfs
[Top] [All Lists]

stat() flushes named pipe?

To: linux-xfs@xxxxxxxxxxx
Subject: stat() flushes named pipe?
From: Lennert Buytenhek <buytenh@xxxxxxx>
Date: Sun, 8 Apr 2001 14:36:42 -0400
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Mutt/1.2.5i
Hi,

I think I found something fishy in XFS. Or at least, something which is working
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>