[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fstat() on a pipe or socketpair descriptor always shows size / length of
fstat() on a pipe or socketpair descriptor always shows size / length of 0 (zero)
Thu, 11 Sep 2003 10:14:06 -0400
My apologies if this has been addressed before. I've tried to reach an archive
of the mail list but all the links I've clicked on don't find the servers.
Please CC me on any responses, as I'm not subscribed. address@hidden
I've had code that has worked.. updated the linux kernel and libraries with a
brand new install of the same (but newer version of) distribution, run my code
and it doesn't work.. time goes by, newer kernel/libraries so I install a fresh
copy of the next version of the linux distribution, test my code it works...
newer linux, fresh install, test code it doesn't work... which is where I'm at.
When I call fstat() on a pipe or socketpair descriptor that is NOT empty, the
stat struct that fstat() fills in always reports a size of 0 (zero). To the
best of my knowledge the system is supposed to provide the length/size of data
that is ready to be read.
Here is the pseudo code that, keep in mind, has worked before:
duplicate a pipe descriptor so that the pipe makes up file descriptors 0, 1,
call system() with command line command 'ls'
call fstat() to determine the size of data the 'ls' produced
create buffer the size of waiting data
read data into buffer
I've compared the kernel configuration to see if I'm leaving out something
between a system setup that works and the one that now doesn't work, and I
don't see anything missing. Also this doesn't appear to be a hardware issue
since I can repeat the trouble on different machines.
Any hints or pointers would be greatly appreciated. Thanks in advance.
- fstat() on a pipe or socketpair descriptor always shows size / length of 0 (zero),