[LCP]stat'ing a FIFO

Robert Wuest rwuest at wuest.org
Mon Jul 23 13:56:50 UTC 2001


Hi,

Can anyone tell me how to stat a FIFO?  In a program 1, I pipe() twice,
then fork. In the child, I dup() the appropiate fd's to stdin and
stdout, and exec program 2.  Normal stuff.  In either program: 	

	struct stat stat_buf; 
	fstat( fd, &stat_buf );  // fd = 0 or 1 in program 2's case

always has 0 for the size, stat_buf.st_size.  Even when I know there is
unread data in there.  Read or write. Is there some other trick I need
to know?

Also, is there anyway to get a signal when there is data to be read?


Thanks,

Robert



More information about the linuxCprogramming mailing list