Re: PROBLEM: fstat(2) returns st_size==0 for non-empty FIFO.

From: Alejandro Riveira FernÃndez
Date: Wed Sep 10 2008 - 05:19:33 EST


El Tue, 9 Sep 2008 16:05:06 -0700
John Wenker <jjw@xxxxxx> escribiÃ:

> A colleague has run into a problem. We assume it's a kernel issue. Here
> is the pertinent bug report data.
>
> [1.] One line summary of the problem:
> fstat(2) returns st_size == 0 for a FIFO that is known to have data in it.
>
> [2.] Full description of the problem/report:
> When using a FIFO, fstat(2) (and stat(2)) returns a 'struct stat' with the
> st_size field equal to zero, at a time when the FIFO is known to have data
> in it. Problem occurs with Linux 2.6.16 kernel (see more below), but does
> not occur on 2.4.20.
>
> [3.] Keywords (i.e., modules, networking, kernel):
> stat, fstat, FIFO, struct stat, st_size, system call, write
>
> [4.] Kernel version (from /proc/version):
> Linux version 2.6.16.13-4-default (geeko@buildhost) (gcc version 4.1.0
> (SUSE Linux)) #1 Wed May 3 04:53:23 UTC 2006
>
> Note: Problem does _not_ occur on Linux version 2.4.20-8
> (bhcompile@xxxxxxxxxxxxxxxxxxxxxx) (gcc version 3.2.2 2003022 (Red Hat
> Linux 3.2.2-5)) #1 Thu Mar 13 17:54:28 EST 2003
>
> [5.] Output of Oops.. message (if applicable) with symbolic information
> resolved (see Documentation/oops-tracing.txt)
> No oops. Problem doesn't cause system crash, only affects behavior of
> user applications.
>
> [6.] A small shell script or example program which triggers the
> problem (if possible)
> I don't know if this qualifies as "small", but there is a 'C' program
> attached that will reproduce the problem (fifo.c).

FWIW
$ LC_ALL=C ./fifo test
Enter a string to write into the FIFO: Hello World!
fifo: WARNING - 0 (of 14 requested) bytes written into FIFO.
0 bytes in FIFO.
$ uname -r
2.6.27-rc5





>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/