home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.os.linux:23160 comp.std.c:3339
- Newsgroups: comp.os.linux,comp.std.c
- Path: sparky!uunet!haven.umd.edu!decuac!pa.dec.com!engage.pko.dec.com!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamond
- From: diamond@jit345.bad.jit.dec.com (Norman Diamond)
- Subject: Re: [Linux] Library 4.1 bug/feature? fopen("fifo","a") fails
- Message-ID: <1993Jan8.012236.28983@nntpd.lkg.dec.com>
- Sender: usenet@nntpd.lkg.dec.com (USENET News System)
- Reply-To: diamond@jit.dec.com (Norman Diamond)
- Organization: Digital Equipment Corporation Japan , Tokyo
- References: <1igs2mINNdpp@nz12.rz.uni-karlsruhe.de> <1993Jan7.104939.10424@serval.net.wsu.edu> <1ihjljINNeu7@nz12.rz.uni-karlsruhe.de>
- Date: Fri, 8 Jan 1993 01:22:36 GMT
- Lines: 40
-
- In article <1ihjljINNeu7@nz12.rz.uni-karlsruhe.de> ig25@rz.uni-karlsruhe.de writes:
- >In article <1993Jan7.104939.10424@serval.net.wsu.edu> hlu@luke.eecs.wsu.edu (H.J. Lu) writes:
- >>In article <1igs2mINNdpp@nz12.rz.uni-karlsruhe.de> ig25@rz.uni-karlsruhe.de writes:
- >>>Is it a bug or a feature that fopen("fifo","a"), where "fifo" is a named
- >>>pipe, fails with an 'illegal lseek' in the 4.1 version of the library?
- >>>The opinion on comp.std.unix seems to be that there should be no problem...
-
- >>That is a feature of stdio/kernel. I was told that according to ANSI
- >>standard, fopen ("foo", "a") should do a lseek () to the end after calling
- >>open (). But linux kernel refuses to any lseek () on non-regular files.
-
- >From my understanding of the ANSI C standard, the main thing is not to
- >overwrite anything in a file opened with mode "a".
-
- That is my understanding too. However, note that the ANSI C standard is
- concerned only with files on this matter. The ANSI C standard also states
- that certain kinds of data, written to certain kinds of files, can be read
- back unchanged. I think that named pipes cannot be considered as ANSI C
- files, only as implementation extensions. The standard does not really
- constrain extensions. Conforming implementations must still guarantee that
- strictly conforming programs will not observe a difference, but strictly
- conforming programs cannot use named pipes, so anything goes for named pipes.
-
- >It should be legal to implement the stdio library in such a way that, when
- >opening a fifo in "a" mode, no lseek() call is made.
-
- I believe that such an extension would remain friendly as well as not
- violating the standard (though the standard doesn't care about friendliness).
-
- >A later fseek() call to a stream opened for append should be ignored, anyway.
-
- For named pipes, maybe this would be OK, purely for the above reason, that
- named pipes are entirely implementation extensions. However, for ANSI C
- files, this would not be OK. There are cases with ANSI C files where, even
- if a stream is opened for append, and even though writes will be forced to
- the end of the file, fseek() cannot be ignored.
- --
- Norman Diamond diamond@jit.dec.com
- If this were the company's opinion, I wouldn't be allowed to post it.
- Pardon me? Or do I have to commit a crime first?
-