Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!snorkelwacker!bloom-beacon!bu.edu!nntp-read!composer From: composer@bucsf.bu.edu (Jeff Kellem) Newsgroups: comp.sys.encore Subject: st_blksize value from fstat(2) on pipes (Multimax, UMAX4.2) Summary: Looking for a clarification. Message-ID: Date: 12 Mar 90 07:44:15 GMT Sender: news@bu.edu.bu.edu Reply-To: composer@cs.bu.edu Organization: Boston Univ., Computer Science Lines: 47 From the UMAX4.2 fstat(2) man page... When fd is associated with a pipe, fstat reports an ordinary file with an inode number, restricted permissions, and a possibly meaningless length. Ok, that's understandable. But, it doesn't say what st_blksize should be. From the pipe(2) man page, one can infer that this value SHOULD be 4096, since "up to 4096 bytes of data are buffered before the writing process is suspended", and since st_blksize is supposed to be the optimal blocksize for I/O operations. On the otherhand, realizing that the pipe(2) system call is really implemented via socketpair(2), and noticing that in the RESTRICTIONS section of the fstat(2) man page, it states: Applying fstat to a socket returns a zeroed buffer. then we have a contradication in the fstat man page. Unless, of course, fstat is able to magically determine that the fd connected to this socket was created via pipe(2) and will return some real data instead of zeroing out the buffer. Unfortunately, when fstat-ing a file descriptor (fd) that is connected to a pipe, st_blksize gets set to zero, when (in my opinion) it should be set to 4096. I also did a quick check on the value of st_ino and st_mode when the fd is a pipe. They seem to be set to zero. It looks as though the stat buffer might be getting zeroed out from the fstat call (since pipes are really implemented using the socketpair(2) call). So, does fstat actually put any information into the stat buffer when the fd is a pipe? If it doesn't, considering that the pipe is using sockets, then maybe this should be noted in the UMAX4.3 man pages, before release. Though, I would PREFER that fstat return some useful information when the fd is connected to a pipe, especially the st_blksize field, as it does on other unix OS'. Hope this made sense. It's hard to tell at 2:30am... Thanks for any information regarding this... -jeff Jeff Kellem INTERNET: composer@cs.bu.edu (or composer@bu.edu) UUCP: ...!harvard!bu-cs!composer