home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / linux / 23073 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  2.2 KB

  1. Xref: sparky comp.os.linux:23073 comp.std.c:3330
  2. Path: sparky!uunet!mcsun!Germany.EU.net!ira.uka.de!rz.uni-karlsruhe.de!fg70.rz.uni-karlsruhe.de!ig25
  3. From: ig25@fg70.rz.uni-karlsruhe.de (Thomas Koenig)
  4. Newsgroups: comp.os.linux,comp.std.c
  5. Subject: Re: Library 4.1 bug/feature?  fopen("fifo","a") fails
  6. Date: 7 Jan 1993 15:53:23 GMT
  7. Organization: University of Karlsruhe, Germany
  8. Lines: 39
  9. Message-ID: <1ihjljINNeu7@nz12.rz.uni-karlsruhe.de>
  10. References: <1igs2mINNdpp@nz12.rz.uni-karlsruhe.de> <1993Jan7.104939.10424@serval.net.wsu.edu>
  11. Reply-To: ig25@rz.uni-karlsruhe.de
  12. NNTP-Posting-Host: fg70.rz.uni-karlsruhe.de
  13.  
  14. [note crossposting to comp.std.c]
  15.  
  16. In article <1993Jan7.104939.10424@serval.net.wsu.edu> hlu@luke.eecs.wsu.edu (H.J. Lu) writes:
  17. >In article <1igs2mINNdpp@nz12.rz.uni-karlsruhe.de> ig25@rz.uni-karlsruhe.de writes:
  18.  
  19. [concerning the libc library 4.1 for Linux]
  20.  
  21. >>Is it a bug or a feature that fopen("fifo","a"), where "fifo" is a named
  22. >>pipe, fails with an 'illegal lseek' in the 4.1 version of the library?
  23. >>The opinion on comp.std.unix seems to be that there should be no
  24. >>problem...
  25. >
  26. >That is a feature of stdio/kernel. I was told that according to ANSI
  27. >standard, fopen ("foo", "a") should do a lseek () to the end after
  28. >calling open (). But linux kernel refuses to any lseek () on
  29. >non-regular files. The fixes are
  30. >
  31. >1. Change stdio such that ignore error from lseek (). I don't
  32. >   like this one.
  33. >2. Change kernel such that if a file can not lseek (), just return
  34. >   without error.
  35. >3. Change kernel such that if a file can not lseek (), just return
  36. >   with a special error which can be recognized by stdio that a
  37. >   lseek is requested on a non-suported file.
  38. >4. Change your source code to use fopen ("foo", "w").
  39.  
  40. [rest deleted]
  41.  
  42. From my understanding of the ANSI C standard, the main thing is not to
  43. overwrite anything in a file opened with mode "a".  It should be legal
  44. to implement the stdio library in such a way that, when opening a fifo
  45. in "a" mode, no lseek() call is made.  A later fseek() - call to a
  46. stream opened for append should be ignored, anyway.
  47.  
  48. Anything wrong with the suggestion above?
  49. -- 
  50. Thomas Koenig, ig25@rz.uni-karlsruhe.de, ig25@dkauni2.bitnet
  51. The joy of engineering is to find a straight line on a double logarithmic
  52. diagram.
  53.